274 Commits

Author SHA1 Message Date
0ec86f6161 idrec: cleanup 2023-12-08 18:47:05 +01:00
d5bf60447b Cleanup 2023-12-08 16:22:09 +01:00
bb9988933e unicode: add unit test for normalize
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-08 14:21:52 +01:00
6d1d9bd1b8 sgml: fix unit tests 2023-12-08 14:21:20 +01:00
5d7e44a3cd parser: address Code Analysis warning
Nice catch: when calling with basic_bol::match(nullptr, 5, 5), the
method addresses null[4].

Turned this condition into debug assert, as (nullptr, 5, 5) is invalid
input parameter combination.
2023-12-08 14:20:56 +01:00
8ba5a06379 parser: update SAL
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-08 14:03:26 +01:00
5215d5e6dc unicode: add normalize
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-07 18:43:14 +01:00
475f05b6d2 string: add strrchr and stricmp variants 2023-12-07 18:42:52 +01:00
2440e5baca Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-07 18:41:55 +01:00
72bab6d6b2 string: add strlwr variants 2023-12-07 12:27:38 +01:00
0d3785850b html: add (un)escaping function variants 2023-12-07 12:26:41 +01:00
b15ab697c2 string: add strnlen variant for known fixed-size buffers 2023-12-07 12:25:35 +01:00
8fc9a7e56b stream: allow invalid handle detection in cached_file
Otherwise one cannot distinguish between file open but in failed state
and file not open.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-06 15:25:48 +01:00
9967b41eae stream: make memory_file properly copyable and movable
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-06 11:02:12 +01:00
5a4194c9ba wav: add 2023-12-01 19:06:20 +01:00
c69b79c0f2 idrec: cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-01 19:06:10 +01:00
976662415b stream: unify size method and make it const
diag_file::size() was setting the m_state and returning 0 on error,
which violated original size() convention not to change stream state and
to return fsize_max on error.

Changing m_state prevented declaring size() method as const before.

cache::seek() was missing size() return value check.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-01 14:11:02 +01:00
8fbbf58a1b system: update documentation
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-12-01 14:05:54 +01:00
571463b22c html: fix parser to handle empty documents
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-29 12:04:17 +01:00
14e6bec509 parser: fix basic_eol
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-29 11:32:28 +01:00
e17fa1d8c2 parser: detect spaces, characters and newline faster where appropriate
No need to use locale-specific character type detection when ASCII.
Locale-specific implementation on Windows is not that very fast.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-28 13:48:54 +01:00
7685818bf7 parser: HTTP spaces are always ASCII
No need to use "C" locale, which implementation on Windows is not that
very fast.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-28 13:38:20 +01:00
d9e04170ac unicode: extend charset_from_name
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-28 13:36:42 +01:00
97014df244 html: fix localizable attribute mapping
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-28 12:14:37 +01:00
b824c204a6 parser: fix IPv6 detection
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-19 12:11:54 +01:00
d44aed2cff string: add "C" locale function variants
"C"-locale is basically ASCII while (Microsoft) implementation is not
quite performant to our likes. We can do faster.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-18 09:57:38 +01:00
dff646a4f8 README: add link to auto-generated documentation
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-17 15:18:06 +01:00
87c41c0947 html: add simple tokenizer and parser
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-17 15:14:54 +01:00
424f297c7b sgml: sgml2wstr→sgml2str, wstr2sgml→str2sgml 🧨
This is analogous to string.hpp's strlen, strcpy, strcat, which use C++
polymorphism rather than function name decorations for char/wchar_t
flavors.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-17 15:14:53 +01:00
06da717405 string: upgrade vappendf and appendf to return number of chars appended
This comes handy when concatenating strings and calculating mappings.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-17 15:14:53 +01:00
10791467d8 string: add isblank
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-17 15:14:53 +01:00
3dfcaf3f10 string: add std_locale_C
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-17 15:14:53 +01:00
6c8d6f182c unicode: add charset_from_name
This makes name->charset_t conversion available to others.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-17 15:14:53 +01:00
52d9956891 Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-17 15:14:53 +01:00
bea4b5b408 spinlock, pool: add
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-10 12:38:13 +01:00
cc8a6eeee7 Make C++17 minimum requirement
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-10 08:36:33 +01:00
57ccb713ad Make inline variables optional before C++17
This allows gradual projects migration to C++17 and later.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-09 09:25:42 +01:00
3dfd62ec2f socket: add own cross-platform declaration
Like with stdex::locale_t, this frees us from using Windowsizms on other
platforms. Sockets came from Unix to Windows and not the other way
around in the first place.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-09 09:25:42 +01:00
2c45749f78 string, locale: make stdex::locale(_t) independent .hpp file
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-09 08:12:31 +01:00
9d50a878dc Inline variables to have compiler reuse them
Unfortunately, this requires at least C++17, but the inline is exactly
what we need to avoid redundant copies of static const data.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-08 18:48:31 +01:00
4fb684ce75 Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-08 18:35:59 +01:00
ee8f54ee5f Fix to compile for Linux
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-08 13:48:41 +01:00
9ff15a27a1 string: move uuidtostr to a separate .hpp
It requires libuuid-devel on Linux and since this function is optional, lets
not impose libuuid-devel dependency on anything that #include
<stdex/string.hpp>.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-08 13:41:50 +01:00
fedeef0bea string: fix strncat SAL
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-06 11:57:47 +01:00
dec5ad54d1 interval: add invalidate method
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-06 11:57:08 +01:00
89a5c6e5e6 sys_info: move to a separate .hpp
The stdex::sys_info is instantiated for each compilation unit. To reduce
amount of copies, move it to a separate .hpp as system.hpp is almost
always #included.

Breaking-change: Add #include <stdex/sys_info.hpp>
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-19 10:16:53 +02:00
16a86cf350 Add #include wrapper to fix min/max <Windows.h> mess
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-18 12:51:49 +02:00
856be3a0d8 Revise #include to make each .hpp individually compilable
Mind that min/max Windows.h mess is Microsoft's problem, not ours.

Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-18 09:12:06 +02:00
11e56f927f string: add missing #include to support uuid_t on Windows
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-18 08:14:28 +02:00
983891ec41 string: add crlf2nl
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-10-10 16:43:09 +02:00