OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ID Class Reference

#include <C4Id.h>

Collaboration diagram for C4ID:
[legend]

Public Types

typedef size_t Handle
 
typedef size_t C4ID::* safe_bool_type
 

Public Member Functions

 C4ID ()
 
 C4ID (const C4ID &other)
 
C4IDoperator= (const C4ID &other)
 
 C4ID (const std::string &s)
 
 C4ID (const StdStrBuf &s)
 
 C4ID (Handle i)
 
const char * ToString () const
 
 operator std::string () const
 
Handle GetHandle () const
 
void CompileFunc (StdCompiler *pComp)
 
bool operator== (const C4ID &other) const
 
bool operator!= (const C4ID &other) const
 
bool operator< (const C4ID &other) const
 
bool operator> (const C4ID &other) const
 
bool operator<= (const C4ID &other) const
 
bool operator>= (const C4ID &other) const
 
 operator safe_bool_type () const
 

Static Public Attributes

static const C4ID None
 
static DEPRECATED const C4ID Flag
 
static DEPRECATED const C4ID Conkit
 
static const C4ID Clonk
 
static const C4ID Melee
 
static const C4ID Bubble
 
static const C4ID EditorBase
 

Detailed Description

Definition at line 28 of file C4Id.h.

Member Typedef Documentation

typedef size_t C4ID::Handle

Definition at line 31 of file C4Id.h.

typedef size_t C4ID::* C4ID::safe_bool_type

Definition at line 88 of file C4Id.h.

Constructor & Destructor Documentation

C4ID::C4ID ( )
inline

Definition at line 50 of file C4Id.h.

Referenced by CompileFunc().

50 : v(None.v) {}
static const C4ID None
Definition: C4Id.h:42

Here is the caller graph for this function:

C4ID::C4ID ( const C4ID other)
inline

Definition at line 51 of file C4Id.h.

51 : v(other.v) {}
C4ID::C4ID ( const std::string &  s)
explicit

Definition at line 39 of file C4Id.cpp.

39 { assign(s); }
#define s
C4ID::C4ID ( const StdStrBuf s)
inlineexplicit

Definition at line 55 of file C4Id.h.

References StdStrBuf::getData().

55 { assign(s.getData()); }
const char * getData() const
Definition: StdBuf.h:450

Here is the call graph for this function:

C4ID::C4ID ( Handle  i)
inlineexplicit

Definition at line 57 of file C4Id.h.

57  : v(i)
58  {
59  assert(v < names.size());
60  }

Member Function Documentation

void C4ID::CompileFunc ( StdCompiler pComp)

Definition at line 54 of file C4Id.cpp.

References C4ID(), StdBuf::DeletePointer(), StdCompiler::isSerializer(), StdCompiler::RCT_ID, and StdCompiler::String().

55 {
56  if (pComp->isSerializer())
57  {
58  assert(v < names.size());
59  pComp->String(&names[v][0], names[v].size(), StdCompiler::RCT_ID);
60  }
61  else
62  {
63  char *data;
64  pComp->String(&data, StdCompiler::RCT_ID);
65  v = C4ID(data).v;
67  }
68 }
static void DeletePointer(void *data)
Definition: StdBuf.h:204
virtual void String(char *szString, size_t iMaxLength, RawCompileType eType=RCT_Escaped)=0
bool isSerializer()
Definition: StdCompiler.h:64
C4ID()
Definition: C4Id.h:50

Here is the call graph for this function:

Handle C4ID::GetHandle ( ) const
inline

Definition at line 72 of file C4Id.h.

73  {
74  return v;
75  }
C4ID::operator safe_bool_type ( ) const
inline

Definition at line 89 of file C4Id.h.

89 { return v == None.v ? 0 : &C4ID::v; }
static const C4ID None
Definition: C4Id.h:42
C4ID::operator std::string ( ) const
inline

Definition at line 67 of file C4Id.h.

68  {
69  assert(v < names.size());
70  return names[v];
71  }
bool C4ID::operator!= ( const C4ID other) const
inline

Definition at line 81 of file C4Id.h.

81 { return names[v] != names[other.v]; }
bool C4ID::operator< ( const C4ID other) const
inline

Definition at line 82 of file C4Id.h.

82 { return names[v] < names[other.v]; }
bool C4ID::operator<= ( const C4ID other) const
inline

Definition at line 84 of file C4Id.h.

84 { return names[v] <= names[other.v]; }
C4ID& C4ID::operator= ( const C4ID other)
inline

Definition at line 52 of file C4Id.h.

52 { v = other.v; return *this; }
bool C4ID::operator== ( const C4ID other) const
inline

Definition at line 80 of file C4Id.h.

80 { return names[v] == names[other.v]; }
bool C4ID::operator> ( const C4ID other) const
inline

Definition at line 83 of file C4Id.h.

83 { return names[v] > names[other.v]; }
bool C4ID::operator>= ( const C4ID other) const
inline

Definition at line 85 of file C4Id.h.

85 { return names[v] >= names[other.v]; }
const char* C4ID::ToString ( ) const
inline

Definition at line 62 of file C4Id.h.

Referenced by C4MainMenu::ActivateGoals(), C4MainMenu::ActivateRules(), c4_mapgen_handle_set_map_library(), C4Game::CheckObjectEnumeration(), C4ObjectMenu::DoRefillInternal(), C4Object::GetDataString(), C4GameParameters::GetGameGoalString(), C4DefGraphics::LoadMesh(), C4Game::ReloadDef(), and C4LSectors::Remove().

63  {
64  assert(v < names.size());
65  return names[v].c_str();
66  }

Here is the caller graph for this function:

Member Data Documentation

const C4ID C4ID::Bubble
static

Definition at line 47 of file C4Id.h.

const C4ID C4ID::Clonk
static

Definition at line 45 of file C4Id.h.

Referenced by C4SPlrStart::CompileFunc(), and C4ObjectInfoList::New().

const C4ID C4ID::Conkit
static

Definition at line 44 of file C4Id.h.

const C4ID C4ID::EditorBase
static

Definition at line 48 of file C4Id.h.

const C4ID C4ID::Flag
static

Definition at line 43 of file C4Id.h.

const C4ID C4ID::Melee
static

Definition at line 46 of file C4Id.h.

Referenced by C4SGame::IsMelee().


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