summaryrefslogtreecommitdiffstats
path: root/qmake/doc
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-05-13 13:31:14 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-05-25 06:18:55 +0000
commitd3cc25ef52d0b2b7ba1cb06609f7c205ee19c2d6 (patch)
treeff902c67105d8cb005511103a63d44ec761629b7 /qmake/doc
parent3d21634fb693634b7d41a152287d29afb80ac5e2 (diff)
add $$num_add() (numeric addition) function
amazing how we managed to do without it for so long. ^^ the name is intentionally somewhat obscure to avoid clashes, and some namespacing is good anyway. [ChangeLog][qmake] Added $$num_add() function. Change-Id: Ib7648b1f425ef096a87b51f158d0f1409e5c4daa Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qmake/doc')
-rw-r--r--qmake/doc/src/qmake-manual.qdoc21
1 files changed, 21 insertions, 0 deletions
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index c196cb841a..4e69fd9897 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -2943,6 +2943,27 @@
\c position defaults to 0, causing the first value in the list to be
returned.
+ \section2 num_add(arg1 [, arg2 ..., argn])
+
+ Takes an arbitrary number of numeric arguments and adds them up,
+ returning the sum.
+
+ Subtraction is implicitly supported due to the possibility to simply
+ prepend a minus sign to a numeric value to negate it:
+
+ \code
+ sum = $$num_add($$first, -$$second)
+ \endcode
+
+ If the operand may be already negative, another step is necessary to
+ normalize the number:
+
+ \code
+ second_neg = -$$second
+ second_neg ~= s/^--//
+ sum = $$num_add($$first, $$second_neg)
+ \endcode
+
\section2 prompt(question)
Displays the specified \c question, and returns a value read from stdin.