diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-12-04 18:29:42 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-12-04 20:02:50 +0100 |
commit | abafb52f37beb5659efc2105ccd1568e1f754898 (patch) | |
tree | 6a60636d3497560ca61e5aae5f6d7061c4f18553 /src/style/class_dictionary.cpp | |
parent | bff6aeb4da41dee1f5f1cfa0be81b6c257257253 (diff) | |
download | qtlocation-mapboxgl-abafb52f37beb5659efc2105ccd1568e1f754898.tar.gz |
make most headers private
Diffstat (limited to 'src/style/class_dictionary.cpp')
-rw-r--r-- | src/style/class_dictionary.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/style/class_dictionary.cpp b/src/style/class_dictionary.cpp deleted file mode 100644 index ba7c0d55be..0000000000 --- a/src/style/class_dictionary.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include <mbgl/style/class_dictionary.hpp> - -#include <uv.h> - -namespace mbgl { - -ClassDictionary::ClassDictionary() {} - -ClassDictionary &ClassDictionary::Get() { - // Note: We should eventually switch to uv_key_* functions, but libuv 0.10 doesn't have these - // yet. Instead, we're using the pthread functions directly for now. - static pthread_once_t store_once = PTHREAD_ONCE_INIT; - static pthread_key_t store_key; - - // Create the key. - pthread_once(&store_once, []() { - pthread_key_create(&store_key, [](void *ptr) { - delete reinterpret_cast<ClassDictionary *>(ptr); - }); - }); - - ClassDictionary *ptr = reinterpret_cast<ClassDictionary *>(pthread_getspecific(store_key)); - if (ptr == nullptr) { - ptr = new ClassDictionary(); - pthread_setspecific(store_key, ptr); - } - - return *ptr; -} - -ClassID ClassDictionary::lookup(const std::string &class_name) { - auto it = store.find(class_name); - if (it == store.end()) { - // Insert the class name into the store. - ClassID id = ClassID(uint32_t(ClassID::Named) + offset++); - store.emplace(class_name, id); - return id; - } else { - return it->second; - } -} - -ClassID ClassDictionary::normalize(ClassID id) { - if (id >= ClassID::Named) { - return ClassID::Named; - } else { - return id; - } -} - -} |