|
#include <CDataSource.h>

Public Member Functions | |
| CDataSource () | |
| Default constructor. | |
| virtual | ~CDataSource () |
| Destructor. | |
| virtual const CField & | operator[] (uint32_t fieldIndex) const =0 |
| virtual CField & | operator[] (uint32_t fieldIndex)=0 |
| virtual const CField & | operator[] (const char *fieldName) const =0 |
| virtual CField & | operator[] (const char *fieldName)=0 |
| virtual uint32_t | fieldCount () const =0 |
| virtual uint32_t | recordCount () const =0 |
| virtual void * | user_data () const |
| Returns user_data associated with the datasource. | |
| virtual bool | readField (const char *fieldName, CVariant &fieldValue)=0 |
| virtual bool | writeField (const char *fieldName, const CVariant &fieldValue)=0 |
| virtual bool | open () |
| Opens the datasource. Implemented in derved class. | |
| virtual bool | close () |
| Closes the datasource. Implemented in derved class. | |
| virtual bool | first () |
| Moves to the first record of the datasource. Implemented in derved class. | |
| virtual bool | next () |
| Moves to the next record of the datasource. Implemented in derved class. | |
| virtual bool | prior () |
| Moves to the prior record of the datasource. Implemented in derved class. | |
| virtual bool | last () |
| Moves to the last record of the datasource. Implemented in derved class. | |
| virtual bool | find (CVariant position) |
| Moves to the specified record position of the datasource. Implemented in derved class. | |
| virtual bool | eof () const |
| Returns true if there are no more records in the datasource. Implemented in derved class. | |
| bool | load () |
| Loads data into the datasource. | |
| bool | save () |
| Saves data from the datasource. | |
| void | rowToXML (CXmlNode &node, bool compactXmlMode) const |
| Saves dataset row data into XML. | |
| virtual void | toXML (CXmlNode &parentNode, std::string nodeName, bool compactXmlMode) |
| Saves data into XML. | |
Protected Member Functions | |
| virtual bool | loadData () |
| Loads datasource data. Should be implemented in derived class. | |
| virtual bool | saveData () |
| Saves data from datasource. Should be implemented in derived class. | |
Friends | |
| class | Fl_Group |
It's designed as a base class for multiple datasources available in SPTK. The main idea is to provide the simple interface that allows to open the datasource with certain parameters and read or write the datasource fields. And don't you forget to close it :)
| virtual uint32_t sptk::CDataSource::fieldCount | ( | ) | const [pure virtual] |
Returns field count in the datasource. Purely virtual. Should be implemented in derived class
Implemented in sptk::CMemoryDS, and sptk::CQuery.
| virtual CField& sptk::CDataSource::operator[] | ( | const char * | fieldName | ) | [pure virtual] |
Field access by the field name, const version. Purely virtual. Should be implemented in derived class
| fieldName | const char *, field name |
Implemented in sptk::CMemoryDS, and sptk::CQuery.
| virtual const CField& sptk::CDataSource::operator[] | ( | const char * | fieldName | ) | const [pure virtual] |
Field access by the field name, const version. Purely virtual. Should be implemented in derived class
| fieldName | const char *, field name |
Implemented in sptk::CMemoryDS, and sptk::CQuery.
| virtual CField& sptk::CDataSource::operator[] | ( | uint32_t | fieldIndex | ) | [pure virtual] |
Field access by the field index, non-const version Purely virtual. Should be implemented in derived class
| fieldIndex | uint32_t, field index |
Implemented in sptk::CMemoryDS, and sptk::CQuery.
| virtual const CField& sptk::CDataSource::operator[] | ( | uint32_t | fieldIndex | ) | const [pure virtual] |
Field access by the field index, const version. Purely virtual. Should be implemented in derived class
| fieldIndex | uint32_t, field index |
Implemented in sptk::CMemoryDS, and sptk::CQuery.
| virtual bool sptk::CDataSource::readField | ( | const char * | fieldName, | |
| CVariant & | fieldValue | |||
| ) | [pure virtual] |
Reads the field by name from the datasource. Purely virtual. Should be implemented in derived class
| fieldName | const char *, field name | |
| fieldValue | CVariant, field value |
Implemented in sptk::CMemoryDS, and sptk::CQuery.
| virtual uint32_t sptk::CDataSource::recordCount | ( | ) | const [pure virtual] |
Returns record count in the datasource. Purely virtual. Should be implemented in derived class
Implemented in sptk::CMemoryDS, and sptk::CQuery.
| void sptk::CDataSource::rowToXML | ( | CXmlNode & | node, | |
| bool | compactXmlMode | |||
| ) | const |
Saves dataset row data into XML.
If the compactXmlMode is true, the node would have fields presented as attributues. Otherwise, the fields are stored as subnodes.
| node | CXmlNode&, the XML node to fill in | |
| compactXmlMode | bool, compact XML flag |
| virtual void sptk::CDataSource::toXML | ( | CXmlNode & | parentNode, | |
| std::string | nodeName, | |||
| bool | compactXmlMode | |||
| ) | [virtual] |
Saves data into XML.
Opens the dataset, reads every row, and closes dataset. For every row in the dataset, creates the node with the name nodeName. If the compactXmlMode is true, the nodes would have fields presented as attributues. Otherwise, the fields are stored as subnodes.
| parentNode | CXmlNode&, the XML node to add subnodes to | |
| nodeName | std::string, the name for subnodes | |
| compactXmlMode | bool, compact XML flag |
| virtual bool sptk::CDataSource::writeField | ( | const char * | fieldName, | |
| const CVariant & | fieldValue | |||
| ) | [pure virtual] |
Writes the field by name from the datasource. Purely virtual. Should be implemented in derived class
| fieldName | const char *, field name | |
| fieldValue | CVariant, field value |
Implemented in sptk::CMemoryDS, and sptk::CQuery.