1 #ifndef __STDAIR_BOM_CONFIGHOLDERSTRUCT_HPP
2 #define __STDAIR_BOM_CONFIGHOLDERSTRUCT_HPP
11 #include <boost/static_assert.hpp>
12 #include <boost/type_traits/is_same.hpp>
13 #if BOOST_VERSION >= 104100
15 #include <boost/property_tree/ptree.hpp>
16 #endif // BOOST_VERSION >= 104100
24 #if BOOST_VERSION >= 104100
25 namespace bpt = boost::property_tree;
26 #else // BOOST_VERSION >= 104100
30 #endif // BOOST_VERSION >= 104100
61 bool addValue (
const std::string& iValue,
62 const std::string& iPath);
72 template <
typename ValueType>
73 bool exportValue (ValueType& ioValue,
const std::string& iPath)
const;
96 void toStream (std::ostream& ioOut)
const;
143 template <
typename ValueType>
145 const std::string& iPath)
const {
147 bool hasValueBeenSuccessfullyRetrieved =
true;
149 #if BOOST_VERSION >= 104100
153 const std::string lPrefix (
"config.");
154 const std::string lFinalPath = lPrefix + iPath;
155 ioValue = _pt.get<ValueType> (lFinalPath);
157 }
catch (bpt::ptree_error& bptException) {
158 hasValueBeenSuccessfullyRetrieved =
false;
160 #endif // BOOST_VERSION >= 104100
162 return hasValueBeenSuccessfullyRetrieved;
174 inline bool ConfigHolderStruct::exportValue<Date_T>
176 const std::string& iPath)
const {
178 bool hasValueBeenSuccessfullyRetrieved =
true;
180 #if BOOST_VERSION >= 104100
186 const std::string lPrefix (
"config.");
187 const std::string lFinalPath = lPrefix + iPath;
188 const std::string& lDateStr =
189 _pt.get<std::string> (lFinalPath);
193 boost::gregorian::from_simple_string (lDateStr);
195 }
catch (bpt::ptree_error& bptException) {
196 hasValueBeenSuccessfullyRetrieved =
false;
198 #endif // BOOST_VERSION >= 104100
200 return hasValueBeenSuccessfullyRetrieved;
207 #endif // __STDAIR_BOM_CONFIGHOLDERSTRUCT_HPP
bool exportValue(ValueType &ioValue, const std::string &iPath) const
Handle on the StdAir library context.
bool addValue(const std::string &iValue, const std::string &iPath)
void fromStream(std::istream &ioIn)
Base class for the light structures.
const std::string describe() const
void updateAirlineFeatures(BomRoot &)
boost::gregorian::date Date_T
Class representing the actual attributes for the Bom root.
void toStream(std::ostream &ioOut) const
void add(const bpt::ptree &)
const std::string jsonExport() const