TrueReality  v0.1.1912
EnumerationNumeric.h
Go to the documentation of this file.
1 /*
2 * True Reality Open Source Game and Simulation Engine
3 * Copyright © 2021 Acid Rain Studios LLC
4 *
5 * This library is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License as published by the Free
7 * Software Foundation; either version 3.0 of the License, or (at your option)
8 * any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * @author Maxim Serebrennik
20 */
21 #pragma once
22 
23 #include "Export.h"
24 
26 
27 #include <ostream>
28 
34 namespace trUtil
35 {
46  {
47  public:
50 
58  unsigned int GetID() const;
59 
70  bool operator==(const unsigned int &id) const
71  {
72  return (mID == id);
73  }
74 
85  bool operator!=(const unsigned int &id) const
86  {
87  return (mID != id);
88  }
89 
100  bool operator>(const unsigned int &id) const
101  {
102  return (mID > id);
103  }
104 
115  bool operator<(const unsigned int &id) const
116  {
117  return (mID < id);
118  }
119 
130  bool operator>(const EnumerationNumeric &e) const
131  {
132  return (mID > e.mID);
133  }
134 
145  bool operator<(const EnumerationNumeric &e) const
146  {
147  return (mID < e.mID);
148  }
149 
160  bool operator==(const EnumerationNumeric &e) const
161  {
162  return (this == &e);
163  }
164 
175  bool operator!=(const EnumerationNumeric &e) const
176  {
177  return (this != &e);
178  }
179 
193  bool operator==(const std::string& rhs) const;
194 
204  bool operator!=(const std::string& rhs) const;
205 
215  bool operator<(const std::string& rhs) const;
216 
226  bool operator>(const std::string& rhs) const;
227 
228  protected:
229 
238  EnumerationNumeric(const std::string& name, unsigned int orderId);
239 
246 
247  private:
249  unsigned int mID;
250 
260  EnumerationNumeric& operator=(const EnumerationNumeric&);
261 
270  };
271 
282  TR_UTIL_EXPORT std::ostream& operator<<(std::ostream& os, const EnumerationString& e);
283 }
bool operator!=(const EnumerationNumeric &e) const
Inequality test for an EnumerationNumeric.
bool operator==(const std::string &s1, const RefStr &s2)
Definition: RefStr.h:187
unsigned int mID
The identifier.
bool operator!=(const std::string &s1, const RefStr &s2)
Definition: RefStr.h:199
bool operator<(const unsigned int &id) const
Less than test for an EnumerationNumeric.
This class represents a type-safe Enumeration pattern.
bool operator!=(const unsigned int &id) const
Inequality test for an EnumerationNumeric.
bool operator==(const unsigned int &id) const
Equality test for an EnumerationNumeric.
bool operator>(const EnumerationNumeric &e) const
Greater than test for an EnumerationNumeric.
TR_UTIL_EXPORT std::ostream & operator<<(std::ostream &os, const EnumerationString &e)
Helper method to print EnumerationNumeric to an output stream.
bool operator==(const EnumerationNumeric &e) const
Equality test for an EnumerationNumeric.
This class represents a type-safe EnumerationString pattern.
bool operator>(const unsigned int &id) const
Greater than test for an EnumerationNumeric.
A class that represents date time utility.
Namespace that holds various utility classes for the engine.
Definition: SmrtPtr.h:208
bool operator<(const EnumerationNumeric &e) const
Less than test for an EnumerationNumeric.