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
99 lines
2.1 KiB
#ifndef __BASICSETTINGS_H_INCL__
|
|
#define __BASICSETTINGS_H_INCL__
|
|
|
|
#include "basicFunctionality.h"
|
|
#include "basicLogCollection.h"
|
|
|
|
#include <libconfig.h>
|
|
|
|
/**
|
|
* TODO: Add class description
|
|
*
|
|
* @author Gagua
|
|
*/
|
|
class basicSettings
|
|
{
|
|
private:
|
|
|
|
config_t m_sCfg;
|
|
config_setting_t * m_pRootNode;
|
|
basicLogCollection * m_pLog;
|
|
|
|
char m_pFileName[MAX_PATH];
|
|
|
|
bool m_bLoadded;
|
|
bool m_bModified;
|
|
|
|
bool load(void);
|
|
bool clear(void);
|
|
|
|
public:
|
|
|
|
// Constructor
|
|
basicSettings(CSTR settingsFileName);
|
|
basicSettings(const char * settingsFileName);
|
|
|
|
// Destructor
|
|
~basicSettings();
|
|
|
|
bool reload(void);
|
|
bool save(void);
|
|
bool saveTo(CSTR fileName);
|
|
|
|
bool isCompromised(void)
|
|
{
|
|
return m_bModified;
|
|
}
|
|
|
|
void compromise(void)
|
|
{
|
|
m_bModified = true;
|
|
}
|
|
|
|
config_setting_t * getRoot(void)
|
|
{
|
|
if (! m_bLoadded)
|
|
{
|
|
return NULL;
|
|
}
|
|
return m_pRootNode;
|
|
}
|
|
|
|
bool getValue(CSTR group, CSTR paramName, CSTR paramValue);
|
|
config_setting_t * getSubNode(config_setting_t * Parent, CSTR NodeName);
|
|
// bool getValue( CSTR ¶mName, bool ¶mValue );
|
|
// bool getValue( CSTR ¶mName, int ¶mValue );
|
|
// bool getValue( CSTR ¶mName, double ¶mValue );
|
|
|
|
bool setValue(config_setting_t * Node, CSTR group, CSTR paramName, CSTR paramValue);
|
|
// bool setValue( CSTR ¶mName, bool ¶mValue );
|
|
// bool setValue( CSTR ¶mName, int ¶mValue );
|
|
// bool setValue( CSTR ¶mName, double ¶mValue );
|
|
// Copy constructor
|
|
// TODO: Uncomment the copy constructor when you need it.
|
|
// basicSettings(const basicSettings& src);
|
|
|
|
// Assignment operator
|
|
// TODO: Uncomment the assignment operator when you need it.
|
|
// basicSettings& operator=(const basicSettings& src);
|
|
};
|
|
|
|
// TODO: Uncomment the copy constructor when you need it.
|
|
// inline basicSettings::basicSettings(const basicSettings& src)
|
|
//{
|
|
// // TODO: copy
|
|
//}
|
|
|
|
// TODO: Uncomment the assignment operator when you need it.
|
|
// inline basicSettings& basicSettings::operator=(const basicSettings& rhs)
|
|
//{
|
|
// if (this == &rhs) {
|
|
// return *this;
|
|
// }
|
|
//
|
|
// // TODO: assignment
|
|
//
|
|
// return *this;
|
|
//}
|
|
|
|
#endif // __BASICSETTINGS_H_INCL__
|