nx_metadata_sdk 1.0 Metadata SDK

string_map.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #pragma once
4
5 #include <map>
6
7 #include <nx/sdk/helpers/ref_countable.h>
8
9 #include <nx/sdk/i_string_map.h>
10
11 namespace nx {
12 namespace sdk {
13
14 // TODO: Do something with O(N^2) complexity of lookup by index.
15 class StringMap: public RefCountable<IStringMap>
16 {
17 using Map = std::map<std::string, std::string>;
18
19 public:
20 void setItem(const std::string& key, const std::string& value);
21
22 void clear();
23
24 virtual int count() const override;
25
27 virtual const char* key(int i) const override;
28
30 virtual const char* value(int i) const override;
31
32 virtual const char* value(const char* key) const override;
33
34 private:
35 Map m_map;
36 };
37
38 } // namespace sdk
39 } // namespace nx
nx::sdk::StringMap
Definition: string_map.h:15
nx::sdk::StringMap::key
virtual const char * key(int i) const override
Definition: string_map.cpp:28
nx
Definition: apple_utils.h:6
nx::sdk::StringMap::value
virtual const char * value(int i) const override
Definition: string_map.cpp:38
nx::sdk::RefCountable
Definition: ref_countable.h:84