Maxime Coste
e701254b02
Fix String::Data::reserve on big endian platforms, and document String::Data
...
reserve was not ensuring the capacity would be pair, which is needed
on big endian machines, as we use its least significant bit to flag
short string optimizations. On little endian the bit we use is the
8th most significant (the least significant bit of the last byte),
so we were not hitting any problems.
Fixes #828
2016-09-28 19:06:25 +01:00
Maxime Coste
1e0ec182c1
Assert substr from parameter is within the string
...
Should catch #756 earlier if it happens again.
2016-09-26 23:24:09 +01:00
Maxime Coste
97e36233fb
Remove the to_string(unsigned) (it conflicts with to_string(size_t) on x86)
...
Just cast to int when we pass an unsigned.
2016-08-31 09:07:33 +01:00
Maxime Coste
2bf100bdd0
Add a to_string overload for unsigned int
2016-08-27 10:46:49 +01:00
Maxime Coste
f73e89a716
Add information of types of options
2016-08-06 09:05:50 +01:00
Maxime Coste
df0773feeb
Ensure we cannot call StringView::StringView{Codepoint}
2016-07-27 09:08:08 +01:00
Maxime Coste
b8908f2dc6
Add a String::resize method
2016-06-19 17:01:27 +01:00
Maxime Coste
e01a658cea
Make use of strongly typed number to size_t conversion
2016-04-27 09:46:53 +01:00
Maxime Coste
8bd3395d4d
Do not allow / in highlighter names as it is used for hierachies
...
/ are replaced with <slash> in the highlighter names.
Fixes #553
2016-02-13 12:59:27 +00:00
Maxime Coste
8d37a716fb
Use a custom SSO aware string backend
2016-02-10 09:44:42 +00:00
Maxime Coste
94cbd5a837
More string usage cleanup
2016-02-05 09:13:07 +00:00
Maxime Coste
a8eddd03f0
String usage cleanups
2016-02-04 23:54:22 +00:00
Maxime Coste
ec91ea17fe
Add a static const String::ms_empty empty string
2015-11-25 21:07:41 +00:00
Maxime Coste
a5c8437873
Remove unneeded conversion
2015-11-11 19:05:32 +00:00
Filip Szczepański
47e6eed7c9
Add Haiku support.
2015-09-24 22:36:29 +00:00
Maxime Coste
6bc5f8c3a3
Add simple markup support to generate display lines from strings
...
The syntax is simply {face} to enable the given face, use \{ to
escape a {, and \\ to escape a \.
2015-09-19 12:19:17 +01:00
Maxime Coste
a33c8d9677
Smaller sizeof for in place strings
2015-08-18 21:06:53 +01:00
Maxime Coste
f87dbe410f
Add missing support for Codepoint in format
2015-07-14 13:47:51 +01:00
Maxime Coste
6870895374
Add support for hex formatting
2015-06-22 13:56:00 +01:00
Maxime Coste
f19bb4fe6d
Port more code to use the format function instead of adhoc string concat
2015-06-01 19:06:35 +01:00
Maxime Coste
be9da616df
Return a String in Backtrace::desc
2015-05-29 13:35:54 +01:00
Maxime Coste
993e842fdf
Retreat ! go back to C++11 only code
...
This reverts commit b42de85031
.
2015-05-26 18:42:09 +01:00
Maxime Coste
b42de85031
Migrate code to c++14
2015-05-25 13:51:17 +01:00
Maxime Coste
d7159a9af0
Add str_to_int_ifp that returns an Optional<int> instead of throwing
2015-05-01 18:47:22 +01:00
Maxime Coste
f6c7948c12
Add format_to allowing formating to an existing buffer
2015-04-22 13:19:46 +01:00
Maxime Coste
b5ab318a2d
Always optimize StringView::strlen (recursive due to constexpr)
2015-04-07 23:21:14 +01:00
Maxime Coste
758bfe7284
number to string conversion avoids memory allocations
2015-03-31 13:53:40 +01:00
Maxime Coste
13a5af70ae
Add a format function for printf like formatting
2015-03-30 23:05:24 +01:00
Maxime Coste
8761fc34f4
Always go through StringView to compare strings
...
That avoids creating temporary String needlessly
2015-03-30 19:59:08 +01:00
Maxime Coste
8439059758
Fix wrong implicit conversions from int/Codepoint to StringView
2015-03-30 13:33:46 +01:00
Maxime Coste
f2b8b1ae2b
Fix compilation on clang
2015-03-12 13:04:53 +00:00
Maxime Coste
c81a5d03c5
String tweaks
2015-03-11 19:41:44 +00:00
Maxime Coste
3c1a325b6f
Refactor String, use a common StringOps interface, hide std::string
2015-03-10 19:50:22 +00:00
Maxime Coste
6c65c5e080
Add docstrings to highlighters, displayed by addhl help
2015-02-19 13:54:03 +00:00
Maxime Coste
790e671f6c
Replace some <cstring> function usage with c++ algorithms
2015-02-10 23:09:30 +00:00
Maxime Coste
7cdeb3d7f7
simplify echo code, avoid trailing spaces
2015-01-17 22:55:48 +00:00
Maxime Coste
b9c4fc2d8c
Add size_t and float to_string overload, and _sv UDL
2015-01-13 13:47:46 +00:00
Maxime Coste
9f9156a752
Track String memory allocations
2015-01-09 13:57:21 +00:00
Maxime Coste
8cc96ec36b
Add a join function for joining strings using a specific char
2014-12-28 11:16:51 +00:00
Maxime Coste
2852e0fbe5
Remove trailing blank lines
2014-12-23 23:00:20 +00:00
Maxime Coste
ebecd60eb8
Rework hashing, use a more extensible framework similar to n3876 proposal
...
std::hash specialization is a pain to work with, stop using that, and
just specialize a 'size_t hash_value(const T&)' free function.
2014-12-16 18:57:19 +00:00
Maxime Coste
2f2752cd1d
Force inline StringView::{begin,end}
2014-12-09 13:56:05 +00:00
Maxime Coste
87d312b6d4
More string cleanups
2014-12-08 13:59:29 +00:00
Maxime Coste
9f4af93780
cleanup in string.hh
2014-12-08 13:46:07 +00:00
Maxime Coste
314d662c5f
Change wrap_lines to return StringViews, move it to string.cc
2014-11-20 13:15:11 +00:00
Maxime Coste
1bd2260fa5
Import std::begin/std::end so that container utils work correctly with non std containers
2014-11-17 13:51:21 +00:00
Maxime Coste
3a817e2f96
Cleanup includes
2014-11-12 21:27:07 +00:00
Maxime Coste
97df59ddb7
Support single char StringView
...
remove single char escape function overload, add unescape function
2014-11-04 13:32:18 +00:00
Maxime Coste
69113e2711
Add a split function that does not take an escape and returns StringViews
...
When an escape character is not present, split can just return sub
strings of the parameter, so we can avoid duplicating the original
string data.
2014-10-19 16:27:36 +01:00
Maxime Coste
fa85f0fc32
Refactor regex uses, do not reference boost except in regex.hh
2014-10-13 13:14:23 +01:00