| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- #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<Text>* name;
- RCArray<Text>* 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
|