OpenClonk
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 const C4ID Clonk
 
static const C4ID Bubble
 
static const C4ID EditorBase
 

Detailed Description

Definition at line 25 of file C4Id.h.

Member Typedef Documentation

◆ Handle

typedef size_t C4ID::Handle

Definition at line 28 of file C4Id.h.

◆ safe_bool_type

typedef size_t C4ID::* C4ID::safe_bool_type

Definition at line 82 of file C4Id.h.

Constructor & Destructor Documentation

◆ C4ID() [1/5]

C4ID::C4ID ( )
inline

Definition at line 44 of file C4Id.h.

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

Referenced by CompileFunc().

Here is the caller graph for this function:

◆ C4ID() [2/5]

C4ID::C4ID ( const C4ID other)
default

◆ C4ID() [3/5]

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

Definition at line 34 of file C4Id.cpp.

34 { assign(s); }
#define s

References s.

◆ C4ID() [4/5]

C4ID::C4ID ( const StdStrBuf s)
inlineexplicit

Definition at line 49 of file C4Id.h.

49 { assign(s.getData()); }

References s.

◆ C4ID() [5/5]

C4ID::C4ID ( Handle  i)
inlineexplicit

Definition at line 51 of file C4Id.h.

51  : v(i)
52  {
53  assert(v < names.size());
54  }

Member Function Documentation

◆ CompileFunc()

void C4ID::CompileFunc ( StdCompiler pComp)

Definition at line 51 of file C4Id.cpp.

52 {
53  if (comp->isSerializer())
54  {
55  assert(v < names.size());
56  comp->String(&names[v][0], names[v].size(), StdCompiler::RCT_ID);
57  }
58  else
59  {
60  char *data;
61  comp->String(&data, StdCompiler::RCT_ID);
62  v = C4ID(data).v;
64  }
65 }
C4ID()
Definition: C4Id.h:44
static void DeletePointer(void *data)
Definition: StdBuf.h:196

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

Here is the call graph for this function:

◆ GetHandle()

Handle C4ID::GetHandle ( ) const
inline

Definition at line 66 of file C4Id.h.

67  {
68  return v;
69  }

◆ operator safe_bool_type()

C4ID::operator safe_bool_type ( ) const
inline

Definition at line 83 of file C4Id.h.

83 { return v == None.v ? nullptr : &C4ID::v; }

References None.

◆ operator std::string()

C4ID::operator std::string ( ) const
inline

Definition at line 61 of file C4Id.h.

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

◆ operator!=()

bool C4ID::operator!= ( const C4ID other) const
inline

Definition at line 75 of file C4Id.h.

75 { return names[v] != names[other.v]; }

◆ operator<()

bool C4ID::operator< ( const C4ID other) const
inline

Definition at line 76 of file C4Id.h.

76 { return names[v] < names[other.v]; }

◆ operator<=()

bool C4ID::operator<= ( const C4ID other) const
inline

Definition at line 78 of file C4Id.h.

78 { return names[v] <= names[other.v]; }

◆ operator=()

C4ID& C4ID::operator= ( const C4ID other)
default

◆ operator==()

bool C4ID::operator== ( const C4ID other) const
inline

Definition at line 74 of file C4Id.h.

74 { return names[v] == names[other.v]; }

◆ operator>()

bool C4ID::operator> ( const C4ID other) const
inline

Definition at line 77 of file C4Id.h.

77 { return names[v] > names[other.v]; }

◆ operator>=()

bool C4ID::operator>= ( const C4ID other) const
inline

Definition at line 79 of file C4Id.h.

79 { return names[v] >= names[other.v]; }

◆ ToString()

const char* C4ID::ToString ( ) const
inline

Definition at line 56 of file C4Id.h.

57  {
58  assert(v < names.size());
59  return names[v].c_str();
60  }

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().

Here is the caller graph for this function:

Member Data Documentation

◆ Bubble

const C4ID C4ID::Bubble
static

Definition at line 41 of file C4Id.h.

◆ Clonk

const C4ID C4ID::Clonk
static

Definition at line 40 of file C4Id.h.

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

◆ EditorBase

const C4ID C4ID::EditorBase
static

Definition at line 42 of file C4Id.h.

◆ None


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