Leviathan  0.8.0.0
Leviathan game engine
Leviathan::PotentiallySetIndex Struct Reference

#include <Types.h>

Public Member Functions

 PotentiallySetIndex (size_t index)
 
 PotentiallySetIndex ()=default
 
 operator bool () const
 
 operator size_t () const
 
bool operator== (const PotentiallySetIndex &other) const
 
PotentiallySetIndexoperator= (const PotentiallySetIndex &other)
 
PotentiallySetIndexoperator= (const size_t &value)
 
bool IsSet () const
 

Public Attributes

bool ValueSet = false
 
size_t Index = 0
 

Detailed Description

Definition at line 31 of file Types.h.

Constructor & Destructor Documentation

◆ PotentiallySetIndex() [1/2]

Leviathan::PotentiallySetIndex::PotentiallySetIndex ( size_t  index)
inline

Definition at line 33 of file Types.h.

33 : ValueSet(true), Index(index) {}

◆ PotentiallySetIndex() [2/2]

Leviathan::PotentiallySetIndex::PotentiallySetIndex ( )
inlinedefault

Member Function Documentation

◆ IsSet()

bool Leviathan::PotentiallySetIndex::IsSet ( ) const
inline

Definition at line 77 of file Types.h.

78  {
79 
80  return ValueSet;
81  }

◆ operator bool()

Leviathan::PotentiallySetIndex::operator bool ( ) const
inline

Definition at line 36 of file Types.h.

37  {
38 
39  return ValueSet;
40  }

◆ operator size_t()

Leviathan::PotentiallySetIndex::operator size_t ( ) const
inline

Definition at line 42 of file Types.h.

43  {
44 #ifdef _DEBUG
45  LEVIATHAN_ASSERT(
46  ValueSet, "PotentiallySetIndex size_t() called when ValueSet is false");
47 #endif // _DEBUG
48 
49  return Index;
50  }

◆ operator=() [1/2]

PotentiallySetIndex& Leviathan::PotentiallySetIndex::operator= ( const PotentiallySetIndex other)
inline

Definition at line 61 of file Types.h.

62  {
63 
64  ValueSet = other.ValueSet;
65  Index = other.Index;
66  return *this;
67  }

◆ operator=() [2/2]

PotentiallySetIndex& Leviathan::PotentiallySetIndex::operator= ( const size_t &  value)
inline

Definition at line 69 of file Types.h.

70  {
71 
72  ValueSet = true;
73  Index = value;
74  return *this;
75  }

◆ operator==()

bool Leviathan::PotentiallySetIndex::operator== ( const PotentiallySetIndex other) const
inline

Definition at line 52 of file Types.h.

53  {
54 
55  if(!ValueSet)
56  return ValueSet == other.ValueSet;
57 
58  return Index == other.Index;
59  }

Member Data Documentation

◆ Index

size_t Leviathan::PotentiallySetIndex::Index = 0

Definition at line 84 of file Types.h.

◆ ValueSet

bool Leviathan::PotentiallySetIndex::ValueSet = false

Definition at line 83 of file Types.h.


The documentation for this struct was generated from the following file: