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

Constructor & Destructor Documentation

◆ PotentiallySetIndex() [1/2]

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

Definition at line 41 of file Types.h.

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

◆ PotentiallySetIndex() [2/2]

Leviathan::PotentiallySetIndex::PotentiallySetIndex ( )
inlinedefault

Member Function Documentation

◆ IsSet()

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

Definition at line 85 of file Types.h.

86  {
87 
88  return ValueSet;
89  }

◆ operator bool()

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

Definition at line 44 of file Types.h.

45  {
46 
47  return ValueSet;
48  }

◆ operator size_t()

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

Definition at line 50 of file Types.h.

51  {
52 #ifdef _DEBUG
54  ValueSet, "PotentiallySetIndex size_t() called when ValueSet is false");
55 #endif // _DEBUG
56 
57  return Index;
58  }
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:92

◆ operator=() [1/2]

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

Definition at line 69 of file Types.h.

70  {
71 
72  ValueSet = other.ValueSet;
73  Index = other.Index;
74  return *this;
75  }

◆ operator=() [2/2]

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

Definition at line 77 of file Types.h.

78  {
79 
80  ValueSet = true;
81  Index = value;
82  return *this;
83  }

◆ operator==()

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

Definition at line 60 of file Types.h.

61  {
62 
63  if(!ValueSet)
64  return ValueSet == other.ValueSet;
65 
66  return Index == other.Index;
67  }

Member Data Documentation

◆ Index

size_t Leviathan::PotentiallySetIndex::Index = 0

Definition at line 92 of file Types.h.

◆ ValueSet

bool Leviathan::PotentiallySetIndex::ValueSet = false

Definition at line 91 of file Types.h.


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