Site Logo

maxdz Software GmbH

en | de
Home

Team

Products

mdz_ansi_alg

mdz_ansi_16

mdz_ui

mdz_xml

mdz_string

mdz_vector

mdzWebSiteGenerator

mdzTennisTracker

Shop

Legals

Contacts

mdz_string Overview and Reference

mdz_string - very lightweight and versatile C library for handling single-byte (ASCII/ANSI) strings and Unicode strings. Source code of library is highly-portable, conforms to ANSI C 89/90 Standard. Builds for Win32/Win64, Linux, FreeBSD, Android, macOS are available.

Summary: Basically, conversion of Unicode strings between ANSI, UTF8, UTF16-LE, UTF16-BE, UTF32-LE and UTF32-BE formats are possible. This all with ANSI C89/90 conforming code, without any further dependencies!

mdz_string Advantages

1. High portability: the whole code conforms to ANSI C 89/90 Standard. Multithreading/asynchronous part is POSIX compatible (under UNIX/Linux).

2. Little dependencies: basically, mdz_string functions are only dependent on standard C-library memory-management/access functions. Multithreading part is dependent on POSIX pthreads API (under UNIX/Linux) and old process control/synchronization API (from Windows 2000). It means you can use library in your code without any further dependencies except standard platform libraries/APIs.

3. Fast: Our single-byte (ASCII/ANSI) strings are very fast, concerning operations like searching, insertion, deletion, etc. especially for very large (like hundreds of megabytes or gigabytes) strings.

4. Flexibilty: nearly all functions our single-byte (ASCII/ANSI) strings, contain not only "left position" but also "right position" parameters to limit processed area from right. Also library contains more string functions than according STL, boost or glib analogs have.

5. Extended error-checking: all functions preserve internal error-code pointing the problem. It is possible to use strict error-checking (when all preserved error-codes should be MDZ_ERROR_NONE) or "relaxed"-checking - when only returned mdz_false will indicate error.

6. Extended control: strings do only explicit operations. It means for example, when "insert" function is called - it will return error if there is not enough capacity in string. No implicit reservations will be made.

7. Attached usage: strings should not necessarily use dynamically-allocated memory - which may be not available on your embedded system (or if malloc()/free() are forbidden to use in you safety-critical software). Just attach string/data to your statically-allocated memory and use all string functionality.

8. Cache-friendly: it is possible to keep controlling and data parts together in memory using "embedded part".

9. Unicode support: UTF-8, UTF-16, UTF-32 are supported.

10. wchar_t support: also wchar_t strings are supported, with 2 and 4 bytes-large wchar_t characters.

11. Endianness-aware strings: wchar, utf16 and utf32 strings are endiannes-aware thus may be used to produce and manipulate strings with pre-defined endianness even if endianness of host differs.

12. Unicode "surrogate-pairs" awareness: 2-byte Unicode strings correctly process/distinguish "surrogate-pairs" as 1 Unicode symbol.

13. Asynchronous execution: almost all functions of single-byte (ASCII/ANSI) strings and insert functions of Unicode strings can be executed asynchronously.

Please refer to mdz_string Wiki for API details.


mdz_string API Reference

mdz_ansi Reference
mdz_wchar Reference
mdz_utf8 Reference
mdz_utf16 Reference
mdz_utf32 Reference

Asynchronous execution

Many functions of mdz_string accept parameters for asynchronous execution.
The only relevant parameter is:

- struct mdz_asyncData* pAsyncData - pointer to shared async data for asynchronous call, or NULL if call should be synchronous

Fields of struct mdz_asyncData* are following:

TypeParameterDescription
void* m_pStringPointer to string instance
mdz_bool m_bFinishedmdz_true if the call is completely finished. Otherwise mdz_false (if interrupted/cancelled)
size_t m_nResultResult of call. Invalid if call is not completely finished (m_bFinished is mdz_false)
void* m_pDataAdditional data returned by call (if any). Invalid if call is not completely finished (m_bFinished is mdz_false)
mdz_bool m_bCancelShould be set by client in mdz_true during call execution, to cancel the call. Otherwise mdz_false
pthread_t / HANDLE m_hThreadHandle to thread on which the call is executed. May be used by client for wait operations
Software Development. Strive for the Impossible to achieve Excellence.
Copyright Ⓒ 2017 - 2025 maxdz Software GmbH. All rights reserved.
Site content is generated using mdzWebSiteGenerator