All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
InteriorId.h
1 // Copyright eeGeo Ltd (2012-2023), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Interiors.h"
7 #include "CallbackCollection.h"
8 #include "ICallback.h"
9 
10 #include <string>
11 
12 namespace Eegeo
13 {
14  namespace Resources
15  {
16  namespace Interiors
17  {
18  struct InteriorId
19  {
20  InteriorId()
21  {}
22 
23  InteriorId(std::string interiorId)
24  : m_interiorId(interiorId)
25  {}
26 
27  std::string Value() const { return m_interiorId; }
28 
29  bool operator ==(const InteriorId& other) const { return Value() == other.Value(); }
30 
31  bool operator !=(const InteriorId& other) const { return Value() != other.Value(); }
32 
33  bool operator <(const InteriorId& other) const { return Value() < other.Value(); }
34 
35  bool operator >(const InteriorId& other) const { return Value() > other.Value(); }
36 
37  bool IsValid() const { return !m_interiorId.empty(); }
38 
39  inline static InteriorId NullId() { return InteriorId(""); }
40  private:
41  std::string m_interiorId;
42  };
43  }
44  }
45 }
46 
47 // Custom specialization of std::hash can be legally injected in namespace std
48 template<>
49 struct std::hash<Eegeo::Resources::Interiors::InteriorId>
50 {
51  std::size_t operator()(const Eegeo::Resources::Interiors::InteriorId& id) const noexcept
52  {
53  return std::hash<std::string>{}(id.Value());
54  }
55 };