Elaztek Developer Hub
Blamite Game Engine - Strings  00326.06.27.21.0407.blamite
A library containing general purpose utilities and classes for use in multiple projects.
BlamList.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
14 template<typename T> class BlamList
15 {
16 private:
17  std::vector<T> list;
18 
19 public:
25  BlamList(std::vector<T> _list)
26  {
27  list = _list;
28  }
29 
34  {
35  list = std::vector<T>();
36  }
37 
45  T At(int index)
46  {
47  return list.at(index);
48  }
49 
55  int Size()
56  {
57  return list.size();
58  }
59 
67  bool Contains(T item)
68  {
69  for (int i = 0; i < list.size(); i++)
70  {
71  if (list.at(i) == item)
72  {
73  return true;
74  }
75  }
76 
77  return false;
78  }
79 
87  bool IsOutOfRange(int index)
88  {
89  if (index > -1 && index < list.size())
90  {
91  return false;
92  }
93 
94  return true;
95  }
96 };
BlamList::BlamList
BlamList()
Creates a new BlamList.
Definition: BlamList.h:33
BlamList::IsOutOfRange
bool IsOutOfRange(int index)
Determines if the given index is out of range of the list.
Definition: BlamList.h:87
BlamList
Class representing a list of objects.
Definition: BlamList.h:14
BlamList::BlamList
BlamList(std::vector< T > _list)
Creates a new BlamList based on an existing vector.
Definition: BlamList.h:25
BlamList::Size
int Size()
Retrieves the size of the list.
Definition: BlamList.h:55
BlamList::At
T At(int index)
Retrieves the item at the specified index.
Definition: BlamList.h:45
BlamList::Contains
bool Contains(T item)
Determines if the list contains an item.
Definition: BlamList.h:67