$treeview $search $mathjax
00001 // ////////////////////////////////////////////////////////////////////// 00002 // Import section 00003 // ////////////////////////////////////////////////////////////////////// 00004 // STL 00005 #include <cassert> 00006 #include <sstream> 00007 #if BOOST_VERSION >= 104100 00008 // Boost Property Tree 00009 #include <boost/property_tree/ptree.hpp> 00010 #include <boost/property_tree/ini_parser.hpp> 00011 #endif // BOOST_VERSION >= 104100 00012 // StdAir 00013 #include <stdair/basic/BasFileMgr.hpp> 00014 #include <stdair/bom/BomINIImport.hpp> 00015 #include <stdair/bom/ConfigHolderStruct.hpp> 00016 #include <stdair/service/Logger.hpp> 00017 00018 #if BOOST_VERSION >= 104100 00019 namespace bpt = boost::property_tree; 00020 #else // BOOST_VERSION >= 104100 00021 namespace bpt { 00022 typedef char ptree; 00023 } 00024 #endif // BOOST_VERSION >= 104100 00025 00026 namespace stdair { 00027 00028 // //////////////////////////////////////////////////////////////////// 00029 void BomINIImport::importINIConfig (ConfigHolderStruct& iConfigHolder, 00030 const ConfigINIFile& iConfigINIFile) { 00031 00032 // Get the config file name. 00033 const stdair::Filename_T lFilename = iConfigINIFile.name(); 00034 00035 // Check that the file path given as input corresponds to an actual file 00036 const bool doesExistAndIsReadable = 00037 stdair::BasFileMgr::doesExistAndIsReadable (lFilename); 00038 if (doesExistAndIsReadable == false) { 00039 STDAIR_LOG_DEBUG ("The config input file '" << lFilename 00040 << "' can not be retrieved on the file-system."); 00041 return; 00042 } 00043 STDAIR_LOG_DEBUG ("Load the config input file '" << lFilename 00044 << "' content into the configuration holder."); 00045 00046 #if BOOST_VERSION >= 104100 00047 00048 // Transform the INI file into a BOOST property tree. 00049 bpt::ptree pt; 00050 bpt::ini_parser::read_ini(lFilename, pt); 00051 // Add the property tree to the configuration structure. 00052 iConfigHolder.add(pt); 00053 00054 #endif // BOOST_VERSION >= 104100 00055 } 00056 00057 }