Atoms Crowd  7.0.0
HashedString.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <AtomsCore/Globals.h>
11 #include <AtomsCore/MemoryUtils.h>
12 #include <AtomsCore/Serialiser.h>
13 #include <AtomsCore/Hash.h>
14 #include <string>
15 #include <map>
16 #include <vector>
17 
18 namespace AtomsCore
19 {
20  class ATOMSCORE_EXPORT HashedString
21  {
22  public:
23 
24  HashedString();
25 
26  HashedString(long value);
27 
28  HashedString(const char* s);
29 
30  HashedString(const std::string& s);
31 
32  ~HashedString();
33 
34  inline bool operator<(const HashedString& src) const;
35 
36  inline bool operator==(const HashedString& src) const;
37 
38  inline bool operator!=(const char* value) const;
39 
40  inline bool operator!=(const std::string& value) const;
41 
42  inline HashedString& operator=(const std::string& other);
43 
44  inline const std::string& string() const;
45 
46  inline size_t hash() const;
47 
48  inline operator const std::string & () const;
49 
50  inline const char *c_str() const;
51 
52  inline std::string operator+(const char* value) const;
53 
54  inline std::string operator+(const std::string& value) const;
55 
56  inline size_t size() const;
57 
58  inline size_t find(const std::string& value, size_t offset = 0) const;
59 
60  inline size_t rfind(const std::string& value, size_t offset = std::string::npos) const;
61 
62  inline std::string substr(size_t offset, size_t count = std::string::npos) const;
63 
64  inline bool empty() const;
65 
66  private:
67 
68  size_t m_hash;
69 
70  std::string m_string;
71  };
72 }
73 
74 #include "HashedString.impl.h"
75 
Definition: HashedString.h:21
AtomsCore namespace.
Definition: Agent.h:344