You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASICSETTINGS_H_INCL__
  2. #define __BASICSETTINGS_H_INCL__
  3. #include "basicFunctionality.h"
  4. #include "basicLogCollection.h"
  5. #include <libconfig.h>
  6. /**
  7. * TODO: Add class description
  8. *
  9. * @author Gagua
  10. */
  11. class basicSettings
  12. {
  13. private:
  14. config_t m_sCfg;
  15. config_setting_t * m_pRootNode;
  16. basicLogCollection * m_pLog;
  17. char m_pFileName[MAX_PATH];
  18. bool m_bLoadded;
  19. bool m_bModified;
  20. bool load(void);
  21. bool clear(void);
  22. public:
  23. // Constructor
  24. basicSettings(CSTR settingsFileName);
  25. basicSettings(const char * settingsFileName);
  26. // Destructor
  27. ~basicSettings();
  28. bool reload(void);
  29. bool save(void);
  30. bool saveTo(CSTR fileName);
  31. bool isCompromised(void)
  32. {
  33. return m_bModified;
  34. }
  35. void compromise(void)
  36. {
  37. m_bModified = true;
  38. }
  39. config_setting_t * getRoot(void)
  40. {
  41. if (! m_bLoadded)
  42. {
  43. return NULL;
  44. }
  45. return m_pRootNode;
  46. }
  47. bool getValue(CSTR group, CSTR paramName, CSTR paramValue);
  48. config_setting_t * getSubNode(config_setting_t * Parent, CSTR NodeName);
  49. // bool getValue( CSTR &paramName, bool &paramValue );
  50. // bool getValue( CSTR &paramName, int &paramValue );
  51. // bool getValue( CSTR &paramName, double &paramValue );
  52. bool setValue(config_setting_t * Node, CSTR group, CSTR paramName, CSTR paramValue);
  53. // bool setValue( CSTR &paramName, bool &paramValue );
  54. // bool setValue( CSTR &paramName, int &paramValue );
  55. // bool setValue( CSTR &paramName, double &paramValue );
  56. // Copy constructor
  57. // TODO: Uncomment the copy constructor when you need it.
  58. // basicSettings(const basicSettings& src);
  59. // Assignment operator
  60. // TODO: Uncomment the assignment operator when you need it.
  61. // basicSettings& operator=(const basicSettings& src);
  62. };
  63. // TODO: Uncomment the copy constructor when you need it.
  64. // inline basicSettings::basicSettings(const basicSettings& src)
  65. //{
  66. // // TODO: copy
  67. //}
  68. // TODO: Uncomment the assignment operator when you need it.
  69. // inline basicSettings& basicSettings::operator=(const basicSettings& rhs)
  70. //{
  71. // if (this == &rhs) {
  72. // return *this;
  73. // }
  74. //
  75. // // TODO: assignment
  76. //
  77. // return *this;
  78. //}
  79. #endif // __BASICSETTINGS_H_INCL__