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 33 of file Types.h.

Constructor & Destructor Documentation

◆ PotentiallySetIndex() [1/2]

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

Definition at line 35 of file Types.h.

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

◆ PotentiallySetIndex() [2/2]

Leviathan::PotentiallySetIndex::PotentiallySetIndex ( )
inlinedefault

Member Function Documentation

◆ IsSet()

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

Definition at line 79 of file Types.h.

80  {
81 
82  return ValueSet;
83  }

◆ operator bool()

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

Definition at line 38 of file Types.h.

39  {
40 
41  return ValueSet;
42  }

◆ operator size_t()

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

Definition at line 44 of file Types.h.

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

◆ operator=() [1/2]

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

Definition at line 63 of file Types.h.

64  {
65 
66  ValueSet = other.ValueSet;
67  Index = other.Index;
68  return *this;
69  }

◆ operator=() [2/2]

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

Definition at line 71 of file Types.h.

72  {
73 
74  ValueSet = true;
75  Index = value;
76  return *this;
77  }

◆ operator==()

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

Definition at line 54 of file Types.h.

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

Member Data Documentation

◆ Index

size_t Leviathan::PotentiallySetIndex::Index = 0

Definition at line 86 of file Types.h.

◆ ValueSet

bool Leviathan::PotentiallySetIndex::ValueSet = false

Definition at line 85 of file Types.h.


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