Scene Fusion 2 API Reference
sfName.h
1 /*************************************************************************
2  *
3  * KINEMATICOUP CONFIDENTIAL
4  * __________________
5  *
6  * Copyright (2016-2021) KinematicSoup Technologies Incorporated
7  * All Rights Reserved.
8  *
9  * NOTICE: All information contained herein is, and remains
10  * the property of KinematicSoup Technologies Incorporated and its
11  * suppliers, if any. The intellectual and technical concepts contained
12  * herein are proprietary to KinematicSoup Technologies Incorporated
13  * and its suppliers and may be covered by Canadian and Foreign Patents,
14  * patents in process, and are protected by trade secret or copyright law.
15  * Dissemination of this information or reproduction of this material
16  * is strictly forbidden unless prior written permission is obtained
17  * from KinematicSoup Technologies Incorporated.
18  */
19 #pragma once
20 
21 #include <string>
22 #include <Exports.h>
23 
24 namespace KS {
25 namespace SceneFusion2 {
26 
32  class EXTERNAL sfName
33  {
34  public:
38  sfName();
39 
45  sfName(const std::string& str);
46 
52  sfName(const char* str);
53 
59  bool IsValid() const;
60 
66  const std::string& operator*() const { return *m_strPtr; }
67 
73  const std::string* operator->() const { return m_strPtr; }
74 
81  inline bool operator==(const sfName& name) const
82  {
83  return m_strPtr == name.m_strPtr || (!IsValid() && !name.IsValid());
84  }
85 
92  inline bool operator !=(const sfName& name) const
93  {
94  return !(*this == name);
95  }
96 
97  private:
98  const std::string* m_strPtr;
99  uint32_t m_tableId;
100  };
101 
102 } // SceneFusion2
103 } // KS
104 
105 // Define a hash function for sfName
106 namespace std
107 {
108  template<>
109  struct hash<KS::SceneFusion2::sfName>
110  {
117  inline size_t operator()(const KS::SceneFusion2::sfName& key) const
118  {
119  return key == nullptr ? 0 : reinterpret_cast<uintptr_t>(&*key);
120  }
121  };
122 }
Definition: sfName.h:33
bool operator==(const sfName &name) const
Definition: sfName.h:81
const std::string * operator->() const
Definition: sfName.h:73
sfName(const std::string &str)
sfName(const char *str)
const std::string & operator*() const
Definition: sfName.h:66
Definition: sfDictionaryProperty.h:24
size_t operator()(const KS::SceneFusion2::sfName &key) const
Definition: sfName.h:117