summaryrefslogtreecommitdiff
path: root/src/shared/proparser
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-09-19 13:21:26 +0200
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-10-29 12:25:54 +0100
commite7778e67a8dde1e581587919413814ecdbdcc1a1 (patch)
treef269c78528c43e10dfb4a42d65dfc65197371ecf /src/shared/proparser
parentbc16e882882e7651b85ec0bf19b399a5ebaac9dd (diff)
downloadqt-creator-e7778e67a8dde1e581587919413814ecdbdcc1a1.tar.gz
qmake: add $$title() function to convert strings to title case
Change-Id: Ic535a8f7cc2ab7b7f1948b2d0237ebe9a71c7ec7 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> (cherry picked from qtbase/413ec67fc46ad7049f870cdb8ead35149b215d45) Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/shared/proparser')
-rw-r--r--src/shared/proparser/qmakebuiltins.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp
index e17a9ec957..3e30c3b85e 100644
--- a/src/shared/proparser/qmakebuiltins.cpp
+++ b/src/shared/proparser/qmakebuiltins.cpp
@@ -79,7 +79,7 @@ enum ExpandFunc {
E_INVALID = 0, E_MEMBER, E_FIRST, E_LAST, E_SIZE, E_CAT, E_FROMFILE, E_EVAL, E_LIST,
E_SPRINTF, E_FORMAT_NUMBER, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
E_FIND, E_SYSTEM, E_UNIQUE, E_REVERSE, E_QUOTE, E_ESCAPE_EXPAND,
- E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_VAL_ESCAPE,
+ E_UPPER, E_LOWER, E_TITLE, E_FILES, E_PROMPT, E_RE_ESCAPE, E_VAL_ESCAPE,
E_REPLACE, E_SORT_DEPENDS, E_RESOLVE_DEPENDS, E_ENUMERATE_VARS,
E_SHADOWED, E_ABSOLUTE_PATH, E_RELATIVE_PATH, E_CLEAN_PATH,
E_SYSTEM_PATH, E_SHELL_PATH, E_SYSTEM_QUOTE, E_SHELL_QUOTE
@@ -122,6 +122,7 @@ void QMakeEvaluator::initFunctionStatics()
{ "escape_expand", E_ESCAPE_EXPAND },
{ "upper", E_UPPER },
{ "lower", E_LOWER },
+ { "title", E_TITLE },
{ "re_escape", E_RE_ESCAPE },
{ "val_escape", E_VAL_ESCAPE },
{ "files", E_FILES },
@@ -791,9 +792,16 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
break;
case E_UPPER:
case E_LOWER:
+ case E_TITLE:
for (int i = 0; i < args.count(); ++i) {
QString rstr = args.at(i).toQString(m_tmp1);
- rstr = (func_t == E_UPPER) ? rstr.toUpper() : rstr.toLower();
+ if (func_t == E_UPPER) {
+ rstr = rstr.toUpper();
+ } else {
+ rstr = rstr.toLower();
+ if (func_t == E_TITLE && rstr.length() > 0)
+ rstr[0] = rstr.at(0).toTitleCase();
+ }
ret << (rstr.isSharedWith(m_tmp1) ? args.at(i) : ProString(rstr).setSource(args.at(i)));
}
break;