Vuo  2.0.0
VuoText.h
Go to the documentation of this file.
1 
10 #pragma once
11 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include <stdbool.h>
26 #include <string.h>
27 struct json_object;
28 #include "VuoTextCase.h"
29 #include "VuoTextComparison.h"
30 #include "VuoInteger.h"
31 #include "VuoList_VuoInteger.h"
32 #include <stdint.h>
33 
37 typedef const char * VuoText;
38 
42 typedef enum
43 {
44  VuoTextTruncation_Beginning,
45  VuoTextTruncation_End
47 
49 struct json_object * VuoText_getJson(const VuoText value);
50 char * VuoText_getSummary(const VuoText value);
51 
52 VuoText VuoText_make(const char * unquotedString);
53 VuoText VuoText_makeWithMaxLength(const void *data, const size_t maxLength);
54 VuoText VuoText_makeFromCFString(const void *cfString);
55 VuoText VuoText_makeFromData(const unsigned char *data, const unsigned long size);
56 VuoText VuoText_makeFromUtf32(const uint32_t* data, size_t length);
57 VuoText VuoText_makeFromMacRoman(const char *string);
58 size_t VuoText_length(const VuoText text);
59 size_t VuoText_byteCount(const VuoText text);
60 bool VuoText_isEmpty(const VuoText text);
61 
62 #define VuoText_SUPPORTS_COMPARISON
63 bool VuoText_areEqual(const VuoText text1, const VuoText text2);
64 bool VuoText_isLessThan(const VuoText text1, const VuoText text2);
65 
66 bool VuoText_isLessThanCaseInsensitive(const VuoText text1, const VuoText text2);
67 bool VuoText_isLessThanNumeric(const VuoText text1, const VuoText text2);
68 bool VuoText_compare(VuoText a, VuoTextComparison comparison, VuoText b);
69 size_t VuoText_findFirstOccurrence(const VuoText string, const VuoText substring, const size_t startIndex);
70 size_t VuoText_findLastOccurrence(const VuoText string, const VuoText substring);
71 VuoList_VuoInteger VuoText_findOccurrences(const VuoText string, const VuoText substring);
72 VuoText VuoText_substring(const VuoText string, int startIndex, int length);
73 VuoText VuoText_insert(const VuoText string, int startIndex, const VuoText newText);
74 VuoText VuoText_removeAt(const VuoText string, int startIndex, int length);
75 VuoText VuoText_append(VuoText *texts, size_t textsCount);
76 VuoText * VuoText_split(VuoText text, VuoText separator, bool includeEmptyParts, size_t *partsCount);
77 VuoText VuoText_replace(VuoText subject, VuoText stringToFind, VuoText replacement);
78 VuoText VuoText_truncateWithEllipsis(const VuoText subject, int maxLength, VuoTextTruncation where);
79 VuoText VuoText_trim(const VuoText text);
80 VuoText VuoText_changeCase(const VuoText text, VuoTextCase textCase);
81 uint32_t* VuoText_getUtf32Values(const VuoText text, size_t* length);
82 
83 #ifndef DOXYGEN
84  #define VUOTEXT_FORMAT_ATTRIBUTE __attribute__((format(printf, 1, 2)))
85 #else
86  #define VUOTEXT_FORMAT_ATTRIBUTE
87 #endif
88 char *VuoText_format(const char *format, ...) VUOTEXT_FORMAT_ATTRIBUTE;
89 
91 
94 VuoText VuoText_makeFromString(const char *str);
95 char * VuoText_getString(const VuoText value);
96 void VuoText_retain(VuoText value);
97 void VuoText_release(VuoText value);
99 
104 #ifdef __cplusplus
105 }
106 #endif