diff options
author | Joe George <joe@zeroc.com> | 2015-12-03 09:45:09 -0500 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2015-12-03 09:45:09 -0500 |
commit | eb1473089bfe9105b3884a490edafeb561df935e (patch) | |
tree | 71249e567e5dc11b26b27543083d1ec5c5585037 /cpp/src/Slice/Parser.cpp | |
parent | C++11 mapping: update & timeout tests (diff) | |
download | ice-eb1473089bfe9105b3884a490edafeb561df935e.tar.bz2 ice-eb1473089bfe9105b3884a490edafeb561df935e.tar.xz ice-eb1473089bfe9105b3884a490edafeb561df935e.zip |
ICE-6897 - Add delegate metadata
The "delegate" metadata tag can be applied to interfaces with one
operation. In C++ they are mapped to std::function's, in C# delegates.
In Java we still generate a interface with one operation, which is
a FunctionalInterface.
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index c40ac42c544..02a26d39551 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -415,7 +415,7 @@ Slice::Contained::updateIncludeLevel() bool Slice::Contained::hasMetaData(const string& meta) const -{ +{ return find(_metaData.begin(), _metaData.end(), meta) != _metaData.end(); } @@ -3467,7 +3467,7 @@ Slice::ClassDef::classDataMembers() const if(q) { BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->type()); - if((builtin && builtin->kind() == Builtin::KindObject) || + if((builtin && builtin->kind() == Builtin::KindObject) || (builtin && builtin->kind() == Builtin::KindValue) || ClassDeclPtr::dynamicCast(q->type())) { @@ -3658,6 +3658,11 @@ Slice::ClassDef::compactId() const return _compactId; } +bool +Slice::ClassDef::isDelegate() const +{ + return isLocal() && isInterface() && hasMetaData("delegate") && allOperations().size() == 1; +} Slice::ClassDef::ClassDef(const ContainerPtr& container, const string& name, int id, bool intf, const ClassList& bases, bool local) : SyntaxTreeBase(container->unit()), |