Macros | Typedefs | Functions | Variables
xsstring.h File Reference
#include "xstypesconfig.h"
#include "xsarray.h"
#include <wchar.h>
#include <string.h>
Include dependency graph for xsstring.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define XsString_copy(thisPtr, copy)   XsArray_copy(copy, thisPtr)
 
#define XsString_INITIALIZER   XSARRAY_INITIALIZER(&g_xsStringDescriptor)
 
#define XSSTRING_INITIALIZER   XsString_INITIALIZER
 
#define XsString_swap(a, b)   XsArray_swap(a, b)
 

Typedefs

typedef struct XsString XsString
 

Functions

 XSARRAY_STRUCT (XsString, char)
 
XSTYPES_DLL_API void XsString_append (XsString *thisPtr, XsString const *other)
 This function concatenates the other to this. More...
 
XSTYPES_DLL_API void XsString_assign (XsString *thisPtr, XsSize count, const char *src)
 Reinitializes the XsArray with space for count items and copies them from src. More...
 
XSTYPES_DLL_API void XsString_assignCharArray (XsString *thisPtr, const char *src)
 This function determines the size of src and copies the contents to the object. More...
 
XSTYPES_DLL_API void XsString_assignWCharArray (XsString *thisPtr, const wchar_t *src)
 This function determines the size of src and copies the contents to the object after converting it from a unicode string to a multibyte character string. More...
 
XSTYPES_DLL_API void XsString_construct (XsString *thisPtr)
 Initializes the XsString object as an empty string. More...
 
XSTYPES_DLL_API int XsString_contains (XsString const *thisPtr, XsString const *other, int caseSensitive, XsSize *offset)
 Returns whether this string contains other. More...
 
XSTYPES_DLL_API XsSize XsString_copyToWCharArray (const XsString *thisPtr, wchar_t *dest, XsSize size)
 This function copies the contents of the object to a unicode wchar_t array. More...
 
XSTYPES_DLL_API void XsString_destruct (XsString *thisPtr)
 Clears and frees memory allocated by the XsArray. More...
 
XSTYPES_DLL_API int XsString_empty (XsString const *thisPtr)
 Returns true when the supplied string is empty. More...
 
XSTYPES_DLL_API int XsString_endsWith (XsString const *thisPtr, XsString const *other, int caseSensitive)
 Returns whether this string ends with other. More...
 
XSTYPES_DLL_API void XsString_erase (XsString *thisPtr, XsSize index, XsSize count)
 Removes a count items from the list starting at index. More...
 
XSTYPES_DLL_API ptrdiff_t XsString_findSubStr (XsString const *thisPtr, XsString const *needle)
 Find the first occurrence of needle in the string. More...
 
XSTYPES_DLL_API void XsString_mid (XsString *thisPtr, XsString const *source, XsSize start, XsSize count)
 Copy a substring of the source string. More...
 
XSTYPES_DLL_API void XsString_push_back (XsString *thisPtr, char c)
 Append character c to the string. More...
 
XSTYPES_DLL_API void XsString_push_backWChar (XsString *thisPtr, wchar_t c)
 Append unicode character c to the string. More...
 
XSTYPES_DLL_API void XsString_replaceAll (XsString *thisPtr, XsString const *src, XsString const *dst)
 Replace all occurrences of src with dst, modifying thisPtr. More...
 
XSTYPES_DLL_API void XsString_resize (XsString *thisPtr, XsSize count)
 This function resizes the contained string to the desired size, while retaining its contents. More...
 
XSTYPES_DLL_API void XsString_reverse (XsString *thisPtr)
 Reverses the contents of the string. More...
 
XSTYPES_DLL_API void XsString_sort (XsString *thisPtr)
 Sorts the string. More...
 
XSTYPES_DLL_API int XsString_startsWith (XsString const *thisPtr, XsString const *other, int caseSensitive)
 Returns whether this string starts with other. More...
 
XSTYPES_DLL_API void XsString_trimmed (XsString *thisPtr, XsString const *source)
 Fills thisPtr with a copy of source with all its leading and trailing whitespace removed. More...
 
XSTYPES_DLL_API wchar_t XsString_utf8At (const XsString *thisPtr, XsSize index)
 The decoded UTF-8 character at index index in the UTF-8 encoded string. More...
 
XSTYPES_DLL_API XsSize XsString_utf8Len (XsString const *thisPtr)
 Returns the number of characters in a UTF-8 encoded string. More...
 

Variables

const XsArrayDescriptor XSTYPES_DLL_API g_xsStringDescriptor
 Descriptor for XsInt64Array. More...
 

Macro Definition Documentation

◆ XsString_copy

#define XsString_copy (   thisPtr,
  copy 
)    XsArray_copy(copy, thisPtr)

Definition at line 123 of file xsstring.h.

◆ XsString_INITIALIZER

#define XsString_INITIALIZER   XSARRAY_INITIALIZER(&g_xsStringDescriptor)

Definition at line 85 of file xsstring.h.

◆ XSSTRING_INITIALIZER

#define XSSTRING_INITIALIZER   XsString_INITIALIZER

Definition at line 89 of file xsstring.h.

◆ XsString_swap

#define XsString_swap (   a,
 
)    XsArray_swap(a, b)

Definition at line 124 of file xsstring.h.

Typedef Documentation

◆ XsString

typedef struct XsString XsString

Definition at line 87 of file xsstring.h.

Function Documentation

◆ XSARRAY_STRUCT()

XSARRAY_STRUCT ( XsString  ,
char   
)

◆ XsString_append()

XSTYPES_DLL_API void XsString_append ( XsString thisPtr,
XsString const *  other 
)

This function concatenates the other to this.

Definition at line 257 of file xsstring.c.

◆ XsString_assign()

XSTYPES_DLL_API void XsString_assign ( XsString thisPtr,
XsSize  count,
const char *  src 
)

Reinitializes the XsArray with space for count items and copies them from src.

This function reinitializes the object reserving space for at least count items in the buffer. count may be 0. If src is not 0, count items will be copied from src. Previous data will be cleared automatically, but the reserved space will not be reduced.

Parameters
countthe number of items in src
srca pointer to an array of items
See also
XsArray_reserve
Note
Specialization for XsString

Definition at line 142 of file xsstring.c.

◆ XsString_assignCharArray()

XSTYPES_DLL_API void XsString_assignCharArray ( XsString thisPtr,
const char *  src 
)

This function determines the size of src and copies the contents to the object.

Definition at line 172 of file xsstring.c.

◆ XsString_assignWCharArray()

XSTYPES_DLL_API void XsString_assignWCharArray ( XsString thisPtr,
const wchar_t *  src 
)

This function determines the size of src and copies the contents to the object after converting it from a unicode string to a multibyte character string.

Definition at line 181 of file xsstring.c.

◆ XsString_construct()

XSTYPES_DLL_API void XsString_construct ( XsString thisPtr)

Initializes the XsString object as an empty string.

This function initializes the object as an empty string.

Definition at line 126 of file xsstring.c.

◆ XsString_contains()

XSTYPES_DLL_API int XsString_contains ( XsString const *  thisPtr,
XsString const *  other,
int  caseSensitive,
XsSize offset 
)

Returns whether this string contains other.

Parameters
otherThe string to match with this string
caseSensitiveWhether to compare case sensitive or not (case insensitive is the default)
offsetwhen not null, this will be filled with the offset at which other was found
Returns
true when the string contains the given string

Definition at line 460 of file xsstring.c.

◆ XsString_copyToWCharArray()

XSTYPES_DLL_API XsSize XsString_copyToWCharArray ( const XsString thisPtr,
wchar_t *  dest,
XsSize  size 
)

This function copies the contents of the object to a unicode wchar_t array.

Definition at line 215 of file xsstring.c.

◆ XsString_destruct()

XSTYPES_DLL_API void XsString_destruct ( XsString thisPtr)

Clears and frees memory allocated by the XsArray.

Note
After XsArray_destruct is called, the object is empty but valid, ie. it can be used as if XsArray_construct has been called on it.
Specialization for XsString

Definition at line 134 of file xsstring.c.

◆ XsString_empty()

XSTYPES_DLL_API int XsString_empty ( XsString const *  thisPtr)

Returns true when the supplied string is empty.

Returns
true when the string is empty

Definition at line 493 of file xsstring.c.

◆ XsString_endsWith()

XSTYPES_DLL_API int XsString_endsWith ( XsString const *  thisPtr,
XsString const *  other,
int  caseSensitive 
)

Returns whether this string ends with other.

Parameters
otherThe string to match with the end of this string
caseSensitiveWhether to compare case sensitive or not
Returns
true when the string ends with the given string

Definition at line 398 of file xsstring.c.

◆ XsString_erase()

XSTYPES_DLL_API void XsString_erase ( XsString thisPtr,
XsSize  index,
XsSize  count 
)

Removes a count items from the list starting at index.

Note
The function maintains the terminating 0 character

Definition at line 276 of file xsstring.c.

◆ XsString_findSubStr()

XSTYPES_DLL_API ptrdiff_t XsString_findSubStr ( XsString const *  thisPtr,
XsString const *  needle 
)

Find the first occurrence of needle in the string.

Parameters
needleThe string to find
Returns
The offset of needle or -1 if it was not found

Definition at line 537 of file xsstring.c.

◆ XsString_mid()

XSTYPES_DLL_API void XsString_mid ( XsString thisPtr,
XsString const *  source,
XsSize  start,
XsSize  count 
)

Copy a substring of the source string.

The function copies up to count characters from source to the string, starting at offset start

Parameters
sourceThe source to copy from
startThe offset of the first character to copy
countThe maximum number of characters to copy

Definition at line 568 of file xsstring.c.

◆ XsString_push_back()

XSTYPES_DLL_API void XsString_push_back ( XsString thisPtr,
char  c 
)

Append character c to the string.

Parameters
cThe character to append

Definition at line 292 of file xsstring.c.

◆ XsString_push_backWChar()

XSTYPES_DLL_API void XsString_push_backWChar ( XsString thisPtr,
wchar_t  c 
)

Append unicode character c to the string.

Parameters
cThe character to append

Definition at line 227 of file xsstring.c.

◆ XsString_replaceAll()

XSTYPES_DLL_API void XsString_replaceAll ( XsString thisPtr,
XsString const *  src,
XsString const *  dst 
)

Replace all occurrences of src with dst, modifying thisPtr.

Parameters
srcSubstring to search for
dstSubstring to use as replacement

Definition at line 586 of file xsstring.c.

◆ XsString_resize()

XSTYPES_DLL_API void XsString_resize ( XsString thisPtr,
XsSize  count 
)

This function resizes the contained string to the desired size, while retaining its contents.

Parameters
countThe desired size of the string. This excludes the terminating 0 character.
See also
XsArray_resize

Definition at line 243 of file xsstring.c.

◆ XsString_reverse()

XSTYPES_DLL_API void XsString_reverse ( XsString thisPtr)

Reverses the contents of the string.

This reverses the contents in-place

Note
This does not take into account utf-8 encoded characters

Definition at line 515 of file xsstring.c.

◆ XsString_sort()

XSTYPES_DLL_API void XsString_sort ( XsString thisPtr)

Sorts the string.

This function sorts using qsort

Definition at line 505 of file xsstring.c.

◆ XsString_startsWith()

XSTYPES_DLL_API int XsString_startsWith ( XsString const *  thisPtr,
XsString const *  other,
int  caseSensitive 
)

Returns whether this string starts with other.

Parameters
otherThe string to match with the start of this string
caseSensitiveWhether to compare case sensitive or not
Returns
true when the string starts with the given string

Definition at line 430 of file xsstring.c.

◆ XsString_trimmed()

XSTYPES_DLL_API void XsString_trimmed ( XsString thisPtr,
XsString const *  source 
)

Fills thisPtr with a copy of source with all its leading and trailing whitespace removed.

Parameters
sourceThe original string to use as source.

Definition at line 633 of file xsstring.c.

◆ XsString_utf8At()

XSTYPES_DLL_API wchar_t XsString_utf8At ( XsString const *  thisPtr,
XsSize  index 
)

The decoded UTF-8 character at index index in the UTF-8 encoded string.

http://en.wikipedia.org/wiki/Utf-8#Description

Parameters
indexThe index of the character to return.
Returns
the decoded UTF-8 character at index index in the UTF-8 encoded string

Definition at line 355 of file xsstring.c.

◆ XsString_utf8Len()

XSTYPES_DLL_API XsSize XsString_utf8Len ( XsString const *  thisPtr)

Returns the number of characters in a UTF-8 encoded string.

http://en.wikipedia.org/wiki/Utf-8#Description

Returns
the number of characters in a UTF-8 encoded string

Definition at line 325 of file xsstring.c.

Variable Documentation

◆ g_xsStringDescriptor

const XsArrayDescriptor XSTYPES_DLL_API g_xsStringDescriptor

Descriptor for XsInt64Array.

Definition at line 111 of file xsstring.c.



xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:21