summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Checksum.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2013-07-25 15:51:53 -0700
committerMark Spruiell <mes@zeroc.com>2013-07-25 15:51:53 -0700
commit5a7c1e3cff5e19e14d6cee4a57c0698cc6c3ce43 (patch)
tree437a2e6153c2b81a7b70a8063e3302d1f833e056 /cpp/src/Slice/Checksum.cpp
parentMinor fix to ABI compliance checker script. (diff)
downloadice-5a7c1e3cff5e19e14d6cee4a57c0698cc6c3ce43.tar.bz2
ice-5a7c1e3cff5e19e14d6cee4a57c0698cc6c3ce43.tar.xz
ice-5a7c1e3cff5e19e14d6cee4a57c0698cc6c3ce43.zip
ICE-5313 - more fixes for checksums
Diffstat (limited to 'cpp/src/Slice/Checksum.cpp')
-rw-r--r--cpp/src/Slice/Checksum.cpp59
1 files changed, 40 insertions, 19 deletions
diff --git a/cpp/src/Slice/Checksum.cpp b/cpp/src/Slice/Checksum.cpp
index 78406e41e86..47532688d85 100644
--- a/cpp/src/Slice/Checksum.cpp
+++ b/cpp/src/Slice/Checksum.cpp
@@ -66,23 +66,19 @@ Slice::ChecksumVisitor::visitClassDefStart(const ClassDefPtr& p)
{
ostr << "class ";
}
-
+
+ ostr << p->name();
+
if(p->compactId() >= 0)
{
- ostr << "(" << p->compactId() << ") ";
+ ostr << '(' << p->compactId() << ')';
}
-
- ostr << p->name();
if(!bases.empty())
{
if(!bases.front()->isInterface())
{
ostr << " extends " << bases.front()->scoped();
- if(bases.front()->compactId() >= 0)
- {
- ostr << "(" << bases.front()->compactId() << ") ";
- }
bases.erase(bases.begin());
}
if(!bases.empty())
@@ -102,10 +98,6 @@ Slice::ChecksumVisitor::visitClassDefStart(const ClassDefPtr& p)
ostr << ", ";
}
ostr << (*q)->scoped();
- if((*q)->compactId() >= 0)
- {
- ostr << "(" << (*q)->compactId() << ") ";
- }
}
}
}
@@ -126,7 +118,7 @@ Slice::ChecksumVisitor::visitClassDefStart(const ClassDefPtr& p)
ostr << typeToString((*q)->type()) << ' ' << (*q)->name() << endl;
}
}
-
+
if(!optionals.empty())
{
//
@@ -181,7 +173,7 @@ Slice::ChecksumVisitor::visitClassDefStart(const ClassDefPtr& p)
ostr << typeToString((*r)->type()) << ' ' << (*r)->name();
}
}
-
+
if(!optionals.empty())
{
//
@@ -196,7 +188,7 @@ Slice::ChecksumVisitor::visitClassDefStart(const ClassDefPtr& p)
}
};
optionals.sort(SortFn::compare);
-
+
for(ParamDeclList::iterator r = optionals.begin(); r != optionals.end(); ++r)
{
if(r != optionals.begin() || params.size() > optionals.size())
@@ -210,7 +202,7 @@ Slice::ChecksumVisitor::visitClassDefStart(const ClassDefPtr& p)
ostr << typeToString((*r)->type()) << ' ' << (*r)->tag() << ' ' << (*r)->name();
}
}
-
+
ostr << ')';
ExceptionList ex = (*q)->throws();
if(!ex.empty())
@@ -254,9 +246,38 @@ Slice::ChecksumVisitor::visitExceptionStart(const ExceptionPtr& p)
ostr << endl;
DataMemberList members = p->dataMembers();
+ DataMemberList optionals;
for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
{
- ostr << typeToString((*q)->type()) << ' ' << (*q)->name() << endl;
+ if((*q)->optional())
+ {
+ optionals.push_back(*q);
+ }
+ else
+ {
+ ostr << typeToString((*q)->type()) << ' ' << (*q)->name() << endl;
+ }
+ }
+
+ if(!optionals.empty())
+ {
+ //
+ // Sort optional parameters by tag.
+ //
+ class SortFn
+ {
+ public:
+ static bool compare(const DataMemberPtr& lhs, const DataMemberPtr& rhs)
+ {
+ return lhs->tag() < rhs->tag();
+ }
+ };
+ optionals.sort(SortFn::compare);
+
+ for(DataMemberList::iterator q = optionals.begin(); q != optionals.end(); ++q)
+ {
+ ostr << typeToString((*q)->type()) << ' ' << (*q)->tag() << ' ' << (*q)->name();
+ }
}
updateMap(p->scoped(), ostr.str());
@@ -325,12 +346,12 @@ Slice::ChecksumVisitor::visitEnum(const EnumPtr& p)
ostringstream ostr;
ostr << "enum " << p->name() << endl;
-
+
//
// Check if any of the enumerators were assigned an explicit value.
//
const bool explicitValue = p->explicitValue();
-
+
EnumeratorList enums = p->getEnumerators();
if(explicitValue)
{