diff options
author | Jose <jose@zeroc.com> | 2016-03-01 14:33:27 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-03-01 14:33:27 +0100 |
commit | e283494c906ffac2be14f38422934921ea6ae307 (patch) | |
tree | c4b9274845482abd89f84555675d8486a41a71e3 /ruby/src | |
parent | Rework previous fix for 3.6 compatibility (diff) | |
download | ice-e283494c906ffac2be14f38422934921ea6ae307.tar.bz2 ice-e283494c906ffac2be14f38422934921ea6ae307.tar.xz ice-e283494c906ffac2be14f38422934921ea6ae307.zip |
Ice::identityToString/Ice::stringToIdentity php/ruby/python implementations
Diffstat (limited to 'ruby/src')
-rw-r--r-- | ruby/src/IceRuby/Communicator.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ruby/src/IceRuby/Communicator.cpp b/ruby/src/IceRuby/Communicator.cpp index 24d9629a847..16bd58cb90f 100644 --- a/ruby/src/IceRuby/Communicator.cpp +++ b/ruby/src/IceRuby/Communicator.cpp @@ -226,6 +226,34 @@ IceRuby_initialize(int argc, VALUE* argv, VALUE self) extern "C" VALUE +IceRuby_stringToIdentity(VALUE self, VALUE str) +{ + ICE_RUBY_TRY + { + string s = getString(str); + Ice::Identity ident = Ice::stringToIdentity(s); + return createIdentity(ident); + } + ICE_RUBY_CATCH + return Qnil; +} + +extern "C" +VALUE +IceRuby_identityToString(VALUE self, VALUE id) +{ + ICE_RUBY_TRY + { + Ice::Identity ident = getIdentity(id); + string str = Ice::identityToString(ident); + return createString(str); + } + ICE_RUBY_CATCH + return Qnil; +} + +extern "C" +VALUE IceRuby_Communicator_destroy(VALUE self) { ICE_RUBY_TRY @@ -553,6 +581,8 @@ void IceRuby::initCommunicator(VALUE iceModule) { rb_define_module_function(iceModule, "initialize", CAST_METHOD(IceRuby_initialize), -1); + rb_define_module_function(iceModule, "identityToString", CAST_METHOD(IceRuby_identityToString), 1); + rb_define_module_function(iceModule, "stringToIdentity", CAST_METHOD(IceRuby_stringToIdentity), 1); _communicatorClass = rb_define_class_under(iceModule, "CommunicatorI", rb_cObject); rb_define_method(_communicatorClass, "destroy", CAST_METHOD(IceRuby_Communicator_destroy), 0); |