00001 /* 00002 ClanGUI, copyrights by various people. Have a look in the CREDITS file. 00003 00004 This sourcecode is distributed using the Library GNU Public Licence, 00005 version 2 or (at your option) any later version. Please read LICENSE 00006 for details. 00007 */ 00008 00009 #include <string> 00010 #include <stack> 00011 #include <vector> 00012 #include <stdio.h> 00013 00014 #include "API/GUI/component_manager.h" 00015 #include "API/GUI/stylemanager.h" 00016 #include "API/GUI/component.h" 00017 #include "API/GUI/component_options.h" 00018 #include "component_tokenizer.h" 00019 00020 class CL_ComponentManager_Generic : public CL_ComponentManager 00021 { 00022 public: 00023 CL_ComponentManager_Generic( 00024 const char *filename, 00025 CL_ResourceManager *resources, 00026 CL_StyleManager *style); 00027 00028 CL_ComponentManager_Generic( 00029 const char *filename, 00030 bool is_datafile, 00031 CL_StyleManager *style); 00032 00033 virtual ~CL_ComponentManager_Generic(); 00034 00035 virtual CL_Component *get_component(const char *component_id); 00036 void get_root_component_list(std::vector<CL_Component *> &components); 00037 00038 private: 00039 CL_InputSource *input; 00040 std::string filename; 00041 CL_StyleManager *style_manager; 00042 CL_ResourceManager *resources; 00043 00044 struct CL_ComponentInfo 00045 { 00046 public: 00047 CL_ComponentInfo() 00048 { 00049 type = ""; 00050 component_type = NULL; 00051 component = NULL; 00052 } 00053 std::string type; 00054 CL_ComponentType *component_type; 00055 CL_ComponentOptions options; 00056 CL_Component *component; 00057 std::list<CL_ComponentInfo *> children; 00058 }; 00059 00060 void init_style_manager(const char *style_id); 00061 std::string preprocess_templates(); 00062 std::string concatenate_stringlist(std::list<std::string> &expression); 00063 std::string evaluate_expression(std::list<std::string> &expression); 00064 void parse(); 00065 void create_components(std::multimap<int, CL_ComponentInfo *> &creation_sort_map); 00066 CL_ComponentType *is_component_type(const std::string &tok); 00067 00068 std::map<std::string, CL_ComponentInfo> component_map; 00069 00070 typedef std::pair<std::string, std::string> variable_pair_t; 00071 std::list<variable_pair_t> globals; 00072 }; 00073
1.2.6 written by Dimitri van Heesch,
© 1997-2001