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
XMLSupport::EnumMap Class Reference

#include <xml_support.h>

Classes

struct  Pair
 

Public Member Functions

 EnumMap (const Pair *data, unsigned int num)
 
int lookup (const std::string &str) const
 
const std::string & lookup (int val) const
 

Detailed Description

Definition at line 59 of file xml_support.h.

Constructor & Destructor Documentation

XMLSupport::EnumMap::EnumMap ( const Pair data,
unsigned int  num 
)

Definition at line 35 of file xml_support.cpp.

References a, Hashtable< KEY, VALUE, SIZ >::Put(), strtoupper(), and XMLSupport::tostring().

36 {
37  for (unsigned int a = 0; a < num; a++) {
38  forward.Put( strtoupper( data[a].name ), &data[a].val );
39  reverse.Put( tostring( data[a].val ), &data[a].name );
40  }
41 }

Member Function Documentation

const string & XMLSupport::EnumMap::lookup ( int  val) const

Definition at line 49 of file xml_support.cpp.

References Hashtable< KEY, VALUE, SIZ >::Get(), and XMLSupport::tostring().

50 {
51  const string *result = reverse.Get( tostring( val ) );
52  assert( 0 != result );
53  return *result;
54 }

The documentation for this class was generated from the following files: