summaryrefslogtreecommitdiffstats
path: root/generator.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-10 18:57:40 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2011-02-10 20:51:16 -0200
commit2fa3a9485d45cfa27593848fbcee1b21ed1bfa57 (patch)
treeba3e3fdd444740dc885767368fd84df0f821897b /generator.cpp
parentc306628bd2b06ec5a9a734e33a8d948be1811649 (diff)
downloadgeneratorrunner-2fa3a9485d45cfa27593848fbcee1b21ed1bfa57.tar.gz
generatorrunner-2fa3a9485d45cfa27593848fbcee1b21ed1bfa57.tar.xz
generatorrunner-2fa3a9485d45cfa27593848fbcee1b21ed1bfa57.zip
Add function getClassTargetFullName to get what AbstractMetaClass.fullName would return.
Diffstat (limited to 'generator.cpp')
-rw-r--r--generator.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/generator.cpp b/generator.cpp
index f11eed7..376f560 100644
--- a/generator.cpp
+++ b/generator.cpp
@@ -335,3 +335,29 @@ QString Generator::subDirectoryForPackage(QString packageName) const
return QString(packageName).replace(".", QDir::separator());
}
+template<typename T>
+static QString getClassTargetFullName_(const T* t, bool includePackageName)
+{
+ QString name = t->name();
+ const AbstractMetaClass* context = t->enclosingClass();
+ while (context) {
+ name.prepend('.');
+ name.prepend(context->name());
+ context = context->enclosingClass();
+ }
+ if (includePackageName) {
+ name.prepend('.');
+ name.prepend(t->package());
+ }
+ return name;
+}
+
+QString getClassTargetFullName(const AbstractMetaClass* metaClass, bool includePackageName)
+{
+ return getClassTargetFullName_(metaClass, includePackageName);
+}
+
+QString getClassTargetFullName(const AbstractMetaEnum* metaEnum, bool includePackageName)
+{
+ return getClassTargetFullName_(metaEnum, includePackageName);
+}