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)=default
 
C4IDoperator= (const C4ID &other)=default
 
 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 25 of file C4Id.h.

Member Typedef Documentation

typedef size_t C4ID::Handle

Definition at line 28 of file C4Id.h.

typedef size_t C4ID::* C4ID::safe_bool_type

Definition at line 85 of file C4Id.h.

Constructor & Destructor Documentation

C4ID::C4ID ( )
inline

Definition at line 47 of file C4Id.h.

Referenced by CompileFunc().

47 : v(None.v) {}
static const C4ID None
Definition: C4Id.h:39

Here is the caller graph for this function:

C4ID::C4ID ( const C4ID other)
default
C4ID::C4ID ( const std::string &  s)
explicit

Definition at line 38 of file C4Id.cpp.

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

Definition at line 52 of file C4Id.h.

References StdStrBuf::getData().

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

Here is the call graph for this function:

C4ID::C4ID ( Handle  i)
inlineexplicit

Definition at line 54 of file C4Id.h.

54  : v(i)
55  {
56  assert(v < names.size());
57  }

Member Function Documentation

void C4ID::CompileFunc ( StdCompiler pComp)

Definition at line 53 of file C4Id.cpp.

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

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

Here is the call graph for this function:

Handle C4ID::GetHandle ( ) const
inline

Definition at line 69 of file C4Id.h.

70  {
71  return v;
72  }
C4ID::operator safe_bool_type ( ) const
inline

Definition at line 86 of file C4Id.h.

86 { return v == None.v ? nullptr : &C4ID::v; }
static const C4ID None
Definition: C4Id.h:39
C4ID::operator std::string ( ) const
inline

Definition at line 64 of file C4Id.h.

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

Definition at line 78 of file C4Id.h.

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

Definition at line 79 of file C4Id.h.

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

Definition at line 81 of file C4Id.h.

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

Definition at line 77 of file C4Id.h.

77 { return names[v] == names[other.v]; }
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 82 of file C4Id.h.

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

Definition at line 59 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().

60  {
61  assert(v < names.size());
62  return names[v].c_str();
63  }

Here is the caller graph for this function:

Member Data Documentation

const C4ID C4ID::Bubble
static

Definition at line 44 of file C4Id.h.

const C4ID C4ID::Clonk
static

Definition at line 42 of file C4Id.h.

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

const C4ID C4ID::Conkit
static

Definition at line 41 of file C4Id.h.

const C4ID C4ID::EditorBase
static

Definition at line 45 of file C4Id.h.

const C4ID C4ID::Flag
static

Definition at line 40 of file C4Id.h.

const C4ID C4ID::Melee
static

Definition at line 43 of file C4Id.h.

Referenced by C4SGame::IsMelee().


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