Commit Graph

8 Commits

Author SHA1 Message Date
Marco Bubke
07ee542a14 Utils: Activate copy constructor for BasicSmallStringVector
Change-Id: I8716c4533274578d01762657dd430796ac21afaa
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-09 13:20:49 +00:00
Marco Bubke
8acacf5d42 Utils: Add a constructor for std::vector<SmallString>
Change-Id: I1ce11bfbf14d9fda975c2d1ca27ae9d7b8e40bc7
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-09 13:20:45 +00:00
Tim Jenssen
b31c3e0dcb Utils: Changeable SmallString stack size
The size of the small string optimization was hard coded. For some use
cases you want a bigger or smaller size. It is now configurable by a
template parameter. For that we changed the name to BasicSmallString and
added an alias of BasicSmallString<31> to SmallString.

Change-Id: I844b4420d260290307a6018bb6cc4cf3ba7bd449
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-01 16:17:21 +00:00
Marco Bubke
601dc5fc07 Utils: Introduce a conversion constructors for std::vector<std::string>
Change-Id: Ic37bf194240f5b76ec6299374cc7ad785b78a7ed
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-01 15:49:40 +00:00
Marco Bubke
092df2edaa Clang: Smallstring should not depend on std::ostream
We move the io operators in an extra header file because if we would
include ostream in smallstring.h we would blow the compile time.

Change-Id: Iea61ceedbbbcdd2adc6dc149794dab6e743084f8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-08-08 15:01:53 +00:00
Marco Bubke
4d29ca2d3a Utils: Add clone functions to small string
Change-Id: I4e1ff40437253ce9fa047b476edb5d69654963b2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-08-02 13:38:32 +00:00
Marco Bubke
0549c6af97 Utils: Add std::string conversion constructor and operator to small string
Change-Id: Ia76d7647fc8d2c9b72bc5bce2e7a6e2c3fcc18cc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-08-02 13:38:23 +00:00
Marco Bubke
1eb0c94f81 Utils: Add SmallString
SmallString is a very simple utf8 string class. It's purpose is performance.
It uses a short string opimization which provides 31 bytes of heap free
memory to save a 30 bytes long string plus null terminator. If the string
gets larger heap is allocated. The grow strategy is 1.5 to improve reuse
of allocated memory.

It uses optionally constexpr to provide string literals.

Change-Id: I7757fb51abfeca200d074cbfce2f1d99edc0ecb0
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-17 15:07:01 +00:00