Commit Graph

21 Commits

Author SHA1 Message Date
16b68b6fba object: add a type for storing, parsing, and stringifying date/time values 2025-09-22 10:44:56 +01:00
2fcadf7f39 core: string: add UTF-8 and null-char support; and some new string functions
b_string now uses UTF-8 internally, and can correctly manipulate strings
that contain non-ASCII and multi-byte codepoints.

b_string now tracks the length of a string in both bytes and unicode codepoints.

string insertion functions have been updated to correctly handle strings with
multi-byte codepoints, so the index parameter of each function now refers to codepoints
rather than bytes. inserting single-byte chars into a string with no multi-byte codepoints
is still optimised to used array indexing and memmove.

a b_string_iterator has been added to simplify iterating through a UTF-8 string, without
having to use a charAt()-style interface that would incur performance penalties.

strings can now also contain null bytes.

new functions include:
  - b_string_tokenise: a b_iterator interface for iterating through tokens
    in a string. similar to strtok except that:
    * it is re-entrant, and uses no global state.
    * it supports delimiters that are longer than one character and/or contain
      multi-byte UTF-8 codepoints.
    * it doesn't modify the string that is being iterated over.
    * it correctly handles strings with multi-byte UTF-8 codepoints and null chars.
  - b_string_compare: for comparing strings. necessary to use this rather than strcpy
    as b_strings can now contain null chars.
2025-09-22 10:36:26 +01:00
15ae12aa2e object: string: add b_string_duplicate() 2025-07-28 22:17:48 +01:00
92ccc5626d object: add macro to test object type 2025-07-17 17:55:34 +01:00
4690738af1 object: add a range of string transformation functions 2025-07-17 17:55:13 +01:00
1c880f5b7d object: string: add missing static qualifier to stream callbacks 2025-06-27 22:06:10 +01:00
c54d51d381 object: update to_string callback to use b_stream instead of b_stringstream 2025-06-27 21:47:55 +01:00
579a9e8505 object: hashmap: implement key/value destructors 2025-06-27 21:46:55 +01:00
5634506433 object: add b_list object
b_list behaves exactly like b_queue, with two key differences:

  1) it is memory-managed like other b_objects, which means it
     is stored on the heap and ref-counted.
  2) it is not an invasive data structure, and will automatically
     create and manage list nodes that contain pointers to the
     list items.
2025-06-27 21:43:57 +01:00
eb7e88d9fa object: start implement bit-buffer data structure 2025-04-11 13:56:26 +01:00
0ddfb2ee3c object: add generic byte-buffer data structure 2025-04-11 13:56:09 +01:00
640bf57b60 object: add b_string_substr 2025-04-11 13:55:36 +01:00
4c3cc27d08 object: string: add front, back, and pop_back functions 2025-02-10 21:15:48 +00:00
9add587ddd object: unify stringstream functionality 2025-02-10 13:59:06 +00:00
7452491427 meta: move endian functions from object to core 2024-12-10 22:26:52 +00:00
dfa817cb9a object: string: add b_string_replace_all() 2024-11-18 09:55:46 +00:00
2531f00b81 object: string: fix b_string_steal resetting capacity to wrong value 2024-11-17 09:22:39 +00:00
b2c9c7cab9 object: b_strlen and b_string_get_size can now ignore term's formatting codes 2024-11-14 22:03:09 +00:00
b260159fae object: fix struct zero-initialisation on MSVC 2024-11-14 22:01:09 +00:00
d614e110df add win32 (msvc) support 2024-11-14 16:56:18 +00:00
fa6ebe6a84 add object module from corelib 2024-10-24 19:24:54 +01:00