1.00.0
C++ Standard Airline IT Object Library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
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
}
Generated on Sat Dec 22 2012 16:51:53 for StdAir by
1.8.1.1