Leviathan  0.8.0.0
Leviathan game engine
Leviathan::StartEndIndex Struct Reference

#include <Types.h>

Public Types

using Index = PotentiallySetIndex
 

Public Member Functions

 StartEndIndex (size_t start, size_t end)
 
 StartEndIndex (size_t start)
 
 StartEndIndex ()=default
 
void Reset ()
 Reset the Start and End to unset. More...
 
size_t Length () const
 

Public Attributes

Index Start
 
Index End
 

Detailed Description

Definition at line 94 of file Types.h.

Member Typedef Documentation

◆ Index

Definition at line 96 of file Types.h.

Constructor & Destructor Documentation

◆ StartEndIndex() [1/3]

Leviathan::StartEndIndex::StartEndIndex ( size_t  start,
size_t  end 
)
inline

Definition at line 98 of file Types.h.

98 : Start(start), End(end) {}

◆ StartEndIndex() [2/3]

Leviathan::StartEndIndex::StartEndIndex ( size_t  start)
inline

Definition at line 100 of file Types.h.

100 : Start(start) {}

◆ StartEndIndex() [3/3]

Leviathan::StartEndIndex::StartEndIndex ( )
inlinedefault

Member Function Documentation

◆ Length()

size_t Leviathan::StartEndIndex::Length ( ) const
inline

Calculates the length of the indexes between start and end

Returns
The length or if either is unset 0 Or if Start > End

Definition at line 113 of file Types.h.

114  {
115  if(!Start || !End || static_cast<size_t>(Start) > static_cast<size_t>(End))
116  return 0;
117 
118  return 1 + (static_cast<size_t>(End) - static_cast<size_t>(Start));
119  }

◆ Reset()

void Leviathan::StartEndIndex::Reset ( )
inline

Reset the Start and End to unset.

Definition at line 105 of file Types.h.

106  {
107  Start = Index();
108  End = Index();
109  }
PotentiallySetIndex Index
Definition: Types.h:96

Member Data Documentation

◆ End

Index Leviathan::StartEndIndex::End

Definition at line 123 of file Types.h.

◆ Start

Index Leviathan::StartEndIndex::Start

Definition at line 122 of file Types.h.


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