StdAir Logo  1.00.3
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 <sstream>
7 #if BOOST_VERSION >= 104100
8 // Boost Property Tree
9 #include <boost/property_tree/ptree.hpp>
10 #include <boost/property_tree/ini_parser.hpp>
11 #endif // BOOST_VERSION >= 104100
12 // StdAir
17 
18 #if BOOST_VERSION >= 104100
19 namespace bpt = boost::property_tree;
20 #else // BOOST_VERSION >= 104100
21 namespace bpt {
22  typedef char ptree;
23 }
24 #endif // BOOST_VERSION >= 104100
25 
26 namespace stdair {
27 
28  // ////////////////////////////////////////////////////////////////////
30  const ConfigINIFile& iConfigINIFile) {
31 
32  // Get the config file name.
33  const stdair::Filename_T lFilename = iConfigINIFile.name();
34 
35  // Check that the file path given as input corresponds to an actual file
36  const bool doesExistAndIsReadable =
38  if (doesExistAndIsReadable == false) {
39  STDAIR_LOG_DEBUG ("The config input file '" << lFilename
40  << "' can not be retrieved on the file-system.");
41  return;
42  }
43  STDAIR_LOG_DEBUG ("Load the config input file '" << lFilename
44  << "' content into the configuration holder.");
45 
46 #if BOOST_VERSION >= 104100
47 
48  // Transform the INI file into a BOOST property tree.
49  bpt::ptree pt;
50  bpt::ini_parser::read_ini(lFilename, pt);
51  // Add the property tree to the configuration structure.
52  iConfigHolder.add(pt);
53 
54 #endif // BOOST_VERSION >= 104100
55  }
56 
57 }
Handle on the StdAir library context.
char ptree
static void importINIConfig(ConfigHolderStruct &, const ConfigINIFile &)
std::string Filename_T
void add(const bpt::ptree &)
static bool doesExistAndIsReadable(const std::string &iFilepath)
Definition: BasFileMgr.cpp:23
const char * name() const
Definition: stdair_file.hpp:42
#define STDAIR_LOG_DEBUG(iToBeLogged)
Definition: Logger.hpp:32