summaryrefslogtreecommitdiff
path: root/cpp/src/slice2java/Gen.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2013-08-16 14:41:10 -0700
committerMark Spruiell <mes@zeroc.com>2013-08-16 14:41:10 -0700
commitc4eec95d72af43d652971d84109494b1ccdf5fa5 (patch)
tree3f5fd31c4fdfdad14350b59a511fbf6610c21620 /cpp/src/slice2java/Gen.cpp
parentRPM fixes for SLES (diff)
downloadice-c4eec95d72af43d652971d84109494b1ccdf5fa5.tar.bz2
ice-c4eec95d72af43d652971d84109494b1ccdf5fa5.tar.xz
ice-c4eec95d72af43d652971d84109494b1ccdf5fa5.zip
ICE-5168 - generate helper for optional format
Diffstat (limited to 'cpp/src/slice2java/Gen.cpp')
-rw-r--r--cpp/src/slice2java/Gen.cpp50
1 files changed, 39 insertions, 11 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index fa2f0781a0e..6365fea3d43 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -4585,8 +4585,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "return __d;";
out << eb;
- out << sp << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, " << contextParam
- << ')';
+ out << sp << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, " << contextParam << ')';
out << sb;
out << nl << name << "Prx __d = null;";
out << nl << "if(__obj != null)";
@@ -4763,6 +4762,11 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << eb;
out << nl << "return null;";
out << eb;
+
+ out << sp << nl << "public static Ice.OptionalFormat optionalFormat()";
+ out << sb;
+ out << nl << "return Ice.OptionalFormat.FSize;";
+ out << eb;
}
//
@@ -4795,6 +4799,11 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out2 << nl << "__inS.readObject(__h);";
out2 << eb;
+ out2 << sp << nl << "public static Ice.OptionalFormat optionalFormat()";
+ out2 << sb;
+ out2 << nl << "return " << getOptionalFormat(p->declaration()) << ';';
+ out2 << eb;
+
out2 << eb;
close();
}
@@ -4817,18 +4826,23 @@ Slice::Gen::HelperVisitor::visitStructStart(const StructPtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __outS, " << fixedName << " __v)";
+ out << sp << nl << "public static void write(Ice.OutputStream __outS, " << fixedName << " __v)";
out << sb;
out << nl << "__v.ice_write(__outS);";
out << eb;
- out << sp << nl << "public static " << fixedName << nl << "read(Ice.InputStream __inS)";
+ out << sp << nl << "public static " << fixedName << " read(Ice.InputStream __inS)";
out << sb;
out << nl << fixedName << " __v = new " << fixedName << "();";
out << nl << "__v.ice_read(__inS);";
out << nl << "return __v;";
out << eb;
+ out << sp << nl << "public static Ice.OptionalFormat optionalFormat()";
+ out << sb;
+ out << nl << "return " << getOptionalFormat(p) << ';';
+ out << eb;
+
out << eb;
close();
}
@@ -4933,7 +4947,7 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
if(_stream)
{
- out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __outS, " << typeS << " __v)";
+ out << sp << nl << "public static void write(Ice.OutputStream __outS, " << typeS << " __v)";
out << sb;
iter = 0;
writeStreamSequenceMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
@@ -4944,13 +4958,18 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
{
out << nl << "@SuppressWarnings(\"unchecked\")";
}
- out << nl << "public static " << typeS << nl << "read(Ice.InputStream __inS)";
+ out << nl << "public static " << typeS << " read(Ice.InputStream __inS)";
out << sb;
out << nl << typeS << " __v;";
iter = 0;
writeStreamSequenceMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
out << nl << "return __v;";
out << eb;
+
+ out << sp << nl << "public static Ice.OptionalFormat optionalFormat()";
+ out << sb;
+ out << nl << "return " << getOptionalFormat(p) << ';';
+ out << eb;
}
out << eb;
@@ -5003,21 +5022,25 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
if(_stream)
{
- out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __outS, " << formalType
+ out << sp << nl << "public static void write(Ice.OutputStream __outS, " << formalType
<< " __v)";
out << sb;
iter = 0;
writeStreamDictionaryMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
out << eb;
- out << sp << nl << "public static " << formalType
- << nl << "read(Ice.InputStream __inS)";
+ out << sp << nl << "public static " << formalType << " read(Ice.InputStream __inS)";
out << sb;
out << nl << formalType << " __v;";
iter = 0;
writeStreamDictionaryMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
out << nl << "return __v;";
out << eb;
+
+ out << sp << nl << "public static Ice.OptionalFormat optionalFormat()";
+ out << sb;
+ out << nl << "return " << getOptionalFormat(p) << ';';
+ out << eb;
}
out << eb;
@@ -5039,16 +5062,21 @@ Slice::Gen::HelperVisitor::visitEnum(const EnumPtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __outS, " << fixedName << " __v)";
+ out << sp << nl << "public static void write(Ice.OutputStream __outS, " << fixedName << " __v)";
out << sb;
out << nl << "__v.ice_write(__outS);";
out << eb;
- out << sp << nl << "public static " << fixedName << nl << "read(Ice.InputStream __inS)";
+ out << sp << nl << "public static " << fixedName << " read(Ice.InputStream __inS)";
out << sb;
out << nl << "return " << fixedName << ".ice_read(__inS);";
out << eb;
+ out << sp << nl << "public static Ice.OptionalFormat optionalFormat()";
+ out << sb;
+ out << nl << "return " << getOptionalFormat(p) << ';';
+ out << eb;
+
out << eb;
close();
}