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.

78 lines
2.4 KiB

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