summaryrefslogtreecommitdiff
path: root/cpp/src/slice2java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2017-03-29 20:43:52 -0400
committerBernard Normier <bernard@zeroc.com>2017-03-29 20:43:52 -0400
commit9ce3150693623af3331061d29672cd44fdef7dc4 (patch)
treef46ca87aadb9a99ed7e7a86bcd18ed6b3c63b5c9 /cpp/src/slice2java
parentICE-7716 - PHP5 fixes (diff)
downloadice-9ce3150693623af3331061d29672cd44fdef7dc4.tar.bz2
ice-9ce3150693623af3331061d29672cd44fdef7dc4.tar.xz
ice-9ce3150693623af3331061d29672cd44fdef7dc4.zip
Removed trailing whitespace from Slice files and generated code
Diffstat (limited to 'cpp/src/slice2java')
-rw-r--r--cpp/src/slice2java/Gen.cpp22
-rw-r--r--cpp/src/slice2java/GenCompat.cpp70
2 files changed, 70 insertions, 22 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 4ab41ebefc0..24f3a7e2957 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -1971,12 +1971,28 @@ Slice::JavaVisitor::writeDocCommentLines(Output& out, const string& text)
start = pos + 1;
while((pos = text.find_first_of(ws, start)) != string::npos)
{
- out << nl << " * " << IceUtilInternal::trim(text.substr(start, pos - start));
+ string line = IceUtilInternal::trim(text.substr(start, pos - start));
+ if(line.empty())
+ {
+ out << nl << " *";
+ }
+ else
+ {
+ out << nl << " * " << line;
+ }
start = pos + 1;
}
if(start < text.size())
{
- out << nl << " * " << IceUtilInternal::trim(text.substr(start));
+ string line = IceUtilInternal::trim(text.substr(start));
+ if(line.empty())
+ {
+ out << nl << " *";
+ }
+ else
+ {
+ out << nl << " * " << line;
+ }
}
}
}
@@ -3601,7 +3617,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << eb;
out << eb;
- out << nl << nl << "private static final " << name << " _nullMarshalValue = new " << name << "();";
+ out << sp << nl << "private static final " << name << " _nullMarshalValue = new " << name << "();";
}
out << sp << nl << "public static final long serialVersionUID = ";
diff --git a/cpp/src/slice2java/GenCompat.cpp b/cpp/src/slice2java/GenCompat.cpp
index 02a3256c840..ff344f57bf8 100644
--- a/cpp/src/slice2java/GenCompat.cpp
+++ b/cpp/src/slice2java/GenCompat.cpp
@@ -175,10 +175,13 @@ writeParamList(Output& out, vector<string> params, bool end = true, bool newLine
out << (*i);
if(++i != params.end() || !end)
{
- out << ", ";
if(newLine)
{
- out << nl;
+ out << "," << nl;
+ }
+ else
+ {
+ out << ", ";
}
}
}
@@ -1983,7 +1986,6 @@ Slice::JavaCompatVisitor::writeDocCommentOp(Output& out, const OperationPtr& p)
return;
}
-
out << sp << nl << "/**";
//
@@ -1992,7 +1994,11 @@ Slice::JavaCompatVisitor::writeDocCommentOp(Output& out, const OperationPtr& p)
bool done = false;
for(StringList::const_iterator i = lines.begin(); i != lines.end() && !done; ++i)
{
- if((*i)[0] == '@')
+ if((*i).empty())
+ {
+ out << nl << " *";
+ }
+ else if((*i)[0] == '@')
{
done = true;
}
@@ -2012,7 +2018,7 @@ Slice::JavaCompatVisitor::writeDocCommentOp(Output& out, const OperationPtr& p)
void
Slice::JavaCompatVisitor::writeDocCommentAsync(Output& out, const OperationPtr& p, ParamDir paramType,
- const string& extraParam)
+ const string& extraParam)
{
ContainerPtr container = p->container();
ClassDefPtr contained = ClassDefPtr::dynamicCast(container);
@@ -2049,13 +2055,17 @@ Slice::JavaCompatVisitor::writeDocCommentAsync(Output& out, const OperationPtr&
}
else
{
- if((*i)[0] == '@')
+ if((*i).empty())
+ {
+ out << nl << " *";
+ }
+ else if((*i)[0] == '@')
{
doneReturn = true;
}
else
{
- out << nl << " * " << *i;
+ out << nl << *i;
}
}
}
@@ -2068,7 +2078,11 @@ Slice::JavaCompatVisitor::writeDocCommentAsync(Output& out, const OperationPtr&
bool done = false;
for(StringList::const_iterator i = lines.begin(); i != lines.end() && !done; ++i)
{
- if((*i)[0] == '@')
+ if((*i).empty())
+ {
+ out << nl << " *";
+ }
+ else if((*i)[0] == '@')
{
done = true;
}
@@ -2123,7 +2137,11 @@ Slice::JavaCompatVisitor::writeDocCommentAMI(Output& out, const OperationPtr& p,
bool done = false;
for(StringList::const_iterator i = lines.begin(); i != lines.end() && !done; ++i)
{
- if((*i)[0] == '@')
+ if((*i).empty())
+ {
+ out << nl << " *";
+ }
+ else if((*i)[0] == '@')
{
done = true;
}
@@ -2194,7 +2212,14 @@ Slice::JavaCompatVisitor::writeDocCommentAMI(Output& out, const OperationPtr& p,
if(found)
{
- out << nl << " * " << *i;
+ if((*i).empty())
+ {
+ out << nl << " *";
+ }
+ else
+ {
+ out << nl << " * " << *i;
+ }
}
}
}
@@ -2250,7 +2275,7 @@ Slice::JavaCompatVisitor::writeDocCommentParam(Output& out, const OperationPtr&
{
out << nl << " * " << line;
StringList::const_iterator j;
- if (i == lines.end())
+ if(i == lines.end())
{
break;
}
@@ -2260,7 +2285,15 @@ Slice::JavaCompatVisitor::writeDocCommentParam(Output& out, const OperationPtr&
if((*j)[0] != '@')
{
i = j;
- out << nl << " * " << *j++;
+ if((*j).empty())
+ {
+ out << nl << " *";
+ }
+ else
+ {
+ out << nl << " * " << *j;
+ }
+ j++;
}
else
{
@@ -2768,7 +2801,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << "public abstract ";
}
- out << nl << "Ice.AsyncResult begin_" << opname;
+ out << "Ice.AsyncResult begin_" << opname;
writeParamList(out, getParamsAsyncLambda(op, package, false, true));
out << ';';
@@ -3741,7 +3774,7 @@ Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p)
out << nl << "return v;";
out << eb;
- out << nl << nl << "private static final " << name << " _nullMarshalValue = new " << name << "();";
+ out << sp << nl << "private static final " << name << " _nullMarshalValue = new " << name << "();";
}
out << sp << nl << "public static final long serialVersionUID = ";
@@ -4094,7 +4127,7 @@ Slice::GenCompat::TypesVisitor::visitEnum(const EnumPtr& p)
{
out << ',';
}
- out << nl;
+ out << sp;
writeDocComment(out, *en, getDeprecateReason(*en, 0, "enumerator"));
out << nl << fixKwd((*en)->name()) << '(' << (*en)->value() << ')';
}
@@ -5249,10 +5282,9 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
const string baseClass = getAsyncCallbackBaseClass(op, true);
out << nl << "return _iceI_begin_" << op->name();
- writeParamList(out, params, false, false);
- out << nl
- << (throws.empty() ? "new " + baseClass + "(responseCb, exceptionCb, sentCb)" :
- "new " + baseClass + "(responseCb, userExceptionCb, exceptionCb, sentCb)");
+ writeParamList(out, params, false);
+ out << (throws.empty() ? "new " + baseClass + "(responseCb, exceptionCb, sentCb)" :
+ "new " + baseClass + "(responseCb, userExceptionCb, exceptionCb, sentCb)");
out.inc();
out << sb;
out << nl << "public final void _iceCompleted(Ice.AsyncResult result)";