summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/PythonUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r--cpp/src/Slice/PythonUtil.cpp47
1 files changed, 10 insertions, 37 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp
index 262f104c2bb..88f3aff1772 100644
--- a/cpp/src/Slice/PythonUtil.cpp
+++ b/cpp/src/Slice/PythonUtil.cpp
@@ -13,7 +13,7 @@
#include <IceUtil/IceUtil.h>
#include <IceUtil/StringUtil.h>
#include <IceUtil/InputUtil.h>
-#include <IceUtil/Unicode.h>
+#include <IceUtil/StringConverter.h>
#include <climits>
#include <iterator>
@@ -211,22 +211,7 @@ u32CodePoint(unsigned int value)
void
writeU8Buffer(const vector<unsigned char>& u8buffer, ostringstream& out)
{
- vector<unsigned int> u32buffer;
- IceUtilInternal::ConversionResult result = convertUTF8ToUTF32(u8buffer, u32buffer, IceUtil::lenientConversion);
- switch(result)
- {
- case conversionOK:
- break;
- case sourceExhausted:
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "string source exhausted");
- case sourceIllegal:
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "string source illegal");
- default:
- {
- assert(0);
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__);
- }
- }
+ vector<unsigned int> u32buffer = toUTF32(u8buffer);
for(vector<unsigned int>::const_iterator c = u32buffer.begin(); c != u32buffer.end(); ++c)
{
@@ -772,7 +757,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "uncheckedCast = staticmethod(uncheckedCast)";
- //
+ //
// ice_staticId
//
_out << sp << nl << "def ice_staticId():";
@@ -781,7 +766,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out.dec();
_out << nl << "ice_staticId = staticmethod(ice_staticId)";
- _out.dec();
+ _out.dec();
_out << sp << nl << "_M_" << prxType << " = IcePy.defineProxy('" << scoped << "', " << prxName << ")";
}
@@ -1102,9 +1087,9 @@ Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
_out << sp << nl << "__repr__ = __str__";
//
- // _ice_name
+ // _ice_id
//
- _out << sp << nl << "_ice_name = '" << scoped.substr(2) << "'";
+ _out << sp << nl << "_ice_id = '" << scoped << "'";
_out.dec();
@@ -1651,6 +1636,7 @@ Slice::Python::CodeVisitor::writeType(const TypePtr& p)
break;
}
case Builtin::KindObject:
+ case Builtin::KindValue:
{
_out << "IcePy._t_Object";
break;
@@ -1714,6 +1700,7 @@ Slice::Python::CodeVisitor::writeInitializer(const DataMemberPtr& m)
_out << "''";
break;
}
+ case Builtin::KindValue:
case Builtin::KindObject:
case Builtin::KindObjectProxy:
case Builtin::KindLocalObject:
@@ -1934,22 +1921,7 @@ Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const Syntax
vector<unsigned int> u32buffer;
u32buffer.push_back(static_cast<unsigned int>(v));
- vector<unsigned char> u8buffer;
- IceUtilInternal::ConversionResult result = convertUTF32ToUTF8(u32buffer, u8buffer, IceUtil::lenientConversion);
- switch(result)
- {
- case conversionOK:
- break;
- case sourceExhausted:
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "string source exhausted");
- case sourceIllegal:
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "string source illegal");
- default:
- {
- assert(0);
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__);
- }
- }
+ vector<unsigned char> u8buffer = fromUTF32(u32buffer);
ostringstream s;
for(vector<unsigned char>::const_iterator q = u8buffer.begin(); q != u8buffer.end(); ++q)
@@ -2143,6 +2115,7 @@ Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const Syntax
}
break;
}
+ case Slice::Builtin::KindValue:
case Slice::Builtin::KindObject:
case Slice::Builtin::KindObjectProxy:
case Slice::Builtin::KindLocalObject: