aboutsummaryrefslogtreecommitdiffstats
path: root/abstractmetalang.cpp
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2009-10-30 17:01:22 -0200
committerHugo Lima <hugo.lima@openbossa.org>2009-10-30 19:46:06 -0200
commitfd82ee68418264b9b88f1c32411b8c6bbcc03c76 (patch)
tree59dbfbcf852f26d6429cb42a23dce9bff6840324 /abstractmetalang.cpp
parent5ccbce7a917a2a602ad1fa32d8682afe32dd68bc (diff)
Added convenience method AbstractMetaClass::findFunction.
This function returns the first AbstractMetaFunction found with a given name or a null pointer if no functions were found.
Diffstat (limited to 'abstractmetalang.cpp')
-rw-r--r--abstractmetalang.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/abstractmetalang.cpp b/abstractmetalang.cpp
index ccb7352a4..351abea06 100644
--- a/abstractmetalang.cpp
+++ b/abstractmetalang.cpp
@@ -1323,10 +1323,16 @@ void AbstractMetaClass::setBaseClass(AbstractMetaClass *baseClass)
bool AbstractMetaClass::hasFunction(const QString &str) const
{
- foreach (const AbstractMetaFunction *f, functions())
- if (f->name() == str)
- return true;
- return false;
+ return findFunction(str);
+}
+
+const AbstractMetaFunction* AbstractMetaClass::findFunction(const QString& functionName) const
+{
+ foreach (const AbstractMetaFunction *f, functions()) {
+ if (f->name() == functionName)
+ return f;
+ }
+ return 0;
}
/* Returns true if this class has one or more functions that are