summaryrefslogtreecommitdiffstats
path: root/scripts/templates/qobjectclass.cpp
diff options
context:
space:
mode:
authorSandro S. Andrade <sandroandrade@kde.org>2013-09-02 22:02:41 -0300
committerSandro S. Andrade <sandroandrade@kde.org>2013-09-03 03:04:37 +0200
commita143fe8c5451493b128b4c6f0750f02b58af8666 (patch)
tree4b74787f6ece9256db04dc65002cae749f6936b3 /scripts/templates/qobjectclass.cpp
parent2bfe659e4d30b449747585e18eeb84bfc5d73f43 (diff)
Add initial version of new UML metamodel implementation
Change-Id: Ic29a04dc49fac075d9c736237573b7f4e3da85ef Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'scripts/templates/qobjectclass.cpp')
-rw-r--r--scripts/templates/qobjectclass.cpp85
1 files changed, 85 insertions, 0 deletions
diff --git a/scripts/templates/qobjectclass.cpp b/scripts/templates/qobjectclass.cpp
new file mode 100644
index 00000000..a18284c6
--- /dev/null
+++ b/scripts/templates/qobjectclass.cpp
@@ -0,0 +1,85 @@
+[%- PROCESS common.tmpl -%]
+/****************************************************************************
+**
+** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt${namespace} module of the Qt Toolkit.
+**
+** \$QT_BEGIN_LICENSE:LGPL\$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** \$QT_END_LICENSE\$
+**
+****************************************************************************/
+#include "q${namespace.lower}${className.lower}object_p.h"
+
+#include <Qt${namespace}/Q${namespace}${className}>
+[% SET useNamespace = 'false' -%]
+[%- forwards = [] -%]
+[%- visitedClasses = [] -%]
+[%- GENERATE_FWD_DECLARATIONS(class, visitedClasses, forwards, useNamespace) -%]
+[%- FOREACH forward = forwards.unique.sort -%]
+#include <Qt${namespace}/${forward}>
+[% IF loop.last %]
+[% END -%]
+[%- END -%]
+QT_BEGIN_NAMESPACE
+
+Q${namespace}${className}Object::Q${namespace}${className}Object(Q${namespace}${className} *qModelingObject)
+{
+ setProperty("modelingObject", QVariant::fromValue(qModelingObject));
+}
+
+[%- IF class.findvalue("@isAbstract") != "true" %]
+Q${namespace}${className}Object::~Q${namespace}${className}Object()
+{
+ if (!property("deletingFromModelingObject").isValid()) {
+ qmodelingobjectproperty_cast<Q${namespace}${className} *>(this)->deletingFromQObject = true;
+ delete qmodelingobjectproperty_cast<QUmlComment *>(this);
+ }
+}
+
+[%- END %]
+[%- SET originalClassName = class.findvalue("@name") -%]
+[%- visitedClasses = [] -%]
+[%- redefinedProperties = [] -%]
+[%- POPULATE_REDEFINED_PROPERTIES(class, visitedClasses, redefinedProperties) -%]
+[%- visitedClasses = [] %]
+[% GENERATE_CPP_ATTRIBUTES(originalClassName, class, visitedClasses, redefinedProperties) -%]
+[%- visitedClasses = [] -%]
+[%- redefinedOperations = [] -%]
+[%- POPULATE_REDEFINED_OPERATIONS(class, visitedClasses, redefinedOperations) -%]
+[%- visitedClasses = [] %]
+[%- GENERATE_CPP_OPERATIONS(originalClassName, class, visitedClasses, redefinedOperations) -%]
+[%- visitedClasses = [] %]
+[%- GENERATE_CPP_SLOTS(originalClassName, class, visitedClasses, redefinedProperties) -%]
+QT_END_NAMESPACE
+