mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 21:27:01 -04:00
added FieldP to values and styles, implemented reflection for IndexMap
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@36 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -52,6 +52,8 @@ class Writer {
|
||||
template <typename T> void handle(const shared_ptr<T>& pointer);
|
||||
/// Write a map to the output stream
|
||||
template <typename K, typename V> void handle(const map<K,V>& map);
|
||||
/// Write an IndexMap to the output stream
|
||||
template <typename K, typename V> void handle(const IndexMap<K,V>& map);
|
||||
/// Write an object of type Defaultable<T> to the output stream
|
||||
template <typename T> void handle(const Defaultable<T>&);
|
||||
/// Write an object of type Scriptable<T> to the output stream
|
||||
@@ -98,6 +100,7 @@ template <typename T>
|
||||
void Writer::handle(const shared_ptr<T>& pointer) {
|
||||
if (pointer) handle(*pointer);
|
||||
}
|
||||
|
||||
template <typename K, typename V>
|
||||
void Writer::handle(const map<K,V>& m) {
|
||||
for (typename map<K,V>::const_iterator it = m.begin() ; it != m.end() ; ++it) {
|
||||
@@ -105,6 +108,14 @@ void Writer::handle(const map<K,V>& m) {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename K, typename V>
|
||||
void Writer::handle(const IndexMap<K,V>& m) {
|
||||
for (typename IndexMap<K,V>::const_iterator it = m.begin() ; it != m.end() ; ++it) {
|
||||
handle(get_key_name(*it).c_str(), *it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : Reflection
|
||||
|
||||
/// Implement reflection as used by Writer
|
||||
|
||||
Reference in New Issue
Block a user