From 7774bb92669779fd165a0510a360fdaecd69f0c3 Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Tue, 8 May 2012 18:14:39 -0700 Subject: * C++ implementation for compact/sliced formats * C++ implementation for "preserve-slice" metadata * C++ tests for compact/sliced/preserved types * Updated stream API * Python changes for stream API * Python tests for compact/sliced formats * Added Ice.Default.SlicedFormat property --- cpp/src/Slice/PythonUtil.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'cpp/src/Slice/PythonUtil.cpp') diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 7bdffa8b2c6..fada4154502 100755 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -796,7 +796,8 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) DataMemberList members = p->dataMembers(); _out << sp << nl << "_M_" << type << " = IcePy.defineClass('" << scoped << "', " << name << ", "; writeMetaData(p->getMetaData()); - _out << ", " << (isAbstract ? "True" : "False") << ", "; + _out << ", " << (isAbstract ? "True" : "False") << ", " << (p->hasMetaData("preserve-slice") ? "True" : "False") + << ", "; if(!base) { _out << "None"; @@ -890,10 +891,24 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) ParamDeclList params = (*s)->parameters(); ParamDeclList::iterator t; int count; + string format; + switch((*s)->format()) + { + case DefaultFormat: + format = "None"; + break; + case CompactFormat: + format = "Ice.FormatType.CompactFormat"; + break; + case SlicedFormat: + format = "Ice.FormatType.SlicedFormat"; + break; + } _out << nl << name << "._op_" << (*s)->name() << " = IcePy.Operation('" << (*s)->name() << "', " << getOperationMode((*s)->mode()) << ", " << getOperationMode((*s)->sendMode()) << ", " - << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "True" : "False") << ", "; + << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "True" : "False") << ", " + << format << ", "; writeMetaData((*s)->getMetaData()); _out << ", ("; for(t = params.begin(), count = 0; t != params.end(); ++t) @@ -1091,7 +1106,7 @@ Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p) string type = getAbsolute(p, "_t_"); _out << sp << nl << "_M_" << type << " = IcePy.defineException('" << scoped << "', " << name << ", "; writeMetaData(p->getMetaData()); - _out << ", "; + _out << ", " << (p->hasMetaData("preserve-slice") ? "True" : "False") << ", "; if(!base) { _out << "None"; -- cgit v1.2.3