#ifndef KSGTFile_H #define KSGTFile_H #include "Array.h" namespace Framework { class Text; //! Manages a file where data is stored in tabular form class KSGTFile : public virtual ReferenceCounter { private: Text* pfad; RCArray>* data; public: //! Constructor DLLEXPORT KSGTFile(); //! Constructor //! \param pfad The path to the file DLLEXPORT KSGTFile(const char* pfad); //! Constructor //! \param pfad The path to the file DLLEXPORT KSGTFile(Text* pfad); //! Destructor DLLEXPORT ~KSGTFile(); //! Sets the path to the file //! \param pfad The path to the file DLLEXPORT void setPfad(const char* pfad); //! Sets the path to the file //! \param pfad The path to the file DLLEXPORT void setPfad(Text* pfad); //! Loads all data from the specified file //! \return 1 if loading was successful. 0 if an error occurred //! during loading DLLEXPORT bool laden(); //! Adds a row to the table //! \param feldAnzahl The number of fields in the row //! \param zWert A pointer to the values in the row without increased //! reference counter \return 1 if no error occurred DLLEXPORT bool addZeile(int feldAnzahl, RCArray* zWert); //! Replaces an existing row //! \param zeile The index of the row to replace //! \param feldAnzahl The number of fields in the row //! \param zWert A pointer to the values in the row without increased //! reference counter \return 1 if the row existed and was replaced. //! 0 if the specified row did not exist DLLEXPORT bool setZeile( int zeile, int feldAnzahl, RCArray* zWert); //! Deletes a row //! \param zeile The index of the row to delete //! \return 1 if the row was deleted. 0 if the row was not found DLLEXPORT bool removeZeile(int zeile); //! Adds a value to a specific row //! \param zeile The index of the row to add a value to //! \param pos The position in the row where the value should be added //! \param wert The value to store //! \return 1 if the value was successfully added. 0 if the row //! does not exist or pos is too large DLLEXPORT bool addField(int zeile, int pos, Text* wert); //! Adds a value to a specific row //! \param zeile The index of the row to add a value to //! \param pos The position in the row where the value should be added //! \param wert The value to store //! \return 1 if the value was successfully added. 0 if the row //! does not exist or pos is too large DLLEXPORT bool addField(int zeile, int pos, const char* wert); //! Adds a value at the end of a specific row //! \param zeile The index of the row to add a value to //! \param wert The value to store \return 1 if the value was //! successfully added. 0 if the row does not exist DLLEXPORT bool addField(int zeile, Text* wert); //! Adds a value at the end of a specific row //! \param zeile The index of the row to add a value to //! \param wert The value to store \return 1 if the value was //! successfully added. 0 if the row does not exist DLLEXPORT bool addField(int zeile, const char* wert); //! Sets a specific value in a row //! \param zeile The index of the row where a value should be changed //! \param feld The position in the row where the value should be set //! \param wert The value to store //! \return 1 if the value was successfully replaced. 0 if the row //! or the value does not exist DLLEXPORT bool setField(int zeile, int feld, Text* wert); //! Sets a specific value in a row //! \param zeile The index of the row where a value should be changed //! \param feld The position in the row where the value should be set //! \param wert The value to store //! \return 1 if the value was successfully replaced. 0 if the row //! or the value does not exist DLLEXPORT bool setField(int zeile, int feld, const char* wert); //! Removes a specific value //! \param zeile The index of the row from which a value should be deleted //! \param feld The position in the row where the value should be deleted //! \return 1 if the value was successfully deleted. 0 if the row //! or the value does not exist DLLEXPORT bool removeField(int zeile, int feld); //! Saves the table to the file //! \return 1 if the table was successfully saved DLLEXPORT bool speichern(); //! Returns the number of rows DLLEXPORT int getZeilenAnzahl() const; //! Returns the number of values (columns) in a row //! \param zeile The index of the row whose value count should be determined DLLEXPORT int getFeldAnzahl(int zeile) const; //! Returns a specific stored value //! \param zeile The index of the row where the value is stored //! \param feld The index of the value in the row //! \return The stored value with increased reference counter DLLEXPORT Text* getField(int zeile, int feld) const; //! Returns a specific stored value //! \param zeile The index of the row where the value is stored //! \param feld The index of the value in the row //! \return The stored value without increased reference counter DLLEXPORT Text* zField(int zeile, int feld) const; }; } // namespace Framework #endif