annotate generator/prigenerator.cpp @ 374:681af90e1d53

Removed debug writelns. Fixed build script.
author Max Samukha <maxter@spambox.com>
date Thu, 08 Jul 2010 22:21:56 +0300
parents 1349940724eb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
e78566595089 initial import
mandel
parents:
diff changeset
1 /****************************************************************************
e78566595089 initial import
mandel
parents:
diff changeset
2 **
e78566595089 initial import
mandel
parents:
diff changeset
3 ** Copyright (C) 1992-2008 Nokia. All rights reserved.
e78566595089 initial import
mandel
parents:
diff changeset
4 **
e78566595089 initial import
mandel
parents:
diff changeset
5 ** This file is part of Qt Jambi.
e78566595089 initial import
mandel
parents:
diff changeset
6 **
e78566595089 initial import
mandel
parents:
diff changeset
7 ** * Commercial Usage
e78566595089 initial import
mandel
parents:
diff changeset
8 * Licensees holding valid Qt Commercial licenses may use this file in
e78566595089 initial import
mandel
parents:
diff changeset
9 * accordance with the Qt Commercial License Agreement provided with the
e78566595089 initial import
mandel
parents:
diff changeset
10 * Software or, alternatively, in accordance with the terms contained in
e78566595089 initial import
mandel
parents:
diff changeset
11 * a written agreement between you and Nokia.
e78566595089 initial import
mandel
parents:
diff changeset
12 *
e78566595089 initial import
mandel
parents:
diff changeset
13 *
e78566595089 initial import
mandel
parents:
diff changeset
14 * GNU General Public License Usage
e78566595089 initial import
mandel
parents:
diff changeset
15 * Alternatively, this file may be used under the terms of the GNU
e78566595089 initial import
mandel
parents:
diff changeset
16 * General Public License versions 2.0 or 3.0 as published by the Free
e78566595089 initial import
mandel
parents:
diff changeset
17 * Software Foundation and appearing in the file LICENSE.GPL included in
e78566595089 initial import
mandel
parents:
diff changeset
18 * the packaging of this file. Please review the following information
e78566595089 initial import
mandel
parents:
diff changeset
19 * to ensure GNU General Public Licensing requirements will be met:
e78566595089 initial import
mandel
parents:
diff changeset
20 * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
e78566595089 initial import
mandel
parents:
diff changeset
21 * http://www.gnu.org/copyleft/gpl.html. In addition, as a special
e78566595089 initial import
mandel
parents:
diff changeset
22 * exception, Nokia gives you certain additional rights. These rights
e78566595089 initial import
mandel
parents:
diff changeset
23 * are described in the Nokia Qt GPL Exception version 1.2, included in
e78566595089 initial import
mandel
parents:
diff changeset
24 * the file GPL_EXCEPTION.txt in this package.
e78566595089 initial import
mandel
parents:
diff changeset
25 *
e78566595089 initial import
mandel
parents:
diff changeset
26 * Qt for Windows(R) Licensees
e78566595089 initial import
mandel
parents:
diff changeset
27 * As a special exception, Nokia, as the sole copyright holder for Qt
e78566595089 initial import
mandel
parents:
diff changeset
28 * Designer, grants users of the Qt/Eclipse Integration plug-in the
e78566595089 initial import
mandel
parents:
diff changeset
29 * right for the Qt/Eclipse Integration to link to functionality
e78566595089 initial import
mandel
parents:
diff changeset
30 * provided by Qt Designer and its related libraries.
e78566595089 initial import
mandel
parents:
diff changeset
31 *
e78566595089 initial import
mandel
parents:
diff changeset
32 *
e78566595089 initial import
mandel
parents:
diff changeset
33 * If you are unsure which license is appropriate for your use, please
e78566595089 initial import
mandel
parents:
diff changeset
34 * contact the sales department at qt-sales@nokia.com.
e78566595089 initial import
mandel
parents:
diff changeset
35
e78566595089 initial import
mandel
parents:
diff changeset
36 **
e78566595089 initial import
mandel
parents:
diff changeset
37 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
e78566595089 initial import
mandel
parents:
diff changeset
38 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
e78566595089 initial import
mandel
parents:
diff changeset
39 **
e78566595089 initial import
mandel
parents:
diff changeset
40 ****************************************************************************/
e78566595089 initial import
mandel
parents:
diff changeset
41
e78566595089 initial import
mandel
parents:
diff changeset
42 #include "prigenerator.h"
e78566595089 initial import
mandel
parents:
diff changeset
43 #include "reporthandler.h"
e78566595089 initial import
mandel
parents:
diff changeset
44 #include "fileout.h"
e78566595089 initial import
mandel
parents:
diff changeset
45
238
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
46 void PriGenerator::addHeader(QString package, const QString &header)
1
e78566595089 initial import
mandel
parents:
diff changeset
47 {
238
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
48 priHash[package.replace(".", "_")].headers << header;
1
e78566595089 initial import
mandel
parents:
diff changeset
49 }
e78566595089 initial import
mandel
parents:
diff changeset
50
238
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
51 void PriGenerator::addSource(QString package, const QString &source)
1
e78566595089 initial import
mandel
parents:
diff changeset
52 {
238
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
53 priHash[package.replace(".", "_")].sources << source;
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
54 }
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
55
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
56 void PriGenerator::addClass(QString package, const QString &class_name)
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
57 {
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
58 priHash[package.replace(".", "_")].classes << class_name;
1
e78566595089 initial import
mandel
parents:
diff changeset
59 }
e78566595089 initial import
mandel
parents:
diff changeset
60
e78566595089 initial import
mandel
parents:
diff changeset
61 void PriGenerator::generate()
e78566595089 initial import
mandel
parents:
diff changeset
62 {
e78566595089 initial import
mandel
parents:
diff changeset
63 QHashIterator<QString, Pri> pri(priHash);
e78566595089 initial import
mandel
parents:
diff changeset
64 while (pri.hasNext()) {
e78566595089 initial import
mandel
parents:
diff changeset
65 pri.next();
e78566595089 initial import
mandel
parents:
diff changeset
66
238
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
67 FileOut file(m_out_dir + "/cpp/" + pri.key() + "/" + pri.key() + ".txt");
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
68 file.stream << "set (classes \n";
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
69 QStringList list = pri.value().classes;
1
e78566595089 initial import
mandel
parents:
diff changeset
70 qSort(list.begin(), list.end());
e78566595089 initial import
mandel
parents:
diff changeset
71 foreach (const QString &entry, list) {
238
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
72 file.stream << " " << entry << "\n";
1
e78566595089 initial import
mandel
parents:
diff changeset
73 }
238
1349940724eb Generate a classes list for cmake.
SokoL_SD
parents: 1
diff changeset
74 file.stream << ")\n";
1
e78566595089 initial import
mandel
parents:
diff changeset
75
e78566595089 initial import
mandel
parents:
diff changeset
76 if (file.done())
e78566595089 initial import
mandel
parents:
diff changeset
77 ++m_num_generated_written;
e78566595089 initial import
mandel
parents:
diff changeset
78 ++m_num_generated;
e78566595089 initial import
mandel
parents:
diff changeset
79 }
e78566595089 initial import
mandel
parents:
diff changeset
80 }