summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CsUtil.cpp
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2015-12-03 09:45:09 -0500
committerJoe George <joe@zeroc.com>2015-12-03 09:45:09 -0500
commiteb1473089bfe9105b3884a490edafeb561df935e (patch)
tree71249e567e5dc11b26b27543083d1ec5c5585037 /cpp/src/Slice/CsUtil.cpp
parentC++11 mapping: update & timeout tests (diff)
downloadice-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/CsUtil.cpp')
-rw-r--r--cpp/src/Slice/CsUtil.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index ac8f3d05e57..d02f8bdfd13 100644
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -1179,7 +1179,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
<< "> e__ = " << param << ".GetEnumerator();";
out << nl << "while(e__.MoveNext())";
out << sb;
- string func = (builtin->kind() == Builtin::KindObject ||
+ string func = (builtin->kind() == Builtin::KindObject ||
builtin->kind() == Builtin::KindValue) ? "writeObject" : "writeProxy";
out << nl << stream << '.' << func << "(e__.Current);";
out << eb;
@@ -2639,5 +2639,19 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont)
_history.insert(s);
}
}
+
+ if(_history.count(s) == 0)
+ {
+ if(s == "delegate")
+ {
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(cont);
+ if(cl && cl->isDelegate())
+ {
+ continue;
+ }
+ emitWarning(cont->file(), cont->line(), msg + " `" + s + "'");
+ _history.insert(s);
+ }
+ }
}
}