From e283494c906ffac2be14f38422934921ea6ae307 Mon Sep 17 00:00:00 2001 From: Jose Date: Tue, 1 Mar 2016 14:33:27 +0100 Subject: Ice::identityToString/Ice::stringToIdentity php/ruby/python implementations --- python/modules/IcePy/Communicator.cpp | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'python/modules/IcePy/Communicator.cpp') diff --git a/python/modules/IcePy/Communicator.cpp b/python/modules/IcePy/Communicator.cpp index 919086d9ae8..550b0fef0ff 100644 --- a/python/modules/IcePy/Communicator.cpp +++ b/python/modules/IcePy/Communicator.cpp @@ -1715,3 +1715,52 @@ IcePy::getCommunicatorWrapper(const Ice::CommunicatorPtr& communicator) Py_INCREF(obj->wrapper); return obj->wrapper; } + +extern "C" +PyObject* +IcePy_identityToString(PyObject* /*self*/, PyObject* obj) +{ + Ice::Identity id; + if(!getIdentity(obj, id)) + { + return 0; + } + + string str; + + try + { + str = Ice::identityToString(id); + } + catch(const Ice::Exception& ex) + { + setPythonException(ex); + return 0; + } + + return createString(str); +} + +extern "C" +PyObject* +IcePy_stringToIdentity(PyObject* /*self*/, PyObject* obj) +{ + string str; + if(!getStringArg(obj, "str", str)) + { + return 0; + } + + Ice::Identity id; + try + { + id = Ice::stringToIdentity(str); + } + catch(const Ice::Exception& ex) + { + setPythonException(ex); + return 0; + } + + return createIdentity(id); +} -- cgit v1.2.3