sptk2 logo
SPTK Home Page
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
sptk::DirectoryDS Class Reference

Directory datasource. More...

#include <DirectoryDS.h>

Inheritance diagram for sptk::DirectoryDS:
sptk::MemoryDS sptk::DataSource

Public Member Functions

 DirectoryDS (const String &_directory="", const String &_pattern="", int _showPolicy=0)
 
int showPolicy () const
 
void showPolicy (int type)
 
void directory (const String &d)
 
String directory () const
 
void pattern (const String &wildcards)
 
bool open () override
 
- Public Member Functions inherited from sptk::MemoryDS
 MemoryDS ()=default
 
 MemoryDS (const MemoryDS &other)=delete
 
 MemoryDS (MemoryDS &&other) noexcept
 
MemoryDSoperator= (const MemoryDS &other)=delete
 
MemoryDSoperator= (MemoryDS &&other) noexcept
 
virtual void clear ()
 
virtual FieldListcurrent ()
 
Fieldoperator[] (size_t fieldIndex) override
 
Fieldoperator[] (const String &fieldName) override
 
size_t fieldCount () const override
 
size_t recordCount () const override
 
bool readField (const char *fieldName, Variant &fieldValue) override
 
bool writeField (const char *fieldName, const Variant &fieldValue) override
 
bool open () override
 
bool close () override
 
bool first () override
 
bool next () override
 
bool prior () override
 
bool last () override
 
bool find (const String &fieldName, const Variant &position) override
 
bool eof () const override
 
bool empty () const
 
std::list< FieldList > & rows ()
 
const std::list< FieldList > & rows () const
 
void push_back (FieldList &&fieldList)
 
- Public Member Functions inherited from sptk::DataSource
 DataSource ()=default
 
virtual ~DataSource ()=default
 
virtual Fieldoperator[] (size_t fieldIndex)=0
 
virtual Fieldoperator[] (const String &fieldName)=0
 
virtual size_t fieldCount () const =0
 
virtual size_t recordCount () const =0
 
virtual bool readField (const char *fieldName, Variant &fieldValue)=0
 
virtual bool writeField (const char *fieldName, const Variant &fieldValue)=0
 
virtual bool open ()
 
virtual bool close ()
 
virtual bool first ()
 
virtual bool next ()
 
virtual bool prior ()
 
virtual bool last ()
 
virtual bool find (const String &, const Variant &)
 
virtual bool eof () const
 
bool load ()
 
bool save ()
 
void exportRowTo (const xdoc::SNode &node, bool compactXmlMode, bool nullLargeData=false)
 
virtual void exportTo (xdoc::Node &parentNode, const String &nodeName, bool compactXmlMode)
 

Static Public Member Functions

static std::shared_ptr< RegularExpression > wildcardToRegexp (const String &wildcard)
 

Static Protected Member Functions

static String getFileType (const fs::directory_entry &file, CSmallPixmapType &image, DateTime &modificationTime)
 

Additional Inherited Members

- Protected Member Functions inherited from sptk::DataSource
virtual bool loadData ()
 
virtual bool saveData ()
 

Detailed Description

Directory datasource.

A datasource with the list of files and directories along with their attributes. It works just as any other datasource. You set up the parameters, call open() and may use the list. Method close() should be called aftewards to release any allocated resourses.

Constructor & Destructor Documentation

◆ DirectoryDS()

sptk::DirectoryDS::DirectoryDS ( const String _directory = "",
const String _pattern = "",
int  _showPolicy = 0 
)
inline

Default Constructor

Parameters
_directoryDirectory path
_patternOS pattern(s) to match, separated by ';'
_showPolicyBit combination of show policies

Member Function Documentation

◆ directory() [1/2]

String sptk::DirectoryDS::directory ( ) const
inline

Returns current directory

◆ directory() [2/2]

void sptk::DirectoryDS::directory ( const String d)

Sets current directory

Referenced by sptk::CFileDialog::directory().

◆ getFileType()

static String sptk::DirectoryDS::getFileType ( const fs::directory_entry &  file,
CSmallPixmapType image,
DateTime modificationTime 
)
staticprotected

Sets up an appropriate image and a name for the file type

Parameters
fileFile information
Returns
the file type name

◆ open()

bool sptk::DirectoryDS::open ( )
overridevirtual

Opens the directory and fills in the dataset

Reimplemented from sptk::DataSource.

◆ pattern()

void sptk::DirectoryDS::pattern ( const String wildcards)
inline

Sets pattern in format like: "*.txt;*.csv;*.xls"

Parameters
patternPatterns to match, separated with ';'

References sptk::Strings::DELIMITER.

◆ showPolicy() [1/2]

int sptk::DirectoryDS::showPolicy ( ) const
inline

Returns current show policy,

See also
CDirectoryDSpolicies for more information
Returns
current show policy

◆ showPolicy() [2/2]

void sptk::DirectoryDS::showPolicy ( int  type)
inline

Sets current show policy, see CDirectoryDSpolicies for more information

◆ wildcardToRegexp()

static std::shared_ptr< RegularExpression > sptk::DirectoryDS::wildcardToRegexp ( const String wildcard)
static

Creates regular expression from wildcard

Parameters
wildcardWilcard
Returns
regular expression object

The documentation for this class was generated from the following file:

Fri Oct 14 2022 09:58:42: SPTK 5.4.1