#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 load();
        //! 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 addValue(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 addValue(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 setValue(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 setValue(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 setValue(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 setValue(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 removeValue(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 removeValue(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 removeValue(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 save();
        //! Returns the number of stored values
        DLLEXPORT int getValueCount() const;
        //! Checks whether a specific value exists
        //! \param name The name to search for
        //! \return 1 if the value was found
        DLLEXPORT bool valueExists(Text* name);
        //! Checks whether a specific value exists
        //! \param name The name to search for
        //! \return 1 if the value was found
        DLLEXPORT bool valueExists(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 getValueNumber(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 getValueNumber(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* getValue(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* getValue(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* getValue(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* zValue(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* zValue(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* zValue(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