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

Base (memory) datasource. More...

#include <MemoryDS.h>

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

Public Member Functions

 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)
 

Additional Inherited Members

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

Detailed Description

Base (memory) datasource.

Class CMemoryDS implements a special case of the datasource when the data can be loaded all at once, in the datasource open() operation. It's a base class for several actual datasources.

Constructor & Destructor Documentation

◆ MemoryDS() [1/3]

sptk::MemoryDS::MemoryDS ( )
default

Default constructor

◆ MemoryDS() [2/3]

sptk::MemoryDS::MemoryDS ( const MemoryDS other)
delete

Deleted copy constructor

Parameters
otherOther object

◆ MemoryDS() [3/3]

sptk::MemoryDS::MemoryDS ( MemoryDS &&  other)
inlinenoexcept

Move constructor

Parameters
otherOther object

Member Function Documentation

◆ clear()

virtual void sptk::MemoryDS::clear ( )
virtual

Clears all the records

◆ close()

bool sptk::MemoryDS::close ( )
overridevirtual

Closes the datasource.

Reimplemented from sptk::DataSource.

◆ current()

virtual FieldList & sptk::MemoryDS::current ( )
inlinevirtual

Get current record

Returns
current record reference

◆ eof()

bool sptk::MemoryDS::eof ( ) const
inlineoverridevirtual

Returns true if there are no more records in the datasource. Implemented in derved class.

Reimplemented from sptk::DataSource.

◆ fieldCount()

size_t sptk::MemoryDS::fieldCount ( ) const
overridevirtual

Returns field count in the datasource.

Returns
field count

Implements sptk::DataSource.

◆ find()

bool sptk::MemoryDS::find ( const String fieldName,
const Variant position 
)
overridevirtual

Finds the record by the record position (defined by record's user_data or key).

Reimplemented from sptk::DataSource.

◆ first()

bool sptk::MemoryDS::first ( )
overridevirtual

Moves to the first record of the datasource.

Reimplemented from sptk::DataSource.

◆ last()

bool sptk::MemoryDS::last ( )
overridevirtual

Moves to the last record of the datasource.

Reimplemented from sptk::DataSource.

◆ next()

bool sptk::MemoryDS::next ( )
overridevirtual

Moves to the next record of the datasource.

Reimplemented from sptk::DataSource.

◆ open()

bool sptk::MemoryDS::open ( )
overridevirtual

Opens the datasource. Implemented in derved class.

Reimplemented from sptk::DataSource.

Reimplemented in sptk::ImapDS.

◆ operator=() [1/2]

MemoryDS & sptk::MemoryDS::operator= ( const MemoryDS other)
delete

Deleted copy assignment

Parameters
otherOther object

◆ operator=() [2/2]

MemoryDS & sptk::MemoryDS::operator= ( MemoryDS &&  other)
inlinenoexcept

Move assignment

Parameters
otherOther object

◆ operator[]() [1/2]

Field & sptk::MemoryDS::operator[] ( const String fieldName)
overridevirtual

Field access by the field name, non-const version.

Parameters
fieldNameconst char *, field name
Returns
field reference

Implements sptk::DataSource.

◆ operator[]() [2/2]

Field & sptk::MemoryDS::operator[] ( size_t  fieldIndex)
overridevirtual

Field access by the field index, const version.

Parameters
fieldIndexint, field index
Returns
field reference

Implements sptk::DataSource.

◆ prior()

bool sptk::MemoryDS::prior ( )
overridevirtual

Moves to the prior record of the datasource.

Reimplemented from sptk::DataSource.

◆ push_back()

void sptk::MemoryDS::push_back ( FieldList &&  fieldList)

Push back field list. Memory DS takes ownership of the data

Parameters
fieldListField list

◆ readField()

bool sptk::MemoryDS::readField ( const char *  fieldName,
Variant fieldValue 
)
overridevirtual

Reads the field by name from the datasource.

Parameters
fieldNameconst char *, field name
fieldValueCVariant, field value

Implements sptk::DataSource.

◆ recordCount()

size_t sptk::MemoryDS::recordCount ( ) const
overridevirtual

Returns record count in the datasource.

Returns
record count

Implements sptk::DataSource.

◆ writeField()

bool sptk::MemoryDS::writeField ( const char *  fieldName,
const Variant fieldValue 
)
overridevirtual

Writes the field by name from the datasource.

Parameters
fieldNameconst char *, field name
fieldValueCVariant, field value

Implements sptk::DataSource.


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

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