Make templates localizable (Closes #100)

This commit is contained in:
Twan van Laarhoven
2020-10-03 14:38:39 +02:00
parent f2ae3ae43b
commit c7377303cf
23 changed files with 155 additions and 63 deletions
+7 -3
View File
@@ -145,9 +145,9 @@ private:
// ----------------------------------------------------------------------------- : Collections : maps
template <typename V>
ScriptValueP get_member(const map<String,V>& m, const String& name) {
typename map<String,V>::const_iterator it = m.find(name);
template <typename Container>
ScriptValueP get_member(const Container& m, const String& name) {
auto it = m.find(name);
if (it != m.end()) {
return to_script(it->second);
} else {
@@ -403,6 +403,10 @@ inline ScriptValueP to_script(const map<K,V>* v) {
return make_intrusive<ScriptMap<map<K,V>>>(v);
}
template <typename K, typename V>
inline ScriptValueP to_script(const unordered_map<K,V>* v) {
return make_intrusive<ScriptMap<unordered_map<K,V>>>(v);
}
template <typename K, typename V>
inline ScriptValueP to_script(const IndexMap<K,V>* v) {
return make_intrusive<ScriptMap<IndexMap<K,V>>>(v);
}