1.00.8
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
13
#include <
stdair/basic/BasFileMgr.hpp
>
14
#include <
stdair/bom/BomINIImport.hpp
>
15
#include <
stdair/bom/ConfigHolderStruct.hpp
>
16
#include <
stdair/service/Logger.hpp
>
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
// ////////////////////////////////////////////////////////////////////
29
void
BomINIImport::importINIConfig
(
ConfigHolderStruct
& iConfigHolder,
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 =
37
stdair::BasFileMgr::doesExistAndIsReadable
(lFilename);
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
}
BomINIImport.hpp
stdair::Filename_T
std::string Filename_T
Definition:
stdair_basic_types.hpp:144
ConfigHolderStruct.hpp
stdair::ConfigHolderStruct::add
void add(const bpt::ptree &)
Definition:
ConfigHolderStruct.cpp:144
Logger.hpp
stdair::ConfigINIFile
Definition:
stdair_file.hpp:112
stdair::RootFilePath::name
const char * name() const
Definition:
stdair_file.hpp:42
stdair::BasFileMgr::doesExistAndIsReadable
static bool doesExistAndIsReadable(const std::string &iFilepath)
Definition:
BasFileMgr.cpp:23
stdair::BomINIImport::importINIConfig
static void importINIConfig(ConfigHolderStruct &, const ConfigINIFile &)
Definition:
BomINIImport.cpp:29
stdair
Handle on the StdAir library context.
Definition:
BasChronometer.cpp:9
STDAIR_LOG_DEBUG
#define STDAIR_LOG_DEBUG(iToBeLogged)
Definition:
Logger.hpp:32
stdair::ConfigHolderStruct
Definition:
ConfigHolderStruct.hpp:40
BasFileMgr.hpp
bpt
Definition:
BomINIImport.cpp:21
bpt::ptree
char ptree
Definition:
BomINIImport.cpp:22
Generated for StdAir by
1.8.17