summaryrefslogtreecommitdiff
path: root/src/base.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-12-01 12:23:50 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-12-01 12:23:50 +0100
commit44b5a8fa89d8c2bda767c0d5fe77c4d31061ce2b (patch)
tree0f1b3d375efd8584858e7df906de6bc322f4b5c6 /src/base.cpp
parent0a12e928e61cdb5366f0ad8ffb9d912eb14c5878 (diff)
parent19cc9292ab5889fa09962820f3179e8078bec956 (diff)
Merge branch 'master+reloadmod'
Diffstat (limited to 'src/base.cpp')
-rw-r--r--src/base.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/base.cpp b/src/base.cpp
index 67b136ec8..496b23ef5 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -147,10 +147,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)
{
@@ -162,7 +162,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;
@@ -238,11 +238,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)
{
@@ -254,11 +260,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));