Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsAbstractProperties.cpp
Go to the documentation of this file.
1 
14 #include "WsAbstractProperties.h"
15 
16 #include <Include/WsGlobalConfig.h>
17 #include <Logger/WsLogger.h>
18 
19 #include <fstream>
20 
21 using namespace Json;
22 
24  m_parsed(false)
25 {
26 }
27 
28 int WsAbstractProperties::parse(const std::string& path)
29 {
30  Reader reader;
31  std::ifstream conf(path.c_str(), std::ifstream::binary);
32  if (! conf.good()) {
33  LOG(DEBUG) << "WsAbstractProperties::parse() : Conf file not found : " << path;
34  m_parsed = true;
35  return ErrorCode::Success;
36  }
37  bool bOk = reader.parse(conf, m_root, false);
38  conf.close();
39  if ( !bOk ) {
40  /* Parse failed */
41  return ErrorCode::Failure;
42  } else {
43  m_parsed = true;
44  return ErrorCode::Success;
45  }
46 }
47 
#define DEBUG
Definition: WsLogger.h:27
const int Failure
int parse(const std::string &path)
parse the Json config file
#define LOG
Definition: WsLogger.h:22
WsAbstractProperties()
Default constructor.
const int Success
Abstract class for properties.