strusBase  0.17
configParser.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
9 #ifndef _STRUS_CONFIG_PARSER_HPP_INCLUDED
10 #define _STRUS_CONFIG_PARSER_HPP_INCLUDED
11 #include <string>
12 #include <vector>
13 #include <utility>
14 
15 namespace strus {
16 
18 class ErrorBufferInterface;
19 
20 bool extractStringFromConfigString( std::string& val, std::string& config, const char* key, ErrorBufferInterface* errorhnd);
21 bool extractStringArrayFromConfigString( std::vector<std::string>& val, std::string& config, const char* key, char separator, ErrorBufferInterface* errorhnd);
22 bool extractBooleanFromConfigString( bool& val, std::string& config, const char* key, ErrorBufferInterface* errorhnd);
23 bool extractUIntFromConfigString( unsigned int& val, std::string& config, const char* key, ErrorBufferInterface* errorhnd);
24 bool extractFloatFromConfigString( double& val, std::string& config, const char* key, ErrorBufferInterface* errorhnd);
25 void removeKeysFromConfigString( std::string& config, const char** keys, ErrorBufferInterface* errorhnd);
26 
27 bool addConfigStringItem( std::string& config, const std::string& key, const std::string& value, ErrorBufferInterface* errorhnd);
28 std::vector<std::pair<std::string,std::string> > getAssignmentListItems( const std::string& config, ErrorBufferInterface* errorhnd);
29 std::vector<std::pair<std::string,std::string> > getConfigStringItems( const std::string& config, ErrorBufferInterface* errorhnd);
30 std::vector<std::pair<std::string,std::string> > getSubConfigStringItems( const std::string& configelem, ErrorBufferInterface* errorhnd);
31 
32 }//namespace
33 #endif
34 
bool extractBooleanFromConfigString(bool &val, std::string &config, const char *key, ErrorBufferInterface *errorhnd)
std::vector< std::pair< std::string, std::string > > getSubConfigStringItems(const std::string &configelem, ErrorBufferInterface *errorhnd)
bool extractUIntFromConfigString(unsigned int &val, std::string &config, const char *key, ErrorBufferInterface *errorhnd)
bool extractStringArrayFromConfigString(std::vector< std::string > &val, std::string &config, const char *key, char separator, ErrorBufferInterface *errorhnd)
bool extractFloatFromConfigString(double &val, std::string &config, const char *key, ErrorBufferInterface *errorhnd)
void removeKeysFromConfigString(std::string &config, const char **keys, ErrorBufferInterface *errorhnd)
bool extractStringFromConfigString(std::string &val, std::string &config, const char *key, ErrorBufferInterface *errorhnd)
std::vector< std::pair< std::string, std::string > > getAssignmentListItems(const std::string &config, ErrorBufferInterface *errorhnd)
std::vector< std::pair< std::string, std::string > > getConfigStringItems(const std::string &config, ErrorBufferInterface *errorhnd)
bool addConfigStringItem(std::string &config, const std::string &key, const std::string &value, ErrorBufferInterface *errorhnd)