Commit Graph

14 Commits

Author SHA1 Message Date
Marco Bubke
bdfb466cd2 Utils: Add replace for characters
It is much more performant to have a overload of char instead of providing
a string all the time.

Change-Id: I1a4ed82bf056f6af0c1f91c236b3fc30afa7f5d8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-02 12:46:14 +00:00
Marco Bubke
c5d42503fa Utils: Add test that a longer path string is a short string
Change-Id: Ie4cf6ae5e2ac9fac878b3f85e88b1e64960a156d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-01 09:19:51 +00:00
Marco Bubke
a0c69c517c Utils: Fix long small string
We used only 6 bit to save the short size but for SmallString with a size
over 64 it is not enough. So we have now to use a uint16 instead of a
uint8 if the size if over 64.

Change-Id: I53558e492b6cb40b739b23a8af83d192a2e11bd2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-31 16:12:18 +00:00
Marco Bubke
729c535376 Utils: Add intializer_list constructor in SmallString
You can now write

SmallString text = {"Oh ", women[4], " how much I miss you"};

if it can be casted to SmallStringView.

Change-Id: I86b69ee8d735017cac4391e7c4e68355eb5f227b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-31 16:06:33 +00:00
Marco Bubke
9b4afa01a1 Utils: Improve and fix operators in SmallString
Change-Id: I51f4e647cbd3ada0c3a86d16f40fd8044acead33
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-31 16:06:28 +00:00
Marco Bubke
c072cdfb88 Clang: Add ClangPchManager
Compiling every header file again and again is quite time comsuming. There
are technics to improve this like preambles(a kind of automated
precompiled header) but they don't share their data between translation
units. This approach provides an automatically generated precompiled
header for every project and subproject to improve the loading time.

Change-Id: I34f5bd4db21951175920e2a9bbf6b97b1d705969
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-30 13:55:58 +00:00
Robert Loehning
eeb0b8fd21 Revert "Revert "Utils: Remove old compiler support code""
Thomas provided a smaller fix.
This reverts commit 78fb7f44bf.

Change-Id: I1edff6477526fe4ce29df38852f47fe49117561e
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-01-19 12:21:43 +00:00
Alessandro Portale
78fb7f44bf Revert "Utils: Remove old compiler support code"
This reverts commit 8a32bcc5e7.

Broke build with MSVC 2015, update 3

Change-Id: Icb59b70fb00ea2a2ecc8d26c8177d21d82aaccf2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-01-19 11:47:26 +00:00
Marco Bubke
8a32bcc5e7 Utils: Remove old compiler support code
We now support constexpr, noexcept and alignas on all compilers. Next will
be C++ 14 constexpr support.

Change-Id: I254049c60dcd82fc373ec907cbb5702a4b344978
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-19 10:59:40 +00:00
Marco Bubke
b8e391e5f0 Utils: Fix SmallString reserve for read only references
The capacity of a real only reference is zero but the size is larger than
zero. So if we reserve memory the new capacity has to be bigger than the
size and the capacity.

Change-Id: I8b423da7e7c1cf7cee081d1b3f3464b6fb3f67cf
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-05 13:59:56 +00:00
Marco Bubke
b888520598 Utils: Reserve in smallstring was flaky
We have to copy the content of SmallString before we instantiate a new
constructor in the same memory. So the content to which data() is pointing
can be already invalid.

Change-Id: I3a0ab4f9ac0c1219c2bd75fc4412eaf56209ca64
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-30 15:32:48 +00:00
Marco Bubke
600b85defa Utils: Add carriage return strip method to SmallString
Sometimes you want to compare unix and windows texts in tests. This is a
convenient function to remove the carriage returns.

Change-Id: I164298b70d3d775dd45903ea3753ac0e68ed2fdc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-28 16:48:25 +00:00
Marco Bubke
19a00f418f Utils: Add const reverse iterators to SmallString
Change-Id: Iefd9d6abafbe38dcb7d3ed9ea200ac3244902433
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-17 15:06:46 +00:00
Marco Bubke
47c01daeb2 UnitTest: Cleanup
Improve naming and introduce googletest.h.

Change-Id: I445c13db4c23d6dd5682ce0db3b83055cc6b8a89
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-19 15:17:54 +00:00