summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-05-19 00:54:05 +0000
committerMichi Henning <michi@zeroc.com>2003-05-19 00:54:05 +0000
commitd48f77a15aa2184d048b664d8d0287bfc430e0f8 (patch)
treebd51fe2f8a8d97a0bd3fa78788e154a89450a7cd /cpp/src/Slice/Parser.cpp
parentUse %x to display the date (diff)
downloadice-d48f77a15aa2184d048b664d8d0287bfc430e0f8.tar.bz2
ice-d48f77a15aa2184d048b664d8d0287bfc430e0f8.tar.xz
ice-d48f77a15aa2184d048b664d8d0287bfc430e0f8.zip
- Fixed a bug in the code generator for dictionaries with class values.
- Added more support for Java slicing. - Changed config/Make.rules: "make depend" was calling slice2cpp with ICECPPFLAGS, not SLICE2CPPFLAGS. This meant that "make depend" was invoking slice2cpp with options that were potentially different from those passed for normal compilation of slice files, which could lead to inconsistencies.
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp122
1 files changed, 122 insertions, 0 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 1dcb6218503..7fe8e45200e 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -2233,6 +2233,58 @@ Slice::ClassDef::allDataMembers() const
return result;
}
+DataMemberList
+Slice::ClassDef::classDataMembers() const
+{
+ DataMemberList result;
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ {
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
+ {
+ result.push_back(q);
+ }
+ }
+ }
+ return result;
+}
+
+DataMemberList
+Slice::ClassDef::allClassDataMembers() const
+{
+ DataMemberList result;
+
+ //
+ // Check if we have a base class. If so, recursively
+ // get the class data members of the base(s).
+ //
+ ClassList::const_iterator p = _bases.begin();
+ if(p != _bases.end() && !(*p)->isInterface())
+ {
+ result = (*p)->allClassDataMembers();
+ }
+
+ //
+ // Append this class's class members.
+ //
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ {
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
+ {
+ result.push_back(q);
+ }
+ }
+ }
+ return result;
+}
+
bool
Slice::ClassDef::isAbstract() const
{
@@ -2491,6 +2543,57 @@ Slice::Exception::dataMembers() const
return result;
}
+DataMemberList
+Slice::Exception::classDataMembers() const
+{
+ DataMemberList result;
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ {
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
+ {
+ result.push_back(q);
+ }
+ }
+ }
+ return result;
+}
+
+DataMemberList
+Slice::Exception::allClassDataMembers() const
+{
+ DataMemberList result;
+
+ //
+ // Check if we have a base exception. If so, recursively
+ // get the class data members of the base exception(s).
+ //
+ if(base())
+ {
+ result = base()->allClassDataMembers();
+ }
+
+ //
+ // Append this exception's class members.
+ //
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ {
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
+ {
+ result.push_back(q);
+ }
+ }
+ }
+ return result;
+}
+
ExceptionPtr
Slice::Exception::base() const
{
@@ -2672,6 +2775,25 @@ Slice::Struct::dataMembers() const
return result;
}
+DataMemberList
+Slice::Struct::classDataMembers() const
+{
+ DataMemberList result;
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ {
+ DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
+ if(q)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(q->type()))
+ {
+ result.push_back(q);
+ }
+ }
+ }
+ return result;
+}
+
Contained::ContainedType
Slice::Struct::containedType() const
{