#ifndef InitFile_H #define InitFile_H #include "Array.h" namespace Framework { class Text; //! Text.h //! Manages initialization files where variables are stored in the format //! name=value class InitFile : public virtual ReferenceCounter { private: Text* pfad; RCArray* name; RCArray* wert; public: //! Constructor DLLEXPORT InitFile(); //! Constructor //! \param pfad The path to the file DLLEXPORT InitFile(Text* pfad); //! Constructor //! \param pfad The path to the file DLLEXPORT InitFile(const char* pfad); //! Destructor DLLEXPORT ~InitFile(); //! Sets the path to the file //! \param pfad The path to the file DLLEXPORT void setPfad(Text* pfad); //! Sets the path to the file //! \param pfad The path to the file DLLEXPORT void setPfad(const char* pfad); //! Loads the values from the file //! \return 1 if loading was successful. 0 if an error occurred. DLLEXPORT bool laden(); //! Adds a value to the file //! \param name The name of the value //! \param wert The value to store //! \return 1 if the value was successfully added DLLEXPORT bool addWert(Text* name, Text* wert); //! Adds a value to the file //! \param name The name of the value //! \param wert The value to store //! \return 1 if the value was successfully added DLLEXPORT bool addWert(const char* name, const char* wert); //! Changes a specific value //! \param name The name of the value //! \param wert The value to store //! \return 1 if the value existed and was successfully changed DLLEXPORT bool setWert(Text* name, Text* wert); //! Changes a specific value //! \param name The name of the value //! \param wert The value to store //! \return 1 if the value existed and was successfully changed DLLEXPORT bool setWert(const char* name, const char* wert); //! Changes a specific value //! \param num The index of the value to change //! \param wert The value to store //! \return 1 if the value existed and was successfully changed DLLEXPORT bool setWert(int num, Text* wert); //! Changes a specific value //! \param num The index of the value to change //! \param wert The value to store //! \return 1 if the value existed and was successfully changed DLLEXPORT bool setWert(int num, const char* wert); //! Deletes a specific value //! \param name The name of the value to delete //! \return 1 if the value existed and was successfully deleted DLLEXPORT bool removeWert(Text* name); //! Deletes a specific value //! \param name The name of the value to delete //! \return 1 if the value existed and was successfully deleted DLLEXPORT bool removeWert(const char* name); //! Deletes a specific value //! \param num The index of the value to delete //! \return 1 if the value existed and was successfully deleted DLLEXPORT bool removeWert(int num); //! Deletes all values from the file DLLEXPORT void removeAlle(); //! Saves all values to the file //! \return 1 if saving was successful DLLEXPORT bool speichern(); //! Returns the number of stored values DLLEXPORT int getWertAnzahl() const; //! Checks whether a specific value exists //! \param name The name to search for //! \return 1 if the value was found DLLEXPORT bool wertExistiert(Text* name); //! Checks whether a specific value exists //! \param name The name to search for //! \return 1 if the value was found DLLEXPORT bool wertExistiert(const char* name); //! Returns the index of a specific value //! \param name The name of the value to search for //! \return -1 if the value was not found. The index of the value. DLLEXPORT int getWertNummer(Text* name); //! Returns the index of a specific value //! \param name The name of the value to search for //! \return -1 if the value was not found. The index of the value. DLLEXPORT int getWertNummer(const char* name); //! Returns a specific value //! \param name The name of the value to return //! \return 0 if the value was not found. DLLEXPORT Text* getWert(Text* name); //! Returns a specific value //! \param name The name of the value to return //! \return 0 if the value was not found. DLLEXPORT Text* getWert(const char* name); //! Returns a specific value //! \param num The index of the value to return //! \return 0 if the value was not found. DLLEXPORT Text* getWert(int num); //! Returns a specific value //! \param name The name of the value to return //! \return 0 if the value was not found. The value without //! increased reference counter DLLEXPORT Text* zWert(Text* name); //! Returns a specific value //! \param name The name of the value to return //! \return 0 if the value was not found. The value without //! increased reference counter DLLEXPORT Text* zWert(const char* name); //! Returns a specific value //! \param num The index of the value to return //! \return 0 if the value was not found. The value without //! increased reference counter DLLEXPORT Text* zWert(int num); //! Returns the name of a specific value //! \param num The index of the value whose name should be returned //! \return 0 if the value was not found. DLLEXPORT Text* getName(int num); //! Returns the name of a specific value //! \param num The index of the value whose name should be returned //! \return 0 if the value was not found. The name without //! increased reference counter DLLEXPORT Text* zName(int num); //! Returns the path to the file DLLEXPORT Text* getPfad() const; //! Returns the path to the file without increased reference counter DLLEXPORT Text* zPfad() const; }; } // namespace Framework #endif