Rapicorn - Experimental UI Toolkit - Source Code 10.08.1
evaluator.hh
Go to the documentation of this file.
00001 /* Rapicorn
00002  * Copyright (C) 2002-2006 Tim Janik
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * A copy of the GNU Lesser General Public License should ship along
00015  * with this library; if not, see http://www.gnu.org/copyleft/.
00016  */
00017 #ifndef __RAPICORN_EVALUATOR_HH__
00018 #define __RAPICORN_EVALUATOR_HH__
00019 
00020 #include <ui/item.hh>
00021 #include <list>
00022 
00023 namespace Rapicorn {
00024 
00025 struct Evaluator {
00026   typedef std::vector<String>           ArgumentList; /* elements: key=utf8string */
00027   typedef std::map<String,String>       VariableMap;
00028   typedef std::list<const VariableMap*> VariableMapList;
00029   static String     canonify_name   (const String       &key); /* chars => [A-Za-z0-9_] */
00030   static String     canonify_key    (const String       &key); /* canonify, id=>name, strip leading '_' */
00031   static bool       split_argument  (const String       &argument,
00032                                      String             &key,
00033                                      String             &value);
00034   static void       populate_map    (VariableMap        &vmap,
00035                                      const ArgumentList &args);
00036   void              push_map        (const VariableMap  &vmap);
00037   void              pop_map         (const VariableMap  &vmap);
00038   String            parse_eval      (const String       &expression);
00039 private:
00040   VariableMapList   env_maps;
00041 };
00042 
00043 } // Rapicorn
00044 
00045 #endif /* __RAPICORN_EVALUATOR_HH__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines