util/tests/auto/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp
changeset 7 f7bc934e204c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the test suite of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    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.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 /* NOTE: This file is AUTO GENERATED by qtokenautomaton2cpp.xsl. */
       
    42 
       
    43 #include "noNamespace.h"
       
    44 
       
    45 QT_BEGIN_NAMESPACE
       
    46 
       
    47 NoNamespace::Token NoNamespace::classifier3(const QChar *data)
       
    48 
       
    49         {
       
    50             if (data[0] == 100)
       
    51 
       
    52 
       
    53                     {
       
    54                     
       
    55                             static const unsigned short string[] =
       
    56                             {
       
    57                                 101, 102
       
    58                             };
       
    59                             if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0)
       
    60                         
       
    61 
       
    62                 return _111;
       
    63             
       
    64                     }
       
    65 
       
    66                 else if (data[0] == 97)
       
    67 
       
    68 
       
    69                     {
       
    70                     
       
    71                             static const unsigned short string[] =
       
    72                             {
       
    73                                 98, 99
       
    74                             };
       
    75                             if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0)
       
    76                         
       
    77 
       
    78                 return _;
       
    79             
       
    80                     }
       
    81 
       
    82                 else if (data[0] == 103)
       
    83 
       
    84 
       
    85                     {
       
    86                     
       
    87                             static const unsigned short string[] =
       
    88                             {
       
    89                                 104, 105
       
    90                             };
       
    91                             if(memcmp(&data[1], &string, sizeof(QChar) * 2) == 0)
       
    92                         
       
    93 
       
    94                 return wobbly;
       
    95             
       
    96                     }
       
    97 
       
    98                 
       
    99 
       
   100             return NoKeyword;
       
   101         }
       
   102     NoNamespace::Token NoNamespace::classifier4(const QChar *data)
       
   103 
       
   104         {
       
   105             if (data[0] == 70)
       
   106 
       
   107 
       
   108                     {
       
   109                     if (data[1] == 70)
       
   110 
       
   111 
       
   112                     {
       
   113                     if (data[2] == 70)
       
   114 
       
   115 
       
   116                     {
       
   117                     if (data[3] == 70)
       
   118 
       
   119 
       
   120                     {
       
   121                     
       
   122 
       
   123                 return FFFF;
       
   124             
       
   125                     }
       
   126 
       
   127                 else if (data[3] == 71)
       
   128 
       
   129 
       
   130                     {
       
   131                     
       
   132 
       
   133                 return FFFG;
       
   134             
       
   135                     }
       
   136 
       
   137                 
       
   138                     }
       
   139 
       
   140                 else if (data[2] == 71)
       
   141 
       
   142 
       
   143                     {
       
   144                     if (data[3] == 70)
       
   145 
       
   146 
       
   147                     {
       
   148                     
       
   149 
       
   150                 return FFGF;
       
   151             
       
   152                     }
       
   153 
       
   154                 else if (data[3] == 71)
       
   155 
       
   156 
       
   157                     {
       
   158                     
       
   159 
       
   160                 return FFGG;
       
   161             
       
   162                     }
       
   163 
       
   164                 
       
   165                     }
       
   166 
       
   167                 else if (data[2] == 76)
       
   168 
       
   169 
       
   170                     {
       
   171                     
       
   172                             if(data[3] == 77)
       
   173                         
       
   174 
       
   175                 return FFLM;
       
   176             
       
   177                     }
       
   178 
       
   179                 
       
   180                     }
       
   181 
       
   182                 
       
   183                     }
       
   184 
       
   185                 
       
   186 
       
   187             return NoKeyword;
       
   188         }
       
   189     NoNamespace::Token NoNamespace::classifier14(const QChar *data)
       
   190 
       
   191         {
       
   192             if (data[0] == 119)
       
   193 
       
   194 
       
   195                     {
       
   196                     
       
   197                             static const unsigned short string[] =
       
   198                             {
       
   199                                 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115
       
   200                             };
       
   201                             if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0)
       
   202                         
       
   203 
       
   204                 return WeHaveDashes;
       
   205             
       
   206                     }
       
   207 
       
   208                 else if (data[0] == 99)
       
   209 
       
   210 
       
   211                     {
       
   212                     
       
   213                             static const unsigned short string[] =
       
   214                             {
       
   215                                 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58
       
   216                             };
       
   217                             if(memcmp(&data[1], &string, sizeof(QChar) * 13) == 0)
       
   218                         
       
   219 
       
   220                 return ColonInName;
       
   221             
       
   222                     }
       
   223 
       
   224                 
       
   225 
       
   226             return NoKeyword;
       
   227         }
       
   228     NoNamespace::Token NoNamespace::classifier15(const QChar *data)
       
   229 
       
   230         {
       
   231             
       
   232                             static const unsigned short string[] =
       
   233                             {
       
   234                                 119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 45
       
   235                             };
       
   236                             if(memcmp(&data[0], &string, sizeof(QChar) * 15) == 0)
       
   237                         
       
   238 
       
   239                 return WeHaveDashes2;
       
   240             
       
   241 
       
   242             return NoKeyword;
       
   243         }
       
   244     NoNamespace::Token NoNamespace::classifier44(const QChar *data)
       
   245 
       
   246         {
       
   247             
       
   248                             static const unsigned short string[] =
       
   249                             {
       
   250                                 97, 82, 101, 97, 108, 108, 121, 76, 111, 110, 103, 84, 111, 107, 101, 110, 73, 70, 114, 101, 97, 107, 105, 110, 77, 101, 97, 110, 73, 116, 85, 75, 110, 111, 119, 85, 75, 110, 111, 119, 75, 110, 111, 119
       
   251                             };
       
   252                             if(memcmp(&data[0], &string, sizeof(QChar) * 44) == 0)
       
   253                         
       
   254 
       
   255                 return AReallyLongTokenIFreakinMeanItUKnowUKnowKnow;
       
   256             
       
   257 
       
   258             return NoKeyword;
       
   259         }
       
   260     NoNamespace::Token NoNamespace::toToken(const QChar *data, int length)
       
   261             {
       
   262                 switch(length)
       
   263                 {
       
   264                     
       
   265                         case 3:
       
   266                             return classifier3(data);
       
   267 
       
   268                     
       
   269                         case 4:
       
   270                             return classifier4(data);
       
   271 
       
   272                     
       
   273                         case 14:
       
   274                             return classifier14(data);
       
   275 
       
   276                     
       
   277                         case 15:
       
   278                             return classifier15(data);
       
   279 
       
   280                     
       
   281                         case 44:
       
   282                             return classifier44(data);
       
   283 
       
   284                     
       
   285                         default:
       
   286                             return NoKeyword;
       
   287                 }
       
   288             }
       
   289 
       
   290             
       
   291                 QString NoNamespace::toString(Token token)
       
   292                 {
       
   293                     const unsigned short *data = 0;
       
   294                     int length = 0;
       
   295 
       
   296                     switch(token)
       
   297                     {
       
   298                     
       
   299                         case AReallyLongTokenIFreakinMeanItUKnowUKnowKnow:
       
   300                         {
       
   301                             static const unsigned short staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow[] =
       
   302                             {
       
   303                             97, 82, 101, 97, 108, 108, 121, 76, 111, 110, 103, 84, 111, 107, 101, 110, 73, 70, 114, 101, 97, 107, 105, 110, 77, 101, 97, 110, 73, 116, 85, 75, 110, 111, 119, 85, 75, 110, 111, 119, 75, 110, 111, 119, 0
       
   304                             };
       
   305                             data = staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow;
       
   306                             length = 44;
       
   307                             break;
       
   308                         }
       
   309                     
       
   310                         case ColonInName:
       
   311                         {
       
   312                             static const unsigned short staticallyStoredColonInName[] =
       
   313                             {
       
   314                             99, 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58, 0
       
   315                             };
       
   316                             data = staticallyStoredColonInName;
       
   317                             length = 14;
       
   318                             break;
       
   319                         }
       
   320                     
       
   321                         case FFFF:
       
   322                         {
       
   323                             static const unsigned short staticallyStoredFFFF[] =
       
   324                             {
       
   325                             70, 70, 70, 70, 0
       
   326                             };
       
   327                             data = staticallyStoredFFFF;
       
   328                             length = 4;
       
   329                             break;
       
   330                         }
       
   331                     
       
   332                         case FFFG:
       
   333                         {
       
   334                             static const unsigned short staticallyStoredFFFG[] =
       
   335                             {
       
   336                             70, 70, 70, 71, 0
       
   337                             };
       
   338                             data = staticallyStoredFFFG;
       
   339                             length = 4;
       
   340                             break;
       
   341                         }
       
   342                     
       
   343                         case FFGF:
       
   344                         {
       
   345                             static const unsigned short staticallyStoredFFGF[] =
       
   346                             {
       
   347                             70, 70, 71, 70, 0
       
   348                             };
       
   349                             data = staticallyStoredFFGF;
       
   350                             length = 4;
       
   351                             break;
       
   352                         }
       
   353                     
       
   354                         case FFGG:
       
   355                         {
       
   356                             static const unsigned short staticallyStoredFFGG[] =
       
   357                             {
       
   358                             70, 70, 71, 71, 0
       
   359                             };
       
   360                             data = staticallyStoredFFGG;
       
   361                             length = 4;
       
   362                             break;
       
   363                         }
       
   364                     
       
   365                         case FFLM:
       
   366                         {
       
   367                             static const unsigned short staticallyStoredFFLM[] =
       
   368                             {
       
   369                             70, 70, 76, 77, 0
       
   370                             };
       
   371                             data = staticallyStoredFFLM;
       
   372                             length = 4;
       
   373                             break;
       
   374                         }
       
   375                     
       
   376                         case WeHaveDashes:
       
   377                         {
       
   378                             static const unsigned short staticallyStoredWeHaveDashes[] =
       
   379                             {
       
   380                             119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 0
       
   381                             };
       
   382                             data = staticallyStoredWeHaveDashes;
       
   383                             length = 14;
       
   384                             break;
       
   385                         }
       
   386                     
       
   387                         case WeHaveDashes2:
       
   388                         {
       
   389                             static const unsigned short staticallyStoredWeHaveDashes2[] =
       
   390                             {
       
   391                             119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 45, 0
       
   392                             };
       
   393                             data = staticallyStoredWeHaveDashes2;
       
   394                             length = 15;
       
   395                             break;
       
   396                         }
       
   397                     
       
   398                         case _:
       
   399                         {
       
   400                             static const unsigned short staticallyStored_[] =
       
   401                             {
       
   402                             97, 98, 99, 0
       
   403                             };
       
   404                             data = staticallyStored_;
       
   405                             length = 3;
       
   406                             break;
       
   407                         }
       
   408                     
       
   409                         case _111:
       
   410                         {
       
   411                             static const unsigned short staticallyStored_111[] =
       
   412                             {
       
   413                             100, 101, 102, 0
       
   414                             };
       
   415                             data = staticallyStored_111;
       
   416                             length = 3;
       
   417                             break;
       
   418                         }
       
   419                     
       
   420                         case wobbly:
       
   421                         {
       
   422                             static const unsigned short staticallyStoredwobbly[] =
       
   423                             {
       
   424                             103, 104, 105, 0
       
   425                             };
       
   426                             data = staticallyStoredwobbly;
       
   427                             length = 3;
       
   428                             break;
       
   429                         }
       
   430                     
       
   431                         default:
       
   432                             /* It's either the default token, or an undefined enum
       
   433                              * value. We silence a compiler warning, and return the
       
   434                              * empty string. */
       
   435                             ;
       
   436                     }
       
   437 
       
   438                     union
       
   439                     {
       
   440                         const unsigned short *data;
       
   441                         const QChar *asQChar;
       
   442                     } converter;
       
   443                     converter.data = data;
       
   444 
       
   445                     return QString::fromRawData(converter.asQChar, length);
       
   446                 }
       
   447             
       
   448 QT_END_NAMESPACE
       
   449