xsstring.c
Go to the documentation of this file.
1 
2 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions, and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions, and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
14 //
15 // 3. Neither the names of the copyright holders nor the names of their contributors
16 // may be used to endorse or promote products derived from this software without
17 // specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
26 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
28 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
29 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
30 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
31 //
32 
33 
34 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
35 // All rights reserved.
36 //
37 // Redistribution and use in source and binary forms, with or without modification,
38 // are permitted provided that the following conditions are met:
39 //
40 // 1. Redistributions of source code must retain the above copyright notice,
41 // this list of conditions, and the following disclaimer.
42 //
43 // 2. Redistributions in binary form must reproduce the above copyright notice,
44 // this list of conditions, and the following disclaimer in the documentation
45 // and/or other materials provided with the distribution.
46 //
47 // 3. Neither the names of the copyright holders nor the names of their contributors
48 // may be used to endorse or promote products derived from this software without
49 // specific prior written permission.
50 //
51 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
52 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
53 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
54 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
56 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
58 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
60 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
61 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
62 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
63 //
64 
65 #include "xsstring.h"
66 #include <stdlib.h>
67 #include <string.h> // memcpy
68 #include <ctype.h>
69 
70 #if defined(WIN32)
71  #include <Windows.h>
72 #endif
73 
85 void swapChar(char* a, char* b)
86 {
87  char tmp = *a;
88  *a = *b;
89  *b = tmp;
90 }
91 
94 void copyChar(char* to, char const* from)
95 {
96  *to = *from;
97 }
98 
101 int compareChar(void const* a, void const* b)
102 {
103  if (*(char*)a < * (char*)b)
104  return -1;
105  if (*(char*)a > *(char*)b)
106  return 1;
107  return 0;
108 }
109 
112 {
113  sizeof(char), // const size_t itemSize; //!< \protected Size of a single data element
114  XSEXPCASTITEMSWAP swapChar, // void (*itemSwap)(void* a, void* b);
115  0, // void (*itemConstruct)(void* e);
116  XSEXPCASTITEMCOPY copyChar, // void (*itemCopyConstruct)(void* e, void const* s);
117  0, // void (*itemDestruct)(void* e);
118  XSEXPCASTITEMCOPY copyChar, // void (*itemCopy)(void const* from, void* to);
119  XSEXPCASTITEMCOMP compareChar, // int (*itemCompare)(void const* a, void const* b);
120  XSEXPCASTRAWCOPY XsArray_rawCopy // void (*rawCopy)(void* to, void const* from, XsSize count, XsSize iSize)
121 };
122 
127 {
128  XsArray_construct(thisPtr, &g_xsStringDescriptor, 0, 0);
129 }
130 
135 {
136  XsArray_destruct(thisPtr);
137 }
138 
142 void XsString_assign(XsString* thisPtr, XsSize count, const char* src)
143 {
144  if (!count && src)
145  count = (XsSize)strlen(src) + 1;
146 
147  if (src)
148  {
149  if (src[count - 1])
150  {
151  XsArray_assign(thisPtr, count + 1, 0);
152  memcpy(thisPtr->m_data, src, count);
153  thisPtr->m_data[count] = 0;
154  }
155  else
156  XsArray_assign(thisPtr, count, src);
157  }
158  else
159  {
160  if (count)
161  {
162  XsArray_assign(thisPtr, count + 1, 0);
163  memset(thisPtr->m_data, ' ', count);
164  thisPtr->m_data[count] = 0;
165  }
166  else
167  XsArray_assign(thisPtr, 0, 0);
168  }
169 }
170 
172 void XsString_assignCharArray(XsString* thisPtr, const char* src)
173 {
174  XsString_assign(thisPtr, 0, src);
175 }
176 
177 #ifndef XSENS_NO_WCHAR
178 
181 void XsString_assignWCharArray(XsString* thisPtr, const wchar_t* src)
182 {
183  if (src)
184  {
185 #ifdef WIN32
186  int unicodeLength = lstrlenW(src); // Convert all UNICODE characters
187  int required = WideCharToMultiByte(CP_UTF8, 0, src, unicodeLength, NULL, 0, NULL, NULL);
188  if (required != -1 && required > 0)
189  {
190  XsSize reqv = (XsSize)(ptrdiff_t)required + 1;
191  if (reqv > thisPtr->m_reserved)
192  XsArray_reserve(thisPtr, reqv);
193  WideCharToMultiByte(CP_UTF8, 0, src, unicodeLength, thisPtr->m_data, required + 1, NULL, NULL);
194  thisPtr->m_data[required] = '\0';
195  *((XsSize*) &thisPtr->m_size) = reqv;
196  return;
197  }
198 #else
199  size_t required = wcstombs(0, src, 0);
200  if (required != (size_t) -1 && required > 0)
201  {
202  if ((XsSize)required + 1 > thisPtr->m_reserved)
203  XsArray_reserve(thisPtr, required + 1);
204  wcstombs(thisPtr->m_data, src, required + 1);
205  *((XsSize*) &thisPtr->m_size) = required + 1;
206  return;
207  }
208 #endif
209  }
210  XsArray_assign(thisPtr, 0, 0);
211 }
212 
215 XsSize XsString_copyToWCharArray(const XsString* thisPtr, wchar_t* dest, XsSize size)
216 {
217 #ifdef WIN32
218  return (XsSize)(ptrdiff_t) MultiByteToWideChar(CP_UTF8, 0, thisPtr->m_data, (int)(ptrdiff_t) thisPtr->m_size, dest, (int)(ptrdiff_t) size);
219 #else
220  return mbstowcs(dest, thisPtr->m_data, size) + (dest ? 0 : 1);
221 #endif
222 }
223 
227 void XsString_push_backWChar(XsString* thisPtr, wchar_t c)
228 {
229  wchar_t buf[2] = { c, 0 };
230  XsString tmp;
231 
232  XsString_construct(&tmp);
233  XsString_assignWCharArray(&tmp, buf);
234  XsString_append(thisPtr, &tmp);
235  XsString_destruct(&tmp);
236 }
237 #endif // XSENS_NO_WCHAR
238 
243 void XsString_resize(XsString* thisPtr, XsSize count)
244 {
245  XsSize sz = thisPtr->m_size;
246  XsArray_resize(thisPtr, count ? count + 1 : 0);
247  if (count)
248  {
249  for (; sz < count; ++sz)
250  thisPtr->m_data[sz] = ' ';
251  thisPtr->m_data[count] = 0;
252  }
253 }
254 
257 void XsString_append(XsString* thisPtr, XsString const* other)
258 {
259  if (other && other->m_size > 1)
260  {
261  // remove terminating null from this and append arrays
262  XsArray_erase(thisPtr, thisPtr->m_size - 1, 1);
263  XsArray_append(thisPtr, other);
264  if (thisPtr == other)
265  {
266  // add terminating null again
267  static const char nullChar = 0;
268  XsArray_insert(thisPtr, (XsSize) - 1, 1, &nullChar);
269  }
270  }
271 }
272 
276 void XsString_erase(XsString* thisPtr, XsSize index, XsSize count)
277 {
278  if (index + count >= thisPtr->m_size)
279  {
280  if (index)
281  XsArray_erase(thisPtr, index, (thisPtr->m_size - 1) - index);
282  else
283  XsArray_erase(thisPtr, 0, thisPtr->m_size);
284  }
285  else
286  XsArray_erase(thisPtr, index, count);
287 }
288 
292 void XsString_push_back(XsString* thisPtr, char c)
293 {
294  XsSize sz = thisPtr->m_size;
295  if (!sz)
296  sz = 1;
297  XsString_resize(thisPtr, sz);
298  thisPtr->m_data[sz - 1] = c;
299 }
300 
301 uint8_t const* advanceUtf8(const uint8_t* p)
302 {
303  if ((*p & 0xC0) != 0xC0)
304  ++p;
305  else if (*p & 0x20)
306  if (*p & 0x10)
307  if (*p & 0x08)
308  if (*p & 0x04)
309  p += 6;
310  else
311  p += 5;
312  else
313  p += 4;
314  else
315  p += 3;
316  else
317  p += 2;
318  return p;
319 }
320 
326 {
327  XsSize count = 0;
328  uint8_t const* p = (uint8_t const*) thisPtr->m_data;
329 
330  if (!thisPtr || !thisPtr->m_data)
331  return 0;
332 
333  while (*p != 0)
334  {
335  ++count;
336  p = advanceUtf8(p);
337  }
338  return count;
339 }
340 
341 #ifndef XSENS_NO_WCHAR
342 int32_t shiftUtf8(int32_t t, uint8_t const* p, int bytes)
343 {
344  int i;
345  for (i = 0; i < bytes; ++i)
346  t = (t << 6) | (p[i] & 0x3F);
347  return t;
348 }
349 
355 wchar_t XsString_utf8At(XsString const* thisPtr, XsSize index)
356 {
357  int32_t t = 0;
358  uint8_t const* p = (uint8_t const*) thisPtr->m_data;
359 
360  if (!thisPtr || !thisPtr->m_data)
361  return 0;
362 
363  while (*p != 0 && index)
364  {
365  --index;
366  p = advanceUtf8(p);
367  }
368 
369  if (*p == 0)
370  return 0;
371 
372  // translate!
373 
374  if ((*p & 0xC0) != 0xC0)
375  t = (*p & 0x7F);
376  else if (*p & 0x20)
377  if (*p & 0x10)
378  if (*p & 0x08)
379  if (*p & 0x04)
380  t = shiftUtf8(p[0] & 0x01, p + 1, 5);
381  else
382  t = shiftUtf8(p[0] & 0x03, p + 1, 4);
383  else
384  t = shiftUtf8(p[0] & 0x07, p + 1, 3);
385  else
386  t = shiftUtf8(p[0] & 0x0F, p + 1, 2);
387  else
388  t = shiftUtf8(p[0] & 0x1F, p + 1, 1);
389  return (wchar_t) t;
390 }
391 #endif
392 
398 int XsString_endsWith(XsString const* thisPtr, XsString const* other, int caseSensitive)
399 {
400  const char* left;
401  const char* right;
402 
403  // we can never find a bigger string than our own string
404  if (thisPtr->m_size < other->m_size)
405  return 0;
406 
407  // we always match an empty string
408  if (other->m_size <= 1)
409  return 1;
410 
411  left = thisPtr->m_data + thisPtr->m_size - other->m_size;
412  right = other->m_data;
413 
414  if (caseSensitive)
415  for (; *left == *right && *right; ++left, ++right);
416  else
417  for (; tolower((unsigned char)*left) == tolower((unsigned char)*right) && *right; ++left, ++right);
418 
419  if (!*right)
420  return 1;
421 
422  return 0;
423 }
424 
430 int XsString_startsWith(XsString const* thisPtr, XsString const* other, int caseSensitive)
431 {
432  const char* left = thisPtr->m_data;
433  const char* right = other->m_data;
434 
435  // we can never find a bigger string than our own string
436  if (thisPtr->m_size < other->m_size)
437  return 0;
438 
439  // we always match an empty string
440  if (other->m_size <= 1)
441  return 1;
442 
443  if (caseSensitive)
444  for (; *left == *right && *right; ++left, ++right);
445  else
446  for (; tolower((unsigned char)*left) == tolower((unsigned char)*right) && *right; ++left, ++right);
447 
448  if (!*right)
449  return 1;
450 
451  return 0;
452 }
453 
460 int XsString_contains(XsString const* thisPtr, XsString const* other, int caseSensitive, XsSize* offset)
461 {
462  XsSize offsetI = 0;
463  if (!offset)
464  offset = &offsetI;
465  *offset = 0;
466 
467  // we always match an empty string
468  if (other->m_size <= 1)
469  return 1;
470 
471  // we can never find a bigger string than our own string
472  while (thisPtr->m_size - *offset >= other->m_size)
473  {
474  const char* left = thisPtr->m_data + *offset;
475  const char* right = other->m_data;
476  if (caseSensitive)
477  for (; *left == *right && *right; ++left, ++right);
478  else
479  for (; tolower((unsigned char)*left) == tolower((unsigned char)*right) && *right; ++left, ++right);
480 
481  if (!*right)
482  return 1;
483 
484  ++*offset;
485  }
486  *offset = (XsSize) - 1;
487  return 0;
488 }
489 
493 int XsString_empty(XsString const* thisPtr)
494 {
495  if (!thisPtr)
496  return 1;
497  if (!thisPtr->m_size || (thisPtr->m_flags & XSDF_Empty))
498  return 1;
499  return !(thisPtr->m_size - 1);
500 }
501 
505 void XsString_sort(XsString* thisPtr)
506 {
507  if (thisPtr->m_size > 2)
508  qsort(thisPtr->m_data, thisPtr->m_size - 1, sizeof(char), compareChar);
509 }
510 
516 {
517  int i, half;
518  char* data, tmp, *right;
519  if (thisPtr->m_size > 2)
520  {
521  half = (int)((thisPtr->m_size - 1) >> 1);
522  data = (char*) thisPtr->m_data;
523  right = data + thisPtr->m_size - 2;
524  for (i = 0; i < half; ++i)
525  {
526  tmp = data[i];
527  data[i] = right[-i];
528  right[-i] = tmp;
529  }
530  }
531 }
532 
537 ptrdiff_t XsString_findSubStr(XsString const* thisPtr, XsString const* needle)
538 {
539  XsSize offset, i, end, endN;
540  if (!thisPtr) // no string to search in
541  return -1;
542  if (!needle || needle->m_size <= 1) // empty string matches start of string, even if searchee is empty
543  return 0;
544  if (thisPtr->m_size <= 1 || thisPtr->m_size < needle->m_size)
545  return -1;
546 
547  end = thisPtr->m_size - needle->m_size;
548  endN = needle->m_size - 1;
549 
550  for (offset = 0; offset <= end; ++offset)
551  {
552  for (i = 0; i < endN; ++i)
553  if (thisPtr->m_data[offset + i] != needle->m_data[i])
554  break;
555  if (i == endN)
556  return (ptrdiff_t) offset; // found!
557  }
558  // not found
559  return -1;
560 }
561 
568 void XsString_mid(XsString* thisPtr, XsString const* source, XsSize start, XsSize count)
569 {
570  if (!thisPtr || !source)
571  return;
572  if (start >= source->m_size)
573  {
574  XsString_assign(thisPtr, 0, 0);
575  return;
576  }
577  if (start + count >= source->m_size)
578  count = (source->m_size - 1) - start;
579  XsString_assign(thisPtr, count, count ? source->m_data + start : 0);
580 }
581 
586 void XsString_replaceAll(XsString* thisPtr, XsString const* src, XsString const* dst)
587 {
588  XsSize offset, i, end, endN, start;
591  if (XsString_empty(thisPtr) || XsString_empty(src))
592  return;
593  XsString_construct(&rv);
594  XsString_construct(&sub);
595 
596  end = thisPtr->m_size - src->m_size;
597  endN = src->m_size - 1;
598  start = 0;
599 
600  for (offset = 0; offset <= end;)
601  {
602  for (i = 0; i < endN; ++i)
603  if (thisPtr->m_data[offset + i] != src->m_data[i])
604  break;
605  if (i == endN)
606  {
607  if (start < offset)
608  {
609  XsString_assign(&sub, offset - start, &thisPtr->m_data[start]);
610  XsString_append(&rv, &sub);
611  }
612  if (dst)
613  XsString_append(&rv, dst);
614  offset += endN;
615  start = offset;
616  }
617  else
618  ++offset;
619  }
620  if (start < thisPtr->m_size)
621  {
622  XsString_assign(&sub, thisPtr->m_size - start, &thisPtr->m_data[start]);
623  XsString_append(&rv, &sub);
624  }
625  XsString_swap(thisPtr, &rv);
626  XsString_destruct(&sub);
627  XsString_destruct(&rv);
628 }
629 
633 void XsString_trimmed(XsString* thisPtr, XsString const* source)
634 {
635  if (!source || XsString_empty(source))
636  XsString_destruct(thisPtr);
637  else
638  {
639  XsSize start = 0, end = source->m_size - 1;
640  while (start < end)
641  {
642  if (isspace(source->m_data[start]))
643  ++start;
644  else
645  break;
646  }
647  while (start < end)
648  {
649  if (isspace(source->m_data[end - 1]))
650  --end;
651  else
652  break;
653  }
654  if (start < end)
655  XsString_assign(thisPtr, end - start, &source->m_data[start]);
656  else
657  XsString_destruct(thisPtr);
658  }
659 }
XsArrayDescriptor
This object describes how to treat the data in an array.
Definition: xsarray.h:103
XsArray::XsArray_construct
void XsArray_construct(void *thisPtr, XsArrayDescriptor const *const descriptor, XsSize count, void const *src)
Initializes the XsArray with space for count items and copies them from src.
Definition: xsarray.c:102
advanceUtf8
uint8_t const * advanceUtf8(const uint8_t *p)
Definition: xsstring.c:301
XsArray::XsArray_rawCopy
void XsArray_rawCopy(void *to, void const *from, XsSize count, XsSize iSize)
Copies items optimized in a direct way.
Definition: xsarray.c:707
shiftUtf8
int32_t shiftUtf8(int32_t t, uint8_t const *p, int bytes)
Definition: xsstring.c:342
xsstring.h
XsString_destruct
void XsString_destruct(XsString *thisPtr)
Clears and frees memory allocated by the XsArray.
Definition: xsstring.c:134
XsString_trimmed
void XsString_trimmed(XsString *thisPtr, XsString const *source)
Fills thisPtr with a copy of source with all its leading and trailing whitespace removed.
Definition: xsstring.c:633
XsString_startsWith
int XsString_startsWith(XsString const *thisPtr, XsString const *other, int caseSensitive)
Returns whether this string starts with other.
Definition: xsstring.c:430
XsString_copyToWCharArray
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: xsstring.c:215
XsString_sort
void XsString_sort(XsString *thisPtr)
Sorts the string.
Definition: xsstring.c:505
XsString_empty
int XsString_empty(XsString const *thisPtr)
Returns true when the supplied string is empty.
Definition: xsstring.c:493
copyChar
void copyChar(char *to, char const *from)
The function to use for copying the data of from to to.
Definition: xsstring.c:94
XsArray::XsArray_destruct
void XsArray_destruct(void *thisPtr)
Clears and frees memory allocated by the XsArray.
Definition: xsarray.c:157
XsString_utf8Len
XsSize XsString_utf8Len(XsString const *thisPtr)
Returns the number of characters in a UTF-8 encoded string.
Definition: xsstring.c:325
swapChar
void swapChar(char *a, char *b)
The function to use for swapping the data of two array items.
Definition: xsstring.c:85
XsArray::XsArray_append
void XsArray_append(void *thisPtr, void const *other)
Appends the other list to thisArray list.
Definition: xsarray.c:319
XsString_append
void XsString_append(XsString *thisPtr, XsString const *other)
This function concatenates the other to this.
Definition: xsstring.c:257
XsString_replaceAll
void XsString_replaceAll(XsString *thisPtr, XsString const *src, XsString const *dst)
Replace all occurrences of src with dst, modifying thisPtr.
Definition: xsstring.c:586
XSSTRING_INITIALIZER
#define XSSTRING_INITIALIZER
Definition: xsstring.h:89
XsArray::XsArray_erase
void XsArray_erase(void *thisPtr, XsSize index, XsSize count)
Removes a count items from the list starting at index.
Definition: xsarray.c:448
data
data
XsString_findSubStr
ptrdiff_t XsString_findSubStr(XsString const *thisPtr, XsString const *needle)
Find the first occurrence of needle in the string.
Definition: xsstring.c:537
XsString_assignWCharArray
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 fr...
Definition: xsstring.c:181
XsString_contains
int XsString_contains(XsString const *thisPtr, XsString const *other, int caseSensitive, XsSize *offset)
Returns whether this string contains other.
Definition: xsstring.c:460
XsString_construct
void XsString_construct(XsString *thisPtr)
Initializes the XsString object as an empty string.
Definition: xsstring.c:126
XsString_reverse
void XsString_reverse(XsString *thisPtr)
Reverses the contents of the string.
Definition: xsstring.c:515
XsString_push_backWChar
void XsString_push_backWChar(XsString *thisPtr, wchar_t c)
Append unicode character c to the string.
Definition: xsstring.c:227
XsString_swap
#define XsString_swap(a, b)
Definition: xsstring.h:124
XsSize
size_t XsSize
XsSize must be unsigned number!
Definition: xstypedefs.h:74
XsArray::XsArray_assign
void XsArray_assign(void *thisPtr, XsSize count, void const *src)
Reinitializes the XsArray with space for count items and copies them from src.
Definition: xsarray.c:186
XsArray::XsArray_resize
void XsArray_resize(void *thisPtr, XsSize count)
Resizes the existing list to count items.
Definition: xsarray.c:227
XsArray::XsArray_insert
void XsArray_insert(void *thisPtr, XsSize index, XsSize count, void const *src)
Insert count items from src at index in the array.
Definition: xsarray.c:372
XSDF_Empty
@ XSDF_Empty
The object contains undefined data / should be considered empty. Usually only relevant when XSDF_Fixe...
Definition: xstypedefs.h:112
XsArray::XsArray_reserve
void XsArray_reserve(void *thisPtr, XsSize count)
Reserves space for count items.
Definition: xsarray.c:256
XsString_endsWith
int XsString_endsWith(XsString const *thisPtr, XsString const *other, int caseSensitive)
Returns whether this string ends with other.
Definition: xsstring.c:398
start
ROSCPP_DECL void start()
XsString_resize
void XsString_resize(XsString *thisPtr, XsSize count)
This function resizes the contained string to the desired size, while retaining its contents.
Definition: xsstring.c:243
XsString_push_back
void XsString_push_back(XsString *thisPtr, char c)
Append character c to the string.
Definition: xsstring.c:292
XsString_assignCharArray
void XsString_assignCharArray(XsString *thisPtr, const char *src)
This function determines the size of src and copies the contents to the object.
Definition: xsstring.c:172
int32_t
signed int int32_t
Definition: pstdint.h:515
g_xsStringDescriptor
const XsArrayDescriptor g_xsStringDescriptor
Descriptor for XsInt64Array.
Definition: xsstring.c:111
XsString_mid
void XsString_mid(XsString *thisPtr, XsString const *source, XsSize start, XsSize count)
Copy a substring of the source string.
Definition: xsstring.c:568
XsString_assign
void XsString_assign(XsString *thisPtr, XsSize count, const char *src)
Reinitializes the XsArray with space for count items and copies them from src.
Definition: xsstring.c:142
XsString_erase
void XsString_erase(XsString *thisPtr, XsSize index, XsSize count)
Removes a count items from the list starting at index.
Definition: xsstring.c:276
XsString_utf8At
wchar_t XsString_utf8At(XsString const *thisPtr, XsSize index)
The decoded UTF-8 character at index index in the UTF-8 encoded string.
Definition: xsstring.c:355
XsString
A 0-terminated managed string of characters.
compareChar
int compareChar(void const *a, void const *b)
The function to use for comparing two items.
Definition: xsstring.c:101


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