Core: Add singleton instance to _Marshalls

This commit is contained in:
Ignacio Etcheverry 2016-11-05 17:13:04 +01:00
parent c67e3a485d
commit 6d6d9bc7f9
3 changed files with 14 additions and 2 deletions

View File

@ -2043,6 +2043,13 @@ _Directory::~_Directory() {
memdelete(d);
}
_Marshalls* _Marshalls::singleton=NULL;
_Marshalls *_Marshalls::get_singleton()
{
return singleton;
}
String _Marshalls::variant_to_base64(const Variant& p_var) {
int len;

View File

@ -503,6 +503,8 @@ class _Marshalls : public Reference {
OBJ_TYPE(_Marshalls,Reference);
static _Marshalls* singleton;
protected:
static void _bind_methods();
@ -510,6 +512,8 @@ protected:
public:
static _Marshalls* get_singleton();
String variant_to_base64(const Variant& p_var);
Variant base64_to_variant(const String& p_str);
@ -519,7 +523,8 @@ public:
String utf8_to_base64(const String& p_str);
String base64_to_utf8(const String& p_str);
_Marshalls() {};
_Marshalls() { singleton = this; }
~_Marshalls() { singleton = NULL; }
};

View File

@ -177,7 +177,7 @@ void register_core_singletons() {
Globals::get_singleton()->add_singleton( Globals::Singleton("ResourceSaver",_ResourceSaver::get_singleton()) );
Globals::get_singleton()->add_singleton( Globals::Singleton("PathRemap",PathRemap::get_singleton() ) );
Globals::get_singleton()->add_singleton( Globals::Singleton("OS",_OS::get_singleton() ) );
Globals::get_singleton()->add_singleton( Globals::Singleton("Marshalls",_marshalls ) );
Globals::get_singleton()->add_singleton( Globals::Singleton("Marshalls",_Marshalls::get_singleton() ) );
Globals::get_singleton()->add_singleton( Globals::Singleton("TranslationServer",TranslationServer::get_singleton() ) );
Globals::get_singleton()->add_singleton( Globals::Singleton("TS",TranslationServer::get_singleton() ) );
Globals::get_singleton()->add_singleton( Globals::Singleton("Input",Input::get_singleton() ) );