| 89 | std::string string_tolower(const std::string& str); |
| 90 | |
| 91 | struct StringId |
| 92 | { |
| 93 | uint32_t id = 0; |
| 94 | StringId() |
| 95 | { |
| 96 | } |
| 97 | StringId(const char* pszString); |
| 98 | StringId(const std::string& str); |
| 99 | explicit StringId(uint32_t _id) |
| 100 | { |
| 101 | id = _id; |
| 102 | } |
| 103 | |
| 104 | bool operator==(const StringId& rhs) const |
| 105 | { |
| 106 | return id == rhs.id; |
| 107 | } |
| 108 | const StringId& operator=(const char* pszString); |
| 109 | const StringId& operator=(const std::string& str); |
| 110 | bool operator<(const StringId& rhs) const |
| 111 | { |
| 112 | return id < rhs.id; |
| 113 | } |
| 114 | |
| 115 | operator uint32_t() const |
| 116 | { |
| 117 | return id; |
| 118 | } |
| 119 | std::string ToString() const |
| 120 | { |
| 121 | auto itr = GetStringLookup().find(id); |
| 122 | if (itr == GetStringLookup().end()) |
| 123 | { |
| 124 | return "murmur:" + std::to_string(id); |
| 125 | } |
| 126 | return itr->second; |
| 127 | } |
| 128 | |
| 129 | static std::unordered_map<uint32_t, std::string>& GetStringLookup(); |
| 130 | }; |
| 131 | |
| 132 | inline std::ostream& operator<<(std::ostream& str, StringId id) |
| 133 | { |
no outgoing calls
no test coverage detected