49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
#include "Config.h"
|
|
#include "ConfigImpl.h"
|
|
#include "ILog.h"
|
|
#include <stddef.h>
|
|
const StatusCode ConfigInit(void)
|
|
{
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
const StatusCode ConfigUnInit(void)
|
|
{
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
VConfig *OpenConfigFile(const char *fileName)
|
|
{
|
|
return (VConfig *)NewConfig(fileName);
|
|
}
|
|
const StatusCode ConfigSaveFile(VConfig *cfg)
|
|
{
|
|
if (NULL == cfg)
|
|
{
|
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
|
}
|
|
return cfg->save(cfg);
|
|
}
|
|
void CloseConfigFile(VConfig *cfg)
|
|
{
|
|
if (NULL == cfg)
|
|
{
|
|
LogError("NULL config poniter.\n");
|
|
return;
|
|
}
|
|
((Config *)cfg)->close(cfg);
|
|
}
|
|
const StatusCode ConfigGetInt(VConfig *cfg, const char *name, int *value)
|
|
{
|
|
if (NULL == cfg)
|
|
{
|
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
|
}
|
|
return cfg->get_int(cfg, name, value);
|
|
}
|
|
const StatusCode ConfigSetInt(VConfig *cfg, const char *name, const int value)
|
|
{
|
|
if (NULL == cfg)
|
|
{
|
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
|
}
|
|
return cfg->set_int(cfg, name, value);
|
|
} |