Breeder config ++
This commit is contained in:
parent
a4620db9f9
commit
844cfc15ff
3 changed files with 28 additions and 4 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include "./libraries/libBreeder.h"
|
||||
#include "./commons/classPacket.h"
|
||||
|
@ -57,7 +58,10 @@ int main ( int argc, char **argv ) {
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
configInitialization();
|
||||
breederConfig::init();
|
||||
boost::property_tree::ptree config = breederConfig::load();
|
||||
|
||||
cout << config.get<std::string>("global.protocols") << endl;
|
||||
|
||||
// TODO
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "libBreeder.h"
|
||||
|
||||
void configInitialization()
|
||||
void breederConfig::init()
|
||||
{
|
||||
|
||||
boost::property_tree::ptree root;
|
||||
|
@ -54,6 +54,17 @@ void configInitialization()
|
|||
boost::property_tree::ptree::value_type( "http", http )
|
||||
);
|
||||
|
||||
write_ini( "breeder.conf", root );
|
||||
boost::property_tree::ini_parser::write_ini( FILECONFIG, root );
|
||||
|
||||
}
|
||||
|
||||
boost::property_tree::ptree breederConfig::load()
|
||||
{
|
||||
|
||||
boost::property_tree::ptree config;
|
||||
boost::property_tree::ini_parser::read_ini( FILECONFIG, config );
|
||||
|
||||
return config;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,15 @@
|
|||
#ifndef LIBBREEDER_H
|
||||
#define LIBBREEDER_H
|
||||
|
||||
void configInitialization();
|
||||
#define FILECONFIG "breeder.conf"
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
|
||||
namespace breederConfig {
|
||||
|
||||
void init();
|
||||
boost::property_tree::ptree load();
|
||||
|
||||
}
|
||||
|
||||
#endif //LIBBREEDER_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue