Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/opengl/util/generator.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtOpenGL module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4949
    5050#include <QtDebug>
     51#include <cstdlib>
    5152
    5253QT_BEGIN_NAMESPACE
    5354
    5455QT_USE_NAMESPACE
     56
     57#define TAB "    "
    5558
    5659typedef QPair<QString, QString> QStringPair;
     
    117120
    118121        if (lineStream.atEnd()) {
    119             qDebug() << "Error in file" << confFile << "(" << enumerator << ")";
     122            qDebug() << "Error in file" << confFile << '(' << enumerator << ')';
    120123            exit(0);
    121124        }
     
    243246}
    244247
     248void writeVariablesEnum(QTextStream &out, const char *name, const QSet<QString> &s)
     249{
     250    out << "enum " << name << " {";
     251    QSet<QString>::const_iterator it = s.begin();
     252    if (it != s.end()) {
     253        out << "\n" TAB "VAR_" << it->toUpper();
     254        for (++it; it != s.end(); ++it)
     255            out << ",\n" TAB "VAR_" << it->toUpper();
     256    }
     257    out << "\n};\n\n";
     258}
     259
     260void writeTypesEnum(QTextStream &out, const char *name, const QList<QStringPair> &s)
     261{
     262    out << "enum " << name << " {";
     263    QList<QStringPair>::const_iterator it = s.begin();
     264    if (it != s.end()) {
     265        out << "\n" TAB << it->first;
     266        for (++it; it != s.end(); ++it)
     267            out << ",\n" TAB << it->first;
     268    }
     269    out << "\n};\n\n";
     270}
     271
    245272void writeIncludeFile(const QSet<QString> &variables,
    246273                      const QList<QStringPair> &brushes,
     
    257284    QTextStream out(&includeFile);
    258285
    259     QLatin1String tab("    ");
    260 
    261     out << "#ifndef FRAGMENTPROGRAMS_H\n"
    262         << "#define FRAGMENTPROGRAMS_H\n\n";
    263 
    264     out << "enum FragmentVariable {\n";
    265     foreach (QString str, variables)
    266         out << tab << "VAR_" << str.toUpper() << ",\n";
    267     out << "};\n\n";
    268 
    269     out << "enum FragmentBrushType {\n";
    270     foreach (QStringPair brush, brushes)
    271         out << tab << brush.first << ",\n";
    272     out << "};\n\n";
    273 
    274     out << "enum FragmentCompositionModeType {\n";
    275     foreach (QStringPair mode, compositionModes)
    276         out << tab << mode.first << ",\n";
    277     out << "};\n\n";
    278 
    279     out << "enum FragmentMaskType {\n";
    280     foreach (QStringPair mask, masks)
    281         out << tab << mask.first << ",\n";
    282     out << "};\n\n";
     286    QLatin1String tab(TAB);
     287
     288    out << "/****************************************************************************\n"
     289           "**\n"
     290           "** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).\n"
     291           "** All rights reserved.\n"
     292           "** Contact: Nokia Corporation (qt-info@nokia.com)\n"
     293           "**\n"
     294           "** This file is part of the QtOpenGL module of the Qt Toolkit.\n"
     295           "**\n"
     296           "** $QT_BEGIN_LICENSE:LGPL$\n"
     297           "** Commercial Usage\n"
     298           "** Licensees holding valid Qt Commercial licenses may use this file in\n"
     299           "** accordance with the Qt Commercial License Agreement provided with the\n"
     300           "** Software or, alternatively, in accordance with the terms contained in\n"
     301           "** a written agreement between you and Nokia.\n"
     302           "**\n"
     303           "** GNU Lesser General Public License Usage\n"
     304           "** Alternatively, this file may be used under the terms of the GNU Lesser\n"
     305           "** General Public License version 2.1 as published by the Free Software\n"
     306           "** Foundation and appearing in the file LICENSE.LGPL included in the\n"
     307           "** packaging of this file.  Please review the following information to\n"
     308           "** ensure the GNU Lesser General Public License version 2.1 requirements\n"
     309           "** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\n"
     310           "**\n"
     311           "** In addition, as a special exception, Nokia gives you certain additional\n"
     312           "** rights.  These rights are described in the Nokia Qt LGPL Exception\n"
     313           "** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.\n"
     314           "**\n"
     315           "** GNU General Public License Usage\n"
     316           "** Alternatively, this file may be used under the terms of the GNU\n"
     317           "** General Public License version 3.0 as published by the Free Software\n"
     318           "** Foundation and appearing in the file LICENSE.GPL included in the\n"
     319           "** packaging of this file.  Please review the following information to\n"
     320           "** ensure the GNU General Public License version 3.0 requirements will be\n"
     321           "** met: http://www.gnu.org/copyleft/gpl.html.\n"
     322           "**\n"
     323           "** If you have questions regarding the use of this file, please contact\n"
     324           "** Nokia at qt-info@nokia.com.\n"
     325           "** $QT_END_LICENSE$\n"
     326           "**\n"
     327           "****************************************************************************/\n"
     328           "\n"
     329           "#ifndef FRAGMENTPROGRAMS_P_H\n"
     330           "#define FRAGMENTPROGRAMS_P_H\n"
     331           "\n"
     332           "//\n"
     333           "//  W A R N I N G\n"
     334           "//  -------------\n"
     335           "//\n"
     336           "// This file is not part of the Qt API.  It exists purely as an\n"
     337           "// implementation detail.  This header file may change from version to\n"
     338           "// version without notice, or even be removed.\n"
     339           "//\n"
     340           "// We mean it.\n"
     341           "//\n"
     342           "\n";
     343
     344    writeVariablesEnum(out, "FragmentVariable", variables);
     345    writeTypesEnum(out, "FragmentBrushType", brushes);
     346    writeTypesEnum(out, "FragmentCompositionModeType", compositionModes);
     347    writeTypesEnum(out, "FragmentMaskType", masks);
    283348
    284349    out << "static const unsigned int num_fragment_variables = " << variables.size() << ";\n\n";
Note: See TracChangeset for help on using the changeset viewer.