util/qlalr/cppgenerator.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 23 89e065397ea6
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the utils of the Qt Toolkit.
     7 ** This file is part of the utils of the Qt Toolkit.
     8 **
     8 **
    49 QString CppGenerator::copyrightHeader() const
    49 QString CppGenerator::copyrightHeader() const
    50 {
    50 {
    51   return QLatin1String(
    51   return QLatin1String(
    52     "/****************************************************************************\n"
    52     "/****************************************************************************\n"
    53     "**\n"
    53     "**\n"
    54     "** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).\n"
    54     "** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).\n"
    55     "** All rights reserved.\n"
    55     "** All rights reserved.\n"
    56     "** Contact: Nokia Corporation (qt-info@nokia.com)\n"
    56     "** Contact: Nokia Corporation (qt-info@nokia.com)\n"
    57     "**\n"
    57     "**\n"
    58     "** This file is part of the QtCore module of the Qt Toolkit.\n"
    58     "** This file is part of the QtCore module of the Qt Toolkit.\n"
    59     "**\n"
    59     "**\n"
   455 void CppGenerator::generateDecl (QTextStream &out)
   455 void CppGenerator::generateDecl (QTextStream &out)
   456 {
   456 {
   457   out << "class " << grammar.table_name << endl
   457   out << "class " << grammar.table_name << endl
   458       << "{" << endl
   458       << "{" << endl
   459       << "public:" << endl
   459       << "public:" << endl
   460       << "  enum {" << endl;
   460       << "  enum VariousConstants {" << endl;
   461 
   461 
   462   foreach (Name t, grammar.terminals)
   462   foreach (Name t, grammar.terminals)
   463     {
   463     {
   464       QString name = *t;
   464       QString name = *t;
   465       int value = std::distance (grammar.names.begin (), t);
   465       int value = std::distance (grammar.names.begin (), t);