diff options
Diffstat (limited to 'src/base.cpp')
-rw-r--r-- | src/base.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/base.cpp b/src/base.cpp index 4111451f8..0ff3fbe4c 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -157,10 +157,10 @@ bool ExtensionManager::Register(ExtensionItem* item) void ExtensionManager::BeginUnregister(Module* module, std::vector<reference<ExtensionItem> >& list) { - std::map<std::string, reference<ExtensionItem> >::iterator i = types.begin(); + ExtMap::iterator i = types.begin(); while (i != types.end()) { - std::map<std::string, reference<ExtensionItem> >::iterator me = i++; + ExtMap::iterator me = i++; ExtensionItem* item = me->second; if (item->creator == module) { @@ -172,7 +172,7 @@ void ExtensionManager::BeginUnregister(Module* module, std::vector<reference<Ext ExtensionItem* ExtensionManager::GetItem(const std::string& name) { - std::map<std::string, reference<ExtensionItem> >::iterator i = types.find(name); + ExtMap::iterator i = types.find(name); if (i == types.end()) return NULL; return i->second; @@ -248,11 +248,17 @@ LocalStringExt::~LocalStringExt() std::string LocalStringExt::serialize(SerializeFormat format, const Extensible* container, void* item) const { - if (item && format == FORMAT_USER) + if ((item) && (format != FORMAT_NETWORK)) return *static_cast<std::string*>(item); return ""; } +void LocalStringExt::unserialize(SerializeFormat format, Extensible* container, const std::string& value) +{ + if (format != FORMAT_NETWORK) + set(container, value); +} + LocalIntExt::LocalIntExt(const std::string& Key, ExtensibleType exttype, Module* mod) : LocalExtItem(Key, exttype, mod) { @@ -264,11 +270,17 @@ LocalIntExt::~LocalIntExt() std::string LocalIntExt::serialize(SerializeFormat format, const Extensible* container, void* item) const { - if (format != FORMAT_USER) + if (format == FORMAT_NETWORK) return ""; return ConvToStr(reinterpret_cast<intptr_t>(item)); } +void LocalIntExt::unserialize(SerializeFormat format, Extensible* container, const std::string& value) +{ + if (format != FORMAT_NETWORK) + set(container, ConvToInt(value)); +} + intptr_t LocalIntExt::get(const Extensible* container) const { return reinterpret_cast<intptr_t>(get_raw(container)); |