Rapicorn - Experimental UI Toolkit - Source Code
13.07.0
|
00001 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html 00002 #ifndef __RAPICORN_EVALUATOR_HH__ 00003 #define __RAPICORN_EVALUATOR_HH__ 00004 00005 #include <ui/widget.hh> 00006 #include <list> 00007 00008 namespace Rapicorn { 00009 00010 struct Evaluator { 00011 typedef std::vector<String> ArgumentList; /* elements: key=utf8string */ 00012 typedef std::map<String,String> VariableMap; 00013 typedef std::list<const VariableMap*> VariableMapList; 00014 static String canonify_name (const String &key); /* chars => [A-Za-z0-9_] */ 00015 static String canonify_key (const String &key); /* canonify, id=>name, strip leading '_' */ 00016 static bool split_argument (const String &argument, 00017 String &key, 00018 String &value); 00019 static void populate_map (VariableMap &vmap, 00020 const ArgumentList &args); 00021 static void populate_map (VariableMap &vmap, 00022 const ArgumentList &variable_names, 00023 const ArgumentList &variable_values); 00024 void push_map (const VariableMap &vmap); 00025 void pop_map (const VariableMap &vmap); 00026 String parse_eval (const String &expression); 00027 private: 00028 VariableMapList env_maps; 00029 }; 00030 00031 } // Rapicorn 00032 00033 #endif /* __RAPICORN_EVALUATOR_HH__ */