InitDatei.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #ifndef InitDatei_H
  2. #define InitDatei_H
  3. #include "Array.h"
  4. namespace Framework
  5. {
  6. class Text; //! Text.h
  7. //! Manages initialization files where variables are stored in the format
  8. //! name=value
  9. class InitDatei : public virtual ReferenceCounter
  10. {
  11. private:
  12. Text* pfad;
  13. RCArray<Text>* name;
  14. RCArray<Text>* wert;
  15. public:
  16. //! Constructor
  17. DLLEXPORT InitDatei();
  18. //! Constructor
  19. //! \param pfad The path to the file
  20. DLLEXPORT InitDatei(Text* pfad);
  21. //! Constructor
  22. //! \param pfad The path to the file
  23. DLLEXPORT InitDatei(const char* pfad);
  24. //! Destructor
  25. DLLEXPORT ~InitDatei();
  26. //! Sets the path to the file
  27. //! \param pfad The path to the file
  28. DLLEXPORT void setPfad(Text* pfad);
  29. //! Sets the path to the file
  30. //! \param pfad The path to the file
  31. DLLEXPORT void setPfad(const char* pfad);
  32. //! Loads the values from the file
  33. //! \return 1 if loading was successful. 0 if an error occurred.
  34. DLLEXPORT bool laden();
  35. //! Adds a value to the file
  36. //! \param name The name of the value
  37. //! \param wert The value to store
  38. //! \return 1 if the value was successfully added
  39. DLLEXPORT bool addWert(Text* name, Text* wert);
  40. //! Adds a value to the file
  41. //! \param name The name of the value
  42. //! \param wert The value to store
  43. //! \return 1 if the value was successfully added
  44. DLLEXPORT bool addWert(const char* name, const char* wert);
  45. //! Changes a specific value
  46. //! \param name The name of the value
  47. //! \param wert The value to store
  48. //! \return 1 if the value existed and was successfully changed
  49. DLLEXPORT bool setWert(Text* name, Text* wert);
  50. //! Changes a specific value
  51. //! \param name The name of the value
  52. //! \param wert The value to store
  53. //! \return 1 if the value existed and was successfully changed
  54. DLLEXPORT bool setWert(const char* name, const char* wert);
  55. //! Changes a specific value
  56. //! \param num The index of the value to change
  57. //! \param wert The value to store
  58. //! \return 1 if the value existed and was successfully changed
  59. DLLEXPORT bool setWert(int num, Text* wert);
  60. //! Changes a specific value
  61. //! \param num The index of the value to change
  62. //! \param wert The value to store
  63. //! \return 1 if the value existed and was successfully changed
  64. DLLEXPORT bool setWert(int num, const char* wert);
  65. //! Deletes a specific value
  66. //! \param name The name of the value to delete
  67. //! \return 1 if the value existed and was successfully deleted
  68. DLLEXPORT bool removeWert(Text* name);
  69. //! Deletes a specific value
  70. //! \param name The name of the value to delete
  71. //! \return 1 if the value existed and was successfully deleted
  72. DLLEXPORT bool removeWert(const char* name);
  73. //! Deletes a specific value
  74. //! \param num The index of the value to delete
  75. //! \return 1 if the value existed and was successfully deleted
  76. DLLEXPORT bool removeWert(int num);
  77. //! Deletes all values from the file
  78. DLLEXPORT void removeAlle();
  79. //! Saves all values to the file
  80. //! \return 1 if saving was successful
  81. DLLEXPORT bool speichern();
  82. //! Returns the number of stored values
  83. DLLEXPORT int getWertAnzahl() const;
  84. //! Checks whether a specific value exists
  85. //! \param name The name to search for
  86. //! \return 1 if the value was found
  87. DLLEXPORT bool wertExistiert(Text* name);
  88. //! Checks whether a specific value exists
  89. //! \param name The name to search for
  90. //! \return 1 if the value was found
  91. DLLEXPORT bool wertExistiert(const char* name);
  92. //! Returns the index of a specific value
  93. //! \param name The name of the value to search for
  94. //! \return -1 if the value was not found. The index of the value.
  95. DLLEXPORT int getWertNummer(Text* name);
  96. //! Returns the index of a specific value
  97. //! \param name The name of the value to search for
  98. //! \return -1 if the value was not found. The index of the value.
  99. DLLEXPORT int getWertNummer(const char* name);
  100. //! Returns a specific value
  101. //! \param name The name of the value to return
  102. //! \return 0 if the value was not found.
  103. DLLEXPORT Text* getWert(Text* name);
  104. //! Returns a specific value
  105. //! \param name The name of the value to return
  106. //! \return 0 if the value was not found.
  107. DLLEXPORT Text* getWert(const char* name);
  108. //! Returns a specific value
  109. //! \param num The index of the value to return
  110. //! \return 0 if the value was not found.
  111. DLLEXPORT Text* getWert(int num);
  112. //! Returns a specific value
  113. //! \param name The name of the value to return
  114. //! \return 0 if the value was not found. The value without
  115. //! increased reference counter
  116. DLLEXPORT Text* zWert(Text* name);
  117. //! Returns a specific value
  118. //! \param name The name of the value to return
  119. //! \return 0 if the value was not found. The value without
  120. //! increased reference counter
  121. DLLEXPORT Text* zWert(const char* name);
  122. //! Returns a specific value
  123. //! \param num The index of the value to return
  124. //! \return 0 if the value was not found. The value without
  125. //! increased reference counter
  126. DLLEXPORT Text* zWert(int num);
  127. //! Returns the name of a specific value
  128. //! \param num The index of the value whose name should be returned
  129. //! \return 0 if the value was not found.
  130. DLLEXPORT Text* getName(int num);
  131. //! Returns the name of a specific value
  132. //! \param num The index of the value whose name should be returned
  133. //! \return 0 if the value was not found. The name without
  134. //! increased reference counter
  135. DLLEXPORT Text* zName(int num);
  136. //! Returns the path to the file
  137. DLLEXPORT Text* getPfad() const;
  138. //! Returns the path to the file without increased reference counter
  139. DLLEXPORT Text* zPfad() const;
  140. };
  141. } // namespace Framework
  142. #endif