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

#include <C4PropList.h>

Collaboration diagram for C4Property:
[legend]

Public Member Functions

 C4Property ()
 
 C4Property (C4String *Key, const C4Value &Value)
 
 C4Property (const C4Property &o)
 
C4Propertyoperator= (const C4Property &o)
 
 C4Property (C4Property &&o)
 
C4Propertyoperator= (C4Property &&o)
 
 ~C4Property ()
 
void CompileFunc (StdCompiler *pComp, C4ValueNumbers *)
 
 operator const void * () const
 
C4Propertyoperator= (void *p)
 
bool operator< (const C4Property &cmp) const
 
const char * GetSafeKey () const
 

Public Attributes

C4StringKey
 
C4Value Value
 

Detailed Description

Definition at line 42 of file C4PropList.h.

Constructor & Destructor Documentation

C4Property::C4Property ( )
inline

Definition at line 45 of file C4PropList.h.

45 : Key(0) {}
C4String * Key
Definition: C4PropList.h:56
C4Property::C4Property ( C4String Key,
const C4Value Value 
)
inline

Definition at line 46 of file C4PropList.h.

References C4RefCnt::IncRef().

46  : Key(Key), Value(Value)
47  { assert(Key); Key->IncRef(); }
C4Value Value
Definition: C4PropList.h:57
void IncRef()
Definition: C4StringTable.h:27
C4String * Key
Definition: C4PropList.h:56

Here is the call graph for this function:

C4Property::C4Property ( const C4Property o)
inline

Definition at line 48 of file C4PropList.h.

References C4RefCnt::IncRef(), and Key.

48 : Key(o.Key), Value(o.Value) { if (Key) Key->IncRef(); }
C4Value Value
Definition: C4PropList.h:57
void IncRef()
Definition: C4StringTable.h:27
C4String * Key
Definition: C4PropList.h:56

Here is the call graph for this function:

C4Property::C4Property ( C4Property &&  o)
inline

Definition at line 51 of file C4PropList.h.

51 : Key(o.Key), Value(std::move(o.Value)) { o.Key = 0; }
C4Value Value
Definition: C4PropList.h:57
C4String * Key
Definition: C4PropList.h:56
C4Property::~C4Property ( )
inline

Definition at line 54 of file C4PropList.h.

References C4RefCnt::DecRef(), and Key.

54 { if (Key) Key->DecRef(); }
C4String * Key
Definition: C4PropList.h:56
void DecRef()
Definition: C4StringTable.h:28

Here is the call graph for this function:

Member Function Documentation

void C4Property::CompileFunc ( StdCompiler pComp,
C4ValueNumbers numbers 
)

Definition at line 503 of file C4PropList.cpp.

References C4RefCnt::DecRef(), C4String::GetData(), C4RefCnt::IncRef(), StdCompiler::isDeserializer(), Key, mkParAdapt(), C4StringTable::RegString(), s, StdCompiler::SEP_SET, StdCompiler::Separator(), Strings, Value, and StdCompiler::Value().

504 {
505  StdStrBuf s;
506  if (!pComp->isDeserializer())
507  s = Key->GetData();
508  pComp->Value(s);
509  if (pComp->isDeserializer())
510  {
511  if (Key) Key->DecRef();
512  Key = ::Strings.RegString(s);
513  Key->IncRef();
514  }
516  pComp->Value(mkParAdapt(Value, numbers));
517 }
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:129
C4Value Value
Definition: C4PropList.h:57
StdStrBuf GetData() const
Definition: C4StringTable.h:50
void IncRef()
Definition: C4StringTable.h:27
C4String * RegString(StdStrBuf String)
C4StringTable Strings
Definition: C4Globals.cpp:42
void Value(const T &rStruct)
Definition: StdCompiler.h:171
virtual bool isDeserializer()
Definition: StdCompiler.h:63
C4String * Key
Definition: C4PropList.h:56
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:459
void DecRef()
Definition: C4StringTable.h:28
#define s

Here is the call graph for this function:

const char* C4Property::GetSafeKey ( ) const
inline

Definition at line 62 of file C4PropList.h.

References C4String::GetCStr().

Referenced by operator<().

62 { if (Key && Key->GetCStr()) return Key->GetCStr(); return ""; } // get key as C string; return "" if undefined. never return nullptr
const char * GetCStr() const
Definition: C4StringTable.h:49
C4String * Key
Definition: C4PropList.h:56

Here is the call graph for this function:

Here is the caller graph for this function:

C4Property::operator const void * ( ) const
inline

Definition at line 58 of file C4PropList.h.

References Key.

58 { return Key; }
C4String * Key
Definition: C4PropList.h:56
bool C4Property::operator< ( const C4Property cmp) const
inline

Definition at line 61 of file C4PropList.h.

References GetSafeKey().

61 { return strcmp(GetSafeKey(), cmp.GetSafeKey())<0; }
const char * GetSafeKey() const
Definition: C4PropList.h:62

Here is the call graph for this function:

C4Property& C4Property::operator= ( const C4Property o)
inline

Definition at line 49 of file C4PropList.h.

References C4RefCnt::DecRef(), C4RefCnt::IncRef(), Key, and Value.

50  { if(o.Key) o.Key->IncRef(); if (Key) Key->DecRef(); Key = o.Key; Value = o.Value; return *this; }
C4Value Value
Definition: C4PropList.h:57
void IncRef()
Definition: C4StringTable.h:27
C4String * Key
Definition: C4PropList.h:56
void DecRef()
Definition: C4StringTable.h:28

Here is the call graph for this function:

C4Property& C4Property::operator= ( C4Property &&  o)
inline

Definition at line 52 of file C4PropList.h.

References C4RefCnt::DecRef(), Key, and Value.

53  { if (Key) Key->DecRef(); Key = o.Key; o.Key = 0; Value = std::move(o.Value); return *this; }
C4Value Value
Definition: C4PropList.h:57
C4String * Key
Definition: C4PropList.h:56
void DecRef()
Definition: C4StringTable.h:28

Here is the call graph for this function:

C4Property& C4Property::operator= ( void *  p)
inline

Definition at line 59 of file C4PropList.h.

References C4RefCnt::DecRef(), and C4Value::Set0().

60  { assert(!p); if (Key) Key->DecRef(); Key = 0; Value.Set0(); return *this; }
C4Value Value
Definition: C4PropList.h:57
void Set0()
Definition: C4Value.h:336
C4String * Key
Definition: C4PropList.h:56
void DecRef()
Definition: C4StringTable.h:28

Here is the call graph for this function:

Member Data Documentation


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