Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GalaxyXML Namespace Reference

Classes

class  XML
 
class  SGalaxy
 
class  Galaxy
 
class  SubHeirarchy
 

Typedefs

typedef std::map< std::string,
std::string > 
StringMap
 

Enumerations

enum  GalaxyNames {
  UNKNOWN, GALAXY, SYSTEMS, SECTOR,
  SYSTEM, VAR, NAME, VALUE,
  PLANETS, PLANET
}
 

Functions

void beginElement (void *userdata, const XML_Char *nam, const XML_Char **atts)
 
void endElement (void *userdata, const XML_Char *nam)
 

Variables

const EnumMap::Pair element_names [8]
 
const EnumMap::Pair attribute_names [3]
 
const EnumMap element_map (element_names, 8)
 
const EnumMap attribute_map (attribute_names, 3)
 

Detailed Description

Class Universe Deals with universal constants. It is a global, accessed from anywhere as _Universe-> Universe may be queried for Relationships, the current star system rendering is taking place in etc. It acts as a wrapper to the active Star System. Additionally it handles beginning and ending the main loop. And starting and ending graphics. (incl the task of wiping temp lights) Deprecated: loaded dynamic gldrv module

Typedef Documentation

typedef std::map< std::string, std::string > GalaxyXML::StringMap

Definition at line 15 of file galaxy_xml.h.

Enumeration Type Documentation

Enumerator
UNKNOWN 
GALAXY 
SYSTEMS 
SECTOR 
SYSTEM 
VAR 
NAME 
VALUE 
PLANETS 
PLANET 

Definition at line 42 of file galaxy_xml.cpp.

43 {
44  UNKNOWN,
45  GALAXY,
46  SYSTEMS,
47  SECTOR,
48  SYSTEM,
49  VAR,
50  NAME,
51  VALUE,
52  PLANETS,
53  PLANET
54 };

Function Documentation

void GalaxyXML::beginElement ( void *  userdata,
const XML_Char *  nam,
const XML_Char **  atts 
)

Definition at line 79 of file galaxy_xml.cpp.

References GalaxyXML::SGalaxy::addSection(), CommXML::attribute_map, CommXML::element_map, GalaxyXML::XML::g, GALAXY, XMLSupport::EnumMap::lookup(), CommXML::NAME, StarSystemGent::PLANET, PLANETS, SECTOR, GalaxyXML::SGalaxy::setVariable(), GalaxyXML::XML::stak, SYSTEM, SYSTEMS, CommXML::VALUE, and VAR.

Referenced by GalaxyXML::SGalaxy::SGalaxy().

80 {
81  AttributeList::const_iterator iter;
82  XML *xml = (XML*) userdata;
83  string tname( nam );
84  AttributeList attributes( atts );
85  GalaxyNames elem = (GalaxyNames) element_map.lookup( tname );
86  GalaxyNames attr;
87  string name;
88  string value;
89  switch (elem)
90  {
91  case GALAXY:
92  break;
93  case SYSTEMS:
94  break;
95  case PLANETS:
96  xml->stak.push_back( "<planets>" );
97  xml->g->addSection( xml->stak );
98  break;
99  case SECTOR:
100  case SYSTEM:
101 
102  case PLANET:
103  for (iter = attributes.begin(); iter != attributes.end(); ++iter) {
104  attr = (GalaxyNames) attribute_map.lookup( (*iter).name );
105  switch (attr)
106  {
107  case NAME:
108  name = (*iter).value;
109  break;
110  default:
111  break;
112  }
113  }
114  xml->stak.push_back( name );
115  xml->g->addSection( xml->stak );
116 
117  break;
118  case VAR:
119  for (iter = attributes.begin(); iter != attributes.end(); ++iter) {
120  attr = (GalaxyNames) attribute_map.lookup( (*iter).name );
121  switch (attr)
122  {
123  case NAME:
124  name = (*iter).value;
125  break;
126  case VALUE:
127  value = (*iter).value;
128  break;
129  default:
130  break;
131  }
132  }
133  xml->g->setVariable( xml->stak, name, value );
134  break;
135  default:
136  break;
137  }
138 }
void GalaxyXML::endElement ( void *  userdata,
const XML_Char *  nam 
)

Definition at line 139 of file galaxy_xml.cpp.

References CommXML::element_map, GALAXY, XMLSupport::EnumMap::lookup(), StarSystemGent::PLANET, PLANETS, SECTOR, GalaxyXML::XML::stak, SYSTEM, SYSTEMS, and VAR.

Referenced by GalaxyXML::SGalaxy::SGalaxy().

140 {
141  XML *xml = (XML*) userdata;
142  string name( nam );
143  GalaxyNames elem = (GalaxyNames) element_map.lookup( name );
144  switch (elem)
145  {
146  case GALAXY:
147  case SYSTEMS:
148  break;
149  case VAR:
150  break;
151  case SECTOR:
152  case SYSTEM:
153  case PLANETS:
154  case PLANET:
155  xml->stak.pop_back();
156  break;
157  default:
158  break;
159  }
160 }

Variable Documentation

const EnumMap GalaxyXML::attribute_map(attribute_names, 3)
const EnumMap::Pair GalaxyXML::attribute_names[3]
Initial value:
= {
EnumMap::Pair( "UNKNOWN", UNKNOWN ),
EnumMap::Pair( "name", NAME ),
EnumMap::Pair( "value", VALUE )
}

Definition at line 65 of file galaxy_xml.cpp.

const EnumMap GalaxyXML::element_map(element_names, 8)
const EnumMap::Pair GalaxyXML::element_names[8]
Initial value:
= {
EnumMap::Pair( "UNKNOWN", UNKNOWN ),
EnumMap::Pair( "Galaxy", GALAXY ),
EnumMap::Pair( "Systems", SYSTEMS ),
EnumMap::Pair( "Sector", SECTOR ),
EnumMap::Pair( "System", SYSTEM ),
EnumMap::Pair( "Planets", PLANETS ),
EnumMap::Pair( "Planet", PLANET ),
EnumMap::Pair( "Var", VAR )
}

Definition at line 55 of file galaxy_xml.cpp.