HCE project C++ developers source code library  1.1.1
HCE project developer library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SphinxConfigCreator.hpp
Go to the documentation of this file.
1 /*
2  * @file SphinxConfigCreator.hpp
3  *
4  * Creates Sphinx config file from Poco properties
5  *
6  * @author Eduard <eduard.hce.cluster@gmail.com>
7  * @link http://hierarchical-cluster-engine.com/
8  * @copyright Copyright &copy; 2013 IOIX Ukraine
9  * @license http://hierarchical-cluster-engine.com/license/
10  * @package HCE project node API
11  * @since 0.1
12  */
13 
14 #ifndef SPHINXCONFIGCREATOR_HPP
15 #define SPHINXCONFIGCREATOR_HPP
16 
17 #include <Poco/AutoPtr.h>
18 #include <Poco/Util/PropertyFileConfiguration.h>
19 #include <Poco/FileStream.h>
20 #include <iostream>
21 #include <Poco/StringTokenizer.h>
22 #include <sstream>
23 #include <fstream>
24 #include <map>
25 #include <string>
26 
27 namespace HCE {
28 namespace sphinx {
29  class SphinxConfigCreator : public Poco::Util::PropertyFileConfiguration {
30  private:
31  typedef std::string _section;
32  typedef std::string _key;
33  typedef std::string _value;
34  private:
35  std::map<_section,std::vector<std::pair<_key,_value>>> data;
36  public:
37  friend std::ostream& operator << (std::ostream& stream,SphinxConfigCreator& objSphinxConfig) {
38  stream << objSphinxConfig.getSphinxFileConfiguration();
39  return stream;
40  }
41  public:
42  SphinxConfigCreator (void);
43  SphinxConfigCreator (const std::string& path);
44  SphinxConfigCreator (const Poco::Util::PropertyFileConfiguration& object);
45  ~SphinxConfigCreator (void) throw ();
46  public:
47  //inserts data from propertyFileConfiguration to the map `data`
48  void parse (void);
49  public:
50  void setPropertyFileConfiguration (const std::string& path);
51  std::string getSphinxFileConfiguration (void);
52  public:
53  void cloneSphinxConfigSection (const std::string& oldName, const std::string& newName);
54  void renameSphinxConfigSection (const std::string& oldName, const std::string& newName);
55  void deleteSphinxConfigSection(const std::string& sectionName);
56  };
57 }
58 }
59 
60 
61 #endif /* SPHINXCONFIGCREATOR_HPP */