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