1.00.17
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
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
14
#include <
stdair/basic/BasFileMgr.hpp
>
15
#include <
stdair/bom/BomINIImport.hpp
>
16
#include <
stdair/bom/ConfigHolderStruct.hpp
>
17
#include <
stdair/service/Logger.hpp
>
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
// ////////////////////////////////////////////////////////////////////
32
void
BomINIImport::importINIConfig
(
ConfigHolderStruct
& iConfigHolder,
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 =
40
stdair::BasFileMgr::doesExistAndIsReadable
(lFilename);
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
}
Logger.hpp
STDAIR_LOG_DEBUG
#define STDAIR_LOG_DEBUG(iToBeLogged)
Definition
Logger.hpp:32
BasFileMgr.hpp
BomINIImport.hpp
ConfigHolderStruct.hpp
stdair
Handle on the StdAir library context.
Definition
BasChronometer.cpp:9
stdair::Filename_T
std::string Filename_T
Definition
stdair_basic_types.hpp:144
boost
Forward declarations.
Definition
AirlineClassList.hpp:16
boost::property_tree
Definition
BomINIImport.cpp:23
boost::property_tree::ptree
std::string ptree
Definition
BomINIImport.cpp:24
bpt
Definition
BomJSONExport.hpp:20
bpt::ptree
char ptree
Definition
BomJSONExport.hpp:21
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:32
stdair::ConfigHolderStruct
Definition
ConfigHolderStruct.hpp:40
stdair::ConfigHolderStruct::add
void add(const bpt::ptree &)
Definition
ConfigHolderStruct.cpp:145
stdair::RootFilePath::name
const char * name() const
Definition
stdair_file.hpp:42
stdair::ConfigINIFile
Definition
stdair_file.hpp:112
Generated for StdAir by
1.13.2