1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
/*
$Id: gui_file_parser.h,v 1.4 2002/01/04 22:31:39 mbn Exp $
ClanGUI, copyrights by various people. Have a look in the CREDITS file.
This sourcecode is distributed using the Library GNU Public Licence,
version 2 or (at your option) any later version. Please read LICENSE
for details.
*/
#ifndef header_gui_file_parser
#define header_gui_file_parser
#include <string>
#include <list>
#include <map>
#include "component_options.h"
class CL_ComponentType;
class CL_Component;
class CL_InputSource;
class CL_GUIFileParser
{
public:
CL_GUIFileParser(const std::string &filename, CL_InputSource *input);
struct ComponentInfo
{
public:
ComponentInfo()
{
type = "";
component_type = NULL;
component = NULL;
}
std::string name, type;
CL_ComponentType *component_type;
CL_ComponentOptions options;
CL_Component *component;
std::list<ComponentInfo *> children;
};
typedef std::map<std::string, ComponentInfo> component_map_t;
typedef std::multimap<int, ComponentInfo *> component_sort_map_t;
typedef std::pair<std::string, std::string> variable_pair_t;
typedef std::list<variable_pair_t> globals_t;
component_map_t &get_components() { return m_component_map; }
component_sort_map_t &get_sorted_components() { return m_component_sort_map; }
globals_t &globals() { return m_globals; }
private:
void parse();
std::string preprocess_templates();
std::string concatenate_stringlist(std::list<std::string> &expression);
std::string evaluate_expression(std::list<std::string> &expression);
CL_ComponentType *is_component_type(const std::string &tok);
std::string filename;
CL_InputSource *input;
component_map_t m_component_map;
component_sort_map_t m_component_sort_map;
std::list<variable_pair_t> m_globals;
};
#endif
|