SWILIB API (X75)    
Loading...
Searching...
No Matches
wstring.h File Reference
#include "base.h"

Go to the source code of this file.

Data Structures

struct  WSBODY
 Wide-string body. More...
 
struct  WSHDR
 Wide-string header. More...
 

Macros

#define wsbody(ws)   ((WSBODY *) ((ws)->wsbody))
 

Typedefs

typedef struct WSBODY WSBODY
 
typedef struct WSHDR WSHDR
 

Functions

WSHDR * AllocWS (int size)
 Create new empty WSHDR.
 
WSHDR * CreateWS (malloc_func_t malloc_func, mfree_func_t mfree_func, int size)
 Create new empty WSHDR with custom allocator.
 
WSHDR * CreateLocalWS (WSHDR *header, uint16_t *body, int size)
 Initialize new empty WSHDR with static allocation.
 
void FreeWS (WSHDR *str)
 Free WSHDR.
 
void CutWSTR (WSHDR *str, int length)
 Truncate string.
 
void wsAppendChar (WSHDR *destination, int character)
 Append a character to the end of WSHDR.
 
uint16_t wsCharAt (const WSHDR *str, short pos)
 Get charater at the given position (safe).
 
int GetUnicodeSymbolByDynIcon (int dyn_icon)
 Get character by dynamic icon id.
 
int wsInsertChar (WSHDR *destination, int character, int position)
 Insert a character at the given position of the WSHDR.
 
void wsRemoveChars (WSHDR *destination, int position, int length)
 Remove characters from the WSHDR.
 
WSHDR * wstrcpy (WSHDR *destination, WSHDR *source)
 Copy WSHDR.
 
uint16_t * wstrcopy (uint16_t *destination, const uint16_t *source)
 Copy WSHDR body.
 
WSHDR * wstrncpy (WSHDR *destination, WSHDR *source, int num)
 Copy characters from WSHDR.
 
void wstrcpybypos (WSHDR *destination, WSHDR *source, int from, int num)
 Copy characters from WSHDR.
 
WSHDR * wstrcat (WSHDR *destination, WSHDR *source)
 Concatenate two WSHDR.
 
WSHDR * wstrncat (WSHDR *destination, WSHDR *source, int num)
 Concatenate two WSHDR.
 
short wstrchr (WSHDR *str, uint32_t start, uint32_t character)
 Locate first occurrence of character in WSHDR.
 
short wstrrchr (WSHDR *str, uint32_t rstart, uint32_t character)
 Locate last occurrence of character in WSHDR.
 
int wstrcmp (const WSHDR *str1, const WSHDR *str2)
 Compare two WSHDR strings.
 
int wstrncmp (const WSHDR *ws1, const WSHDR *ws2, size_t n)
 Compare two WSHDR strings, up to a specific length.
 
int wstricmp (const WSHDR *ws1, const WSHDR *ws2)
 Compare two WSHDR strings without case sensitivity.
 
int wstrnicmp (const WSHDR *ws1, const WSHDR *ws2, size_t n)
 Compare two WSHDR strings without case sensitivity, up to a specific length.
 
uint16_t wstrlen (const WSHDR *str)
 Get WSHDR length.
 
uint16_t wstriwstr (const WSHDR *ws, const WSHDR *search, uint32_t start_pos)
 Find the first occurrence of a substring in a WSHDR string, ignoring case, starting from given position.
 
void wstrreplace (WSHDR *dest, const WSHDR *src, uint32_t pos)
 Replace substring in dest with src starting from position pos.
 
Formatting
int wsprintf (WSHDR *s, const char *format,...)
 Write formatted output to WSHDR.
 
void wstrcatprintf (WSHDR *s, const char *format,...)
 Append formatted output to the end of WSHDR.
 
Encoding converting
int ws_2utf8 (const WSHDR *source, char *destination, int *new_length, uint32_t size)
 Convert WSHDR to the UTF-8 C-string.
 
int utf8_2ws (WSHDR *destination, const char *source, uint32_t size)
 Convert UTF-8 C-string to WSHDR.
 
int str_2ws (WSHDR *destination, const char *source, uint32_t size)
 Convert CP1252 (Latin) C-string to WSHDR.
 
void ws_2str (const WSHDR *source, char *destination, uint32_t size)
 Convert WSHDR to the UTF-8 C-string with special mark.
 
void wstrtoupper (WSHDR *ws)
 Convert WSHDR string to uppercase in-place.
 
void wstrtolower (WSHDR *ws)
 Convert WSHDR string to lowercase in-place.
 
void wstrcapitalize (WSHDR *ws)
 Convert WSHDR string to capitalized form in-place (first character uppercase, rest lowercase)