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

Member Typedef Documentation

◆ Index

Definition at line 89 of file Types.h.

Constructor & Destructor Documentation

◆ StartEndIndex() [1/3]

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

Definition at line 91 of file Types.h.

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

◆ StartEndIndex() [2/3]

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

Definition at line 93 of file Types.h.

93 : 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 107 of file Types.h.

108  {
109 
110  if(!Start || !End || static_cast<size_t>(Start) > static_cast<size_t>(End))
111  return 0;
112 
113  return 1 + (static_cast<size_t>(End) - static_cast<size_t>(Start));
114  }

◆ Reset()

void Leviathan::StartEndIndex::Reset ( )
inline

Reset the Start and End to unset.

Definition at line 98 of file Types.h.

99  {
100 
101  Start = Index();
102  End = Index();
103  }
PotentiallySetIndex Index
Definition: Types.h:89

Member Data Documentation

◆ End

Index Leviathan::StartEndIndex::End

Definition at line 118 of file Types.h.

◆ Start

Index Leviathan::StartEndIndex::Start

Definition at line 117 of file Types.h.


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