/* * This file is part of libtinyconfig * * Copyright(c) sschulz techfak.uni-bielefeld.de * http://opensource.cit-ec.de/projects/libtinyconfig * * This file may be licensed under the terms of the * GNU Lesser General Public License Version 3 (the ``LGPL''), * or (at your option) any later version. * * Software distributed under the License is distributed * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either * express or implied. See the LGPL for the specific language * governing rights and limitations. * * You should have received a copy of the LGPL along with this * program. If not, go to http://www.gnu.org/licenses/lgpl.html * or write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The development of this software was supported by the * Excellence Cluster EXC 277 Cognitive Interaction Technology. * The Excellence Cluster EXC 277 is a grant of the Deutsche * Forschungsgemeinschaft (DFG) in the context of the German * Excellence Initiative. */ #ifndef TinyConfig_H #define TinyConfig_H #include #include #include #include #include #include #include #include #define DEBUG_CONFIG_PARSER 0 using namespace std; using namespace cv; class TinyConfig{ public: TinyConfig(); ~TinyConfig(); void load(string filename); void save(string filename); void add_variable(string name, bool *var, bool default_value); void add_variable(string name, double *var, double default_value); void add_variable(string name, int *var, int default_value); void add_variable(string name, vector *var, vector default_value); void add_variable(string name, string *var, string default_value); void add_variable(string name, Point2f *var, Point2f default_value); void add_variable(string name, vector *var, vector default_value); void add_variable(string name, Point2d *var, Point2d default_value); void add_variable(string name, vector *var, vector default_value); private: string parser_extract_arg(string in); string parser_extract_type(string in); string parser_extract_keyword(string in); string get_formated_date(); typedef std::map config_map_bool_t; config_map_bool_t config_map_bool; typedef std::map config_map_double_t; config_map_double_t config_map_double; typedef std::map config_map_int_t; config_map_int_t config_map_int; typedef std::map*> config_map_vec_int_t; config_map_vec_int_t config_map_vec_int; typedef std::map config_map_string_t; config_map_string_t config_map_string; typedef std::map config_map_point2f_t; config_map_point2f_t config_map_point2f; typedef std::map* > config_map_vec_point2f_t; config_map_vec_point2f_t config_map_vec_point2f; typedef std::map config_map_point2d_t; config_map_point2d_t config_map_point2d; typedef std::map* > config_map_vec_point2d_t; config_map_vec_point2d_t config_map_vec_point2d; }; #endif