434cf6d3e2
unicode: add conversion between char* and wchar_t*
...
It's implemented for Windows-only for the time being.
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-17 12:53:03 +02:00
6cdcb08365
sgml: rename str -> wstr
...
The sgml.hpp is about converting between SGML and UTF-16/Unicode
actually. The "wstr" naming aligns better with std::wstring, wchar_t
etc.
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-17 12:51:41 +02:00
08de93ce2b
sgml: add helpers for std::string input parameters
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-17 11:33:03 +02:00
cd61f8afe0
progress: cleanup
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-17 10:39:46 +02:00
a8c3ade263
progress: add progress_switcher
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-15 10:10:05 +02:00
ff097d4432
string: have strncpy return number of non-zero code points in dst
...
This information is a side product of these templates and saves an extra
strnlen when caller plans on appending dst string some more data.
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-13 14:35:48 +02:00
27d10344d9
string: Add strncoll
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-12 13:57:13 +02:00
1dda8cde86
string: Revise searching
...
POSIX C strchr and strstr implementations return pointers and pointer
arithmetic is error prone. Switch to std C++ index search offsets.
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-12 13:56:52 +02:00
a6c1c6c7ae
interval: Add equality operators
...
MSVC is not comparing instances properly otherwise.
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-04 11:08:54 +02:00
44975a016f
mapping: Use member equality operators and document
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-04 11:08:54 +02:00
1c54745b3b
string: Add strncpy
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-03 13:56:48 +02:00
556d5a9798
string: Revise SAL for strnlen
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-03 13:56:24 +02:00
7731a20f56
interval: Add interval_vector
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-07-03 13:55:34 +02:00
067cbddf64
Reformat á la VS2022
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-06-07 12:06:43 +02:00
5d46888dc2
Revise SAL for "start&length" string parameters
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-06-06 19:28:39 +02:00
2c8fad779c
sgml: support appending SGML to supplied string
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-06-06 19:28:39 +02:00
1fb78a78f2
parser: Stabilize HTTP suite
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-16 12:35:52 +01:00
b028c8772e
parser: Cleanup
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-16 12:35:08 +01:00
a59163733a
parser: Add missing constructors to allow locale propagation
...
Classes using m_locale must allow locale configuration in their
constructor. Otherwise m_locale was always set to default by
basic_parser<> constructor.
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-16 11:21:53 +01:00
38fac2837f
parser: Duplicate locale
...
The Release testing revealed that compiler might free temporary
std::locale instances sooner than we thought, exposing UaF.
On 64-bit arch, a reference takes 8 bytes, a std::locale copy takes 16
bytes. So duplicating a locale in each parser instance is not such a big
deal to risk an UaF.
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-16 11:02:23 +01:00
127704d2d8
parser: Rename "tester" to "parser"
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-16 10:58:15 +01:00
33012e1513
parser: Use ranged for loops where appropriate
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-16 09:38:53 +01:00
aa233bd5f9
Convert space to tab indentation
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-15 21:51:39 +01:00
308f63490c
Rename .h to .hpp
...
These files are C++ only. They should either have no extension like
standard C++ headers (which is cumbersome on Windows environments), or
.hpp.
.h is used for C and hybrid C/C++ headers.
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-15 21:49:41 +01:00
261ad98812
Add string parsers
...
Ported from Amebis AOsn library to standard C++
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-15 21:38:57 +01:00
d13421e4b6
Add noop deleter
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-15 09:09:23 +01:00
601cfec62d
interval: Add empty() method
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-15 09:03:01 +01:00
b43b853235
Add SGML↔Unicode conversion
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-15 09:02:25 +01:00
9ce8e6bff9
Add support for character testing, strncmp, strnstr and number parsing
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-15 09:02:21 +01:00
f0d37935ec
Add missing #include <assert.h>
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-09 13:54:15 +01:00
fe3580792f
Update Copyright year
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-08 13:34:04 +01:00
a59971fdbd
Add strnchr() and crlf2nl()
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-08 12:01:57 +01:00
dda761a692
Add progress indicator templates
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-06 16:08:16 +01:00
fbc2afb450
Add interval template
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-06 16:07:50 +01:00
be8cffc109
Add user_cancelled exception type
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-06 16:07:31 +01:00
515d92b035
Add errno_error exception type
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-06 16:07:08 +01:00
ff8ca7f073
Use uint8_t where appropriate
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 12:22:37 +02:00
857b0b36c0
Adjust to compile with gcc
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-13 15:36:47 +02:00
09d0f347e8
Add .h extension to #include files
...
Using extension-less #include files brought more issues than it was
worth.
Reverts: dfa34420d9ff29932f1e7d06bb98f1f757373bd5
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-03-07 11:37:35 +01:00
a100acff13
Doxygen: Update project description
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-03-07 11:29:24 +01:00
8602b469db
Doxygen: Instruct GitHub Actions to build documentation on push
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-03-07 11:26:20 +01:00
dfa34420d9
Doxygen: Fix skipping extension-less C++ #include files
...
Careful, not to include `Doxyfile` and ``LICENSE` extension-less files
from repository root.
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-03-07 11:26:20 +01:00
11df03b0ad
Doxygen: Add static functions and templates
...
Being portable, means having all function implementations in #include
files and functions marked as static. We have no global functions in
this project yet, but it took me quite some head scratching in WinStd
project why all the global functions are missing in the documentation.
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-03-07 10:55:35 +01:00
1fbff95bd7
Doxyfile: Update
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-04 14:42:06 +01:00
13666a0d2f
Move vector_queue from WinStd to stdex
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-04 13:49:12 +01:00
c7c3ee71d1
Switch to MIT license
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-03 15:38:03 +01:00
f76ece6ca5
Move Hex from WinStd to stdex
...
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-03 15:14:33 +01:00
76a90a203c
Discontinue manual inline hinting
...
Compiler knows better than we do.
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-03 14:20:51 +01:00
4521ea8f00
Move our Base64 implementation from WinStd
...
Base64 is general algorithm not provided with Win32 API.
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-03 13:43:15 +01:00
b2e4c7dc4a
Discontinue manual inline hinting
...
Compiler knows better than we do.
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-03 13:34:41 +01:00