| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- #ifndef KSGTDatei_H
- #define KSGTDatei_H
- #include "Array.h"
- namespace Framework
- {
- class Text;
- //! Manages a file where data is stored in tabular form
- class KSGTDatei : public virtual ReferenceCounter
- {
- private:
- Text* pfad;
- RCArray<RCArray<Text>>* data;
- public:
- //! Constructor
- DLLEXPORT KSGTDatei();
- //! Constructor
- //! \param pfad The path to the file
- DLLEXPORT KSGTDatei(const char* pfad);
- //! Constructor
- //! \param pfad The path to the file
- DLLEXPORT KSGTDatei(Text* pfad);
- //! Destructor
- DLLEXPORT ~KSGTDatei();
- //! 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<Text>* 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<Text>* 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 addFeld(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 addFeld(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 addFeld(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 addFeld(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 setFeld(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 setFeld(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 removeFeld(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* getFeld(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* zFeld(int zeile, int feld) const;
- };
- } // namespace Framework
- #endif
|