StdAir Logo  1.00.12
C++ Standard Airline IT Object Library
BomINIImport.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <string>
7 #include <sstream>
8 #if BOOST_VERSION_MACRO >= 104100
9 // Boost Property Tree
10 #include <boost/property_tree/ptree.hpp>
11 #include <boost/property_tree/ini_parser.hpp>
12 #endif // BOOST_VERSION_MACRO >= 104100
13 // StdAir
18 
19 #if BOOST_VERSION_MACRO >= 104100
20 namespace bpt = boost::property_tree;
21 #else // BOOST_VERSION_MACRO >= 104100
22 namespace boost {
23  namespace property_tree {
24  typedef std::string ptree;
25  }
26 }
27 #endif // BOOST_VERSION_MACRO >= 104100
28 
29 namespace stdair {
30 
31  // ////////////////////////////////////////////////////////////////////
33  const ConfigINIFile& iConfigINIFile) {
34 
35  // Get the config file name.
36  const stdair::Filename_T lFilename = iConfigINIFile.name();
37 
38  // Check that the file path given as input corresponds to an actual file
39  const bool doesExistAndIsReadable =
41  if (doesExistAndIsReadable == false) {
42  STDAIR_LOG_DEBUG ("The config input file '" << lFilename
43  << "' can not be retrieved on the file-system.");
44  return;
45  }
46  STDAIR_LOG_DEBUG ("Load the config input file '" << lFilename
47  << "' content into the configuration holder.");
48 
49 #if BOOST_VERSION_MACRO >= 104100
50 
51  // Transform the INI file into a BOOST property tree.
52  bpt::ptree pt;
53  bpt::ini_parser::read_ini(lFilename, pt);
54  // Add the property tree to the configuration structure.
55  iConfigHolder.add(pt);
56 
57 #endif // BOOST_VERSION_MACRO >= 104100
58  }
59 
60 }
#define STDAIR_LOG_DEBUG(iToBeLogged)
Definition: Logger.hpp:32
Handle on the StdAir library context.
std::string Filename_T
Forward declarations.
char ptree
static bool doesExistAndIsReadable(const std::string &iFilepath)
Definition: BasFileMgr.cpp:23
static void importINIConfig(ConfigHolderStruct &, const ConfigINIFile &)
void add(const bpt::ptree &)
const char * name() const
Definition: stdair_file.hpp:42