qmake/project.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 0 1918ee327afb
child 5 d3bac044e0f0
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     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 qmake application of the Qt Toolkit.
     7 ** This file is part of the qmake application of the Qt Toolkit.
     8 **
     8 **
    77 //expand fucntions
    77 //expand fucntions
    78 enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST,
    78 enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST,
    79                   E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
    79                   E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
    80                   E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND,
    80                   E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND,
    81                   E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_REPLACE,
    81                   E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_REPLACE,
    82                   E_SIZE };
    82                   E_SIZE, E_GENERATE_UID };
    83 QMap<QString, ExpandFunc> qmake_expandFunctions()
    83 QMap<QString, ExpandFunc> qmake_expandFunctions()
    84 {
    84 {
    85     static QMap<QString, ExpandFunc> *qmake_expand_functions = 0;
    85     static QMap<QString, ExpandFunc> *qmake_expand_functions = 0;
    86     if(!qmake_expand_functions) {
    86     if(!qmake_expand_functions) {
    87         qmake_expand_functions = new QMap<QString, ExpandFunc>;
    87         qmake_expand_functions = new QMap<QString, ExpandFunc>;
   109         qmake_expand_functions->insert("re_escape", E_RE_ESCAPE);
   109         qmake_expand_functions->insert("re_escape", E_RE_ESCAPE);
   110         qmake_expand_functions->insert("files", E_FILES);
   110         qmake_expand_functions->insert("files", E_FILES);
   111         qmake_expand_functions->insert("prompt", E_PROMPT);
   111         qmake_expand_functions->insert("prompt", E_PROMPT);
   112         qmake_expand_functions->insert("replace", E_REPLACE);
   112         qmake_expand_functions->insert("replace", E_REPLACE);
   113         qmake_expand_functions->insert("size", E_SIZE);
   113         qmake_expand_functions->insert("size", E_SIZE);
       
   114         qmake_expand_functions->insert("generate_uid", E_GENERATE_UID);
   114     }
   115     }
   115     return *qmake_expand_functions;
   116     return *qmake_expand_functions;
   116 }
   117 }
   117 //replace functions
   118 //replace functions
   118 enum TestFunc { T_REQUIRES=1, T_GREATERTHAN, T_LESSTHAN, T_EQUALS,
   119 enum TestFunc { T_REQUIRES=1, T_GREATERTHAN, T_LESSTHAN, T_EQUALS,
  1862         args_list += tmp;
  1863         args_list += tmp;
  1863     }
  1864     }
  1864     return doProjectExpand(func, args_list, place);
  1865     return doProjectExpand(func, args_list, place);
  1865 }
  1866 }
  1866 
  1867 
       
  1868 // defined in symbian generator
       
  1869 extern QString generate_test_uid(const QString& target);
       
  1870 
  1867 QStringList
  1871 QStringList
  1868 QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
  1872 QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
  1869                               QMap<QString, QStringList> &place)
  1873                               QMap<QString, QStringList> &place)
  1870 {
  1874 {
  1871     func = func.trimmed();
  1875     func = func.trimmed();
  2299             //QString target = args[0];
  2303             //QString target = args[0];
  2300             int size = values(args[0]).size();
  2304             int size = values(args[0]).size();
  2301             ret += QString::number(size);
  2305             ret += QString::number(size);
  2302         }
  2306         }
  2303         break; }
  2307         break; }
       
  2308     case E_GENERATE_UID:
       
  2309         if (args.count() != 1) {
       
  2310             fprintf(stderr, "%s:%d: generate_uid(var) requires one argument.\n",
       
  2311                     parser.file.toLatin1().constData(), parser.line_no);
       
  2312         } else {
       
  2313             ret += generate_test_uid(args.first());
       
  2314         }
       
  2315         break;
  2304     default: {
  2316     default: {
  2305         fprintf(stderr, "%s:%d: Unknown replace function: %s\n",
  2317         fprintf(stderr, "%s:%d: Unknown replace function: %s\n",
  2306                 parser.file.toLatin1().constData(), parser.line_no,
  2318                 parser.file.toLatin1().constData(), parser.line_no,
  2307                 func.toLatin1().constData());
  2319                 func.toLatin1().constData());
  2308         break; }
  2320         break; }