Use Slim Reader/Writer lock to replace CRITICAL_SECTION (better performance).
[gdipp.git] / gdipp_config / config_file.cpp
blobd2b282b3fd88c7148a2b835524a58275576f889b
1 #include "stdafx.h"
2 #include "config_file.h"
3 #include "gdipp_lib/helper.h"
5 namespace gdipp
8 config_file::config_file(const wchar_t *filename)
9 : _config_xml(NULL)
11 // get config file path
12 wchar_t config_path[MAX_PATH];
13 if (!get_dir_file_path(NULL, filename, config_path))
14 return;
16 pugi::xml_document *config_xml_doc = new pugi::xml_document();
17 _config_xml = config_xml_doc;
19 config_xml_doc->load_file(config_path);
22 config_file::~config_file()
24 if (_config_xml != NULL)
25 delete _config_xml;
28 const void *config_file::get_config_xml() const
30 return _config_xml;
33 bool config_file::empty() const
35 if (_config_xml == NULL)
36 return true;
38 pugi::xml_document *config_xml_doc = reinterpret_cast<pugi::xml_document *>(_config_xml);
39 return config_xml_doc->empty();