summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/RubyUtil.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2012-05-16 16:05:50 -0700
committerMark Spruiell <mes@zeroc.com>2012-05-16 16:05:50 -0700
commit3b6fbd2cb1ab0e9f6dbdfd4cbda02eb16fd85569 (patch)
treeedfa533e67fb4ee003d1afbb2e1ba8a9b03ef3f3 /cpp/src/Slice/RubyUtil.cpp
parentporting ami test changes to python (diff)
downloadice-3b6fbd2cb1ab0e9f6dbdfd4cbda02eb16fd85569.tar.bz2
ice-3b6fbd2cb1ab0e9f6dbdfd4cbda02eb16fd85569.tar.xz
ice-3b6fbd2cb1ab0e9f6dbdfd4cbda02eb16fd85569.zip
* Ruby port of sliced/compact/preserved
* Python clean up * More changes to exceptions test
Diffstat (limited to 'cpp/src/Slice/RubyUtil.cpp')
-rwxr-xr-xcpp/src/Slice/RubyUtil.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp
index 4d941c7c6a8..c9a3bae5820 100755
--- a/cpp/src/Slice/RubyUtil.cpp
+++ b/cpp/src/Slice/RubyUtil.cpp
@@ -607,7 +607,9 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_classHistory.insert(scoped); // Avoid redundant declarations.
bool isAbstract = p->isInterface() || p->allOperations().size() > 0; // Don't use isAbstract() here - see bug 3739
- _out << sp << nl << "T_" << name << ".defineClass(" << name << ", " << (isAbstract ? "true" : "false") << ", ";
+ const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice");
+ _out << sp << nl << "T_" << name << ".defineClass(" << name << ", " << (isAbstract ? "true" : "false") << ", "
+ << (preserved ? "true" : "false") << ", ";
if(!base)
{
_out << "nil";
@@ -675,7 +677,7 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// Define each operation. The arguments to __defineOperation are:
//
- // 'opName', Mode, [InParams], [OutParams], ReturnType, [Exceptions]
+ // 'opName', Mode, IsAmd, FormatType, [InParams], [OutParams], ReturnType, [Exceptions]
//
// where InParams and OutParams are arrays of type descriptions, and Exceptions
// is an array of exception types.
@@ -694,6 +696,19 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
ParamDeclList params = (*s)->parameters();
ParamDeclList::iterator t;
int count;
+ string format;
+ switch((*s)->format())
+ {
+ case DefaultFormat:
+ format = "nil";
+ break;
+ case CompactFormat:
+ format = "::Ice::FormatType::CompactFormat";
+ break;
+ case SlicedFormat:
+ format = "::Ice::FormatType::SlicedFormat";
+ break;
+ }
_out << nl << name << "_mixin::OP_" << (*s)->name() << " = ::Ice::__defineOperation('"
<< (*s)->name() << "', ";
@@ -722,7 +737,8 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << "::Ice::OperationMode::Idempotent";
break;
}
- _out << ", " << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "true" : "false") << ", [";
+ _out << ", " << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "true" : "false") << ", " << format
+ << ", [";
for(t = params.begin(), count = 0; t != params.end(); ++t)
{
if(!(*t)->isOutParam())