diff options
author | Michi Henning <michi@zeroc.com> | 2004-08-19 01:45:17 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2004-08-19 01:45:17 +0000 |
commit | 99e9a6d48cc3caf3f450afbfda2fe00a18e62e26 (patch) | |
tree | 43e77608bd2e462e8b958e3cd147046b06073476 /cpp/src/Slice/Parser.cpp | |
parent | makefile fix (diff) | |
download | ice-99e9a6d48cc3caf3f450afbfda2fe00a18e62e26.tar.bz2 ice-99e9a6d48cc3caf3f450afbfda2fe00a18e62e26.tar.xz ice-99e9a6d48cc3caf3f450afbfda2fe00a18e62e26.zip |
Changed slice2cs to avoid generating unnecessary empty namespaces.
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 20b4f2aeb21..3f1fd5ec1a5 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1315,6 +1315,69 @@ Slice::Container::hasNonLocalClassDecls() const } bool +Slice::Container::hasNonLocalInterfaceDefs() const +{ + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p); + if(cl && !cl->isLocal() && cl->isInterface()) + { + return true; + } + + ContainerPtr container = ContainerPtr::dynamicCast(*p); + if(container && container->hasNonLocalInterfaceDefs()) + { + return true; + } + } + + return false; +} + +bool +Slice::Container::hasNonLocalSequences() const +{ + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + SequencePtr s = SequencePtr::dynamicCast(*p); + if(s && !s->isLocal()) + { + return true; + } + + ContainerPtr container = ContainerPtr::dynamicCast(*p); + if(container && container->hasNonLocalSequences()) + { + return true; + } + } + + return false; +} + +bool +Slice::Container::hasNonLocalDictionaries() const +{ + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + DictionaryPtr d = DictionaryPtr::dynamicCast(*p); + if(d && !d->isLocal()) + { + return true; + } + + ContainerPtr container = ContainerPtr::dynamicCast(*p); + if(container && container->hasNonLocalDictionaries()) + { + return true; + } + } + + return false; +} + +bool Slice::Container::hasClassDecls() const { for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) @@ -1355,6 +1418,27 @@ Slice::Container::hasClassDefs() const } bool +Slice::Container::hasAbstractClassDefs() const +{ + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + ClassDefPtr cl = ClassDefPtr::dynamicCast(*p); + if(cl && cl->isAbstract()) + { + return true; + } + + ContainerPtr container = ContainerPtr::dynamicCast(*p); + if(container && container->hasAbstractClassDefs()) + { + return true; + } + } + + return false; +} + +bool Slice::Container::hasDataOnlyClasses() const { for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) @@ -1449,6 +1533,39 @@ Slice::Container::hasContentsWithMetaData(const string& meta) const return false; } +bool +Slice::Container::hasAsyncOps() const +{ + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + ClassDefPtr cl = ClassDefPtr::dynamicCast(*p); + if(cl && !cl->isLocal()) + { + OperationList ops = cl->operations(); + if(!ops.empty() && (cl->hasMetaData("ami") || cl->hasMetaData("amd"))) + { + return true; + } + for(OperationList::const_iterator i = ops.begin(); i != ops.end(); ++i) + { + OperationPtr op = *i; + if(op->hasMetaData("ami") || op->hasMetaData("amd")) + { + return true; + } + } + } + + ContainerPtr container = ContainerPtr::dynamicCast(*p); + if(container && container->hasAsyncOps()) + { + return true; + } + } + + return false; +} + string Slice::Container::thisScope() const { |