ucx/cx/string.h

Sat, 07 Dec 2024 18:56:37 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 07 Dec 2024 18:56:37 +0100
changeset 0
1a157da63d7c
child 11
0aa8cbd7912e
permissions
-rw-r--r--

add API for registering types and simple SQLite proof of concept

0
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 * \file string.h
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 * \brief Strings that know their length.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 * \author Mike Becker
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 * \author Olaf Wintermann
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 * \copyright 2-Clause BSD License
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #ifndef UCX_STRING_H
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 #define UCX_STRING_H
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 #include "common.h"
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 #include "allocator.h"
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43 * The maximum length of the "needle" in cx_strstr() that can use SBO.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 extern unsigned const cx_strstr_sbo_size;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 * The UCX string structure.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 struct cx_mutstr_s {
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 * A pointer to the string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 * \note The string is not necessarily \c NULL terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 * Always use the length.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 char *ptr;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 /** The length of the string */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 size_t length;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 };
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 * A mutable string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 typedef struct cx_mutstr_s cxmutstr;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 * The UCX string structure for immutable (constant) strings.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 struct cx_string_s {
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 * A pointer to the immutable string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 * \note The string is not necessarily \c NULL terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 * Always use the length.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 char const *ptr;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 /** The length of the string */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 size_t length;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 };
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 * An immutable string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 typedef struct cx_string_s cxstring;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 * Context for string tokenizing.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 struct cx_strtok_ctx_s {
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 * The string to tokenize.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 cxstring str;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94 * The primary delimiter.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96 cxstring delim;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 * Optional array of more delimiters.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100 cxstring const *delim_more;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 * Length of the array containing more delimiters.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 size_t delim_more_count;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106 * Position of the currently active token in the source string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 size_t pos;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110 * Position of next delimiter in the source string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112 * If the tokenizer has not yet returned a token, the content of this field
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 * is undefined. If the tokenizer reached the end of the string, this field
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 * contains the length of the source string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 size_t delim_pos;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118 * The position of the next token in the source string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120 size_t next_pos;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 * The number of already found tokens.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 size_t found;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 * The maximum number of tokens that shall be returned.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 size_t limit;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129 };
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 * A string tokenizing context.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134 typedef struct cx_strtok_ctx_s CxStrtokCtx;
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 #ifdef __cplusplus
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137 extern "C" {
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140 * A literal initializer for an UCX string structure.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 * @param literal the string literal
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144 #define CX_STR(literal) cxstring{literal, sizeof(literal) - 1}
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146 #else // __cplusplus
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 * A literal initializer for an UCX string structure.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151 * The argument MUST be a string (const char*) \em literal.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153 * @param literal the string literal
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 #define CX_STR(literal) (cxstring){literal, sizeof(literal) - 1}
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
156
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 #endif
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 * Wraps a mutable string that must be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163 * The length is implicitly inferred by using a call to \c strlen().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 * \note the wrapped string will share the specified pointer to the string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 * If you do want a copy, use cx_strdup() on the return value of this function.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168 * If you need to wrap a constant string, use cx_str().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 * @param cstring the string to wrap, must be zero-terminated
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171 * @return the wrapped string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
173 * @see cx_mutstrn()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176 cxmutstr cx_mutstr(char *cstring);
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179 * Wraps a string that does not need to be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 * The argument may be \c NULL if the length is zero.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183 * \note the wrapped string will share the specified pointer to the string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 * If you do want a copy, use cx_strdup() on the return value of this function.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 * If you need to wrap a constant string, use cx_strn().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
188 * @param cstring the string to wrap (or \c NULL, only if the length is zero)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 * @param length the length of the string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190 * @return the wrapped string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 * @see cx_mutstr()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
194 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
195 cxmutstr cx_mutstrn(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
196 char *cstring,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
197 size_t length
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
198 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
199
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
200 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
201 * Wraps a string that must be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
203 * The length is implicitly inferred by using a call to \c strlen().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 * \note the wrapped string will share the specified pointer to the string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206 * If you do want a copy, use cx_strdup() on the return value of this function.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
207 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
208 * If you need to wrap a non-constant string, use cx_mutstr().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
210 * @param cstring the string to wrap, must be zero-terminated
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
211 * @return the wrapped string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
212 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
213 * @see cx_strn()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
216 cxstring cx_str(char const *cstring);
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
217
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
218
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
219 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
220 * Wraps a string that does not need to be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
221 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
222 * The argument may be \c NULL if the length is zero.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
223 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
224 * \note the wrapped string will share the specified pointer to the string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
225 * If you do want a copy, use cx_strdup() on the return value of this function.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
226 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
227 * If you need to wrap a non-constant string, use cx_mutstrn().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
228 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
229 * @param cstring the string to wrap (or \c NULL, only if the length is zero)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
230 * @param length the length of the string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
231 * @return the wrapped string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
232 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
233 * @see cx_str()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
234 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
235 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
236 cxstring cx_strn(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
237 char const *cstring,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
238 size_t length
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
239 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
240
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
242 * Casts a mutable string to an immutable string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
244 * \note This is not seriously a cast. Instead you get a copy
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
245 * of the struct with the desired pointer type. Both structs still
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
246 * point to the same location, though!
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
247 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
248 * @param str the mutable string to cast
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
249 * @return an immutable copy of the string pointer
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
250 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
251 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
252 cxstring cx_strcast(cxmutstr str);
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
253
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
254 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
255 * Passes the pointer in this string to \c free().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
256 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
257 * The pointer in the struct is set to \c NULL and the length is set to zero.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
258 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
259 * \note There is no implementation for cxstring, because it is unlikely that
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
260 * you ever have a \c char \c const* you are really supposed to free. If you
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
261 * encounter such situation, you should double-check your code.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
262 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
263 * @param str the string to free
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
264 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
265 __attribute__((__nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
266 void cx_strfree(cxmutstr *str);
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
267
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
268 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
269 * Passes the pointer in this string to the allocators free function.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
270 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
271 * The pointer in the struct is set to \c NULL and the length is set to zero.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
272 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
273 * \note There is no implementation for cxstring, because it is unlikely that
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
274 * you ever have a \c char \c const* you are really supposed to free. If you
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
275 * encounter such situation, you should double-check your code.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
276 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
277 * @param alloc the allocator
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
278 * @param str the string to free
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
279 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
280 __attribute__((__nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
281 void cx_strfree_a(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
282 CxAllocator const *alloc,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
283 cxmutstr *str
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
284 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
285
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
286 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
287 * Returns the accumulated length of all specified strings.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
288 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
289 * \attention if the count argument is larger than the number of the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
290 * specified strings, the behavior is undefined.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
291 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
292 * @param count the total number of specified strings
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
293 * @param ... all strings
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
294 * @return the accumulated length of all strings
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
295 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
296 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
297 size_t cx_strlen(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
298 size_t count,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
299 ...
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
300 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
301
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
302 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
303 * Concatenates strings.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
304 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
305 * The resulting string will be allocated by the specified allocator.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
306 * So developers \em must pass the return value to cx_strfree_a() eventually.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
307 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
308 * If \p str already contains a string, the memory will be reallocated and
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
309 * the other strings are appended. Otherwise, new memory is allocated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
310 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
311 * \note It is guaranteed that there is only one allocation.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
312 * It is also guaranteed that the returned string is zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
313 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
314 * @param alloc the allocator to use
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
315 * @param str the string the other strings shall be concatenated to
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
316 * @param count the number of the other following strings to concatenate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
317 * @param ... all other strings
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
318 * @return the concatenated string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
319 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
320 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
321 cxmutstr cx_strcat_ma(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
322 CxAllocator const *alloc,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
323 cxmutstr str,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
324 size_t count,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
325 ...
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
326 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
327
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
328 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
329 * Concatenates strings and returns a new string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
330 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
331 * The resulting string will be allocated by the specified allocator.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
332 * So developers \em must pass the return value to cx_strfree_a() eventually.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
333 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
334 * \note It is guaranteed that there is only one allocation.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
335 * It is also guaranteed that the returned string is zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
336 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
337 * @param alloc the allocator to use
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
338 * @param count the number of the other following strings to concatenate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
339 * @param ... all other strings
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
340 * @return the concatenated string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
341 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
342 #define cx_strcat_a(alloc, count, ...) \
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
343 cx_strcat_ma(alloc, cx_mutstrn(NULL, 0), count, __VA_ARGS__)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
344
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
345 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
346 * Concatenates strings and returns a new string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
347 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
348 * The resulting string will be allocated by standard \c malloc().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
349 * So developers \em must pass the return value to cx_strfree() eventually.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
350 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
351 * \note It is guaranteed that there is only one allocation.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
352 * It is also guaranteed that the returned string is zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
353 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
354 * @param count the number of the other following strings to concatenate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
355 * @param ... all other strings
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
356 * @return the concatenated string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
357 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
358 #define cx_strcat(count, ...) \
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
359 cx_strcat_ma(cxDefaultAllocator, cx_mutstrn(NULL, 0), count, __VA_ARGS__)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
360
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
361 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
362 * Concatenates strings.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
363 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
364 * The resulting string will be allocated by standard \c malloc().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
365 * So developers \em must pass the return value to cx_strfree() eventually.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
366 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
367 * If \p str already contains a string, the memory will be reallocated and
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
368 * the other strings are appended. Otherwise, new memory is allocated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
369 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
370 * \note It is guaranteed that there is only one allocation.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
371 * It is also guaranteed that the returned string is zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
372 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
373 * @param str the string the other strings shall be concatenated to
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
374 * @param count the number of the other following strings to concatenate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
375 * @param ... all other strings
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
376 * @return the concatenated string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
377 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
378 #define cx_strcat_m(str, count, ...) \
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
379 cx_strcat_ma(cxDefaultAllocator, str, count, __VA_ARGS__)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
380
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
381 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
382 * Returns a substring starting at the specified location.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
383 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
384 * \attention the new string references the same memory area as the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
385 * input string and is usually \em not zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
386 * Use cx_strdup() to get a copy.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
387 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
388 * @param string input string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
389 * @param start start location of the substring
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
390 * @return a substring of \p string starting at \p start
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
391 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
392 * @see cx_strsubsl()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
393 * @see cx_strsubs_m()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
394 * @see cx_strsubsl_m()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
395 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
396 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
397 cxstring cx_strsubs(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
398 cxstring string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
399 size_t start
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
400 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
401
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
402 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
403 * Returns a substring starting at the specified location.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
404 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
405 * The returned string will be limited to \p length bytes or the number
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
406 * of bytes available in \p string, whichever is smaller.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
407 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
408 * \attention the new string references the same memory area as the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
409 * input string and is usually \em not zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
410 * Use cx_strdup() to get a copy.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
411 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
412 * @param string input string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
413 * @param start start location of the substring
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
414 * @param length the maximum length of the returned string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
415 * @return a substring of \p string starting at \p start
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
416 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
417 * @see cx_strsubs()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
418 * @see cx_strsubs_m()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
419 * @see cx_strsubsl_m()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
420 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
421 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
422 cxstring cx_strsubsl(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
423 cxstring string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
424 size_t start,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
425 size_t length
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
426 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
427
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
428 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
429 * Returns a substring starting at the specified location.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
430 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
431 * \attention the new string references the same memory area as the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
432 * input string and is usually \em not zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
433 * Use cx_strdup() to get a copy.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
434 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
435 * @param string input string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
436 * @param start start location of the substring
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
437 * @return a substring of \p string starting at \p start
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
438 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
439 * @see cx_strsubsl_m()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
440 * @see cx_strsubs()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
441 * @see cx_strsubsl()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
442 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
443 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
444 cxmutstr cx_strsubs_m(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
445 cxmutstr string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
446 size_t start
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
447 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
448
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
449 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
450 * Returns a substring starting at the specified location.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
451 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
452 * The returned string will be limited to \p length bytes or the number
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
453 * of bytes available in \p string, whichever is smaller.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
454 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
455 * \attention the new string references the same memory area as the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
456 * input string and is usually \em not zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
457 * Use cx_strdup() to get a copy.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
458 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
459 * @param string input string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
460 * @param start start location of the substring
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
461 * @param length the maximum length of the returned string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
462 * @return a substring of \p string starting at \p start
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
463 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
464 * @see cx_strsubs_m()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
465 * @see cx_strsubs()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
466 * @see cx_strsubsl()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
467 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
468 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
469 cxmutstr cx_strsubsl_m(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
470 cxmutstr string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
471 size_t start,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
472 size_t length
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
473 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
474
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
475 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
476 * Returns a substring starting at the location of the first occurrence of the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
477 * specified character.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
478 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
479 * If the string does not contain the character, an empty string is returned.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
480 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
481 * @param string the string where to locate the character
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
482 * @param chr the character to locate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
483 * @return a substring starting at the first location of \p chr
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
484 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
485 * @see cx_strchr_m()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
486 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
487 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
488 cxstring cx_strchr(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
489 cxstring string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
490 int chr
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
491 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
492
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
493 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
494 * Returns a substring starting at the location of the first occurrence of the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
495 * specified character.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
496 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
497 * If the string does not contain the character, an empty string is returned.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
498 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
499 * @param string the string where to locate the character
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
500 * @param chr the character to locate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
501 * @return a substring starting at the first location of \p chr
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
502 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
503 * @see cx_strchr()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
504 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
505 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
506 cxmutstr cx_strchr_m(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
507 cxmutstr string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
508 int chr
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
509 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
510
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
511 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
512 * Returns a substring starting at the location of the last occurrence of the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
513 * specified character.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
514 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
515 * If the string does not contain the character, an empty string is returned.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
516 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
517 * @param string the string where to locate the character
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
518 * @param chr the character to locate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
519 * @return a substring starting at the last location of \p chr
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
520 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
521 * @see cx_strrchr_m()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
522 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
523 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
524 cxstring cx_strrchr(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
525 cxstring string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
526 int chr
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
527 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
528
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
529 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
530 * Returns a substring starting at the location of the last occurrence of the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
531 * specified character.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
532 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
533 * If the string does not contain the character, an empty string is returned.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
534 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
535 * @param string the string where to locate the character
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
536 * @param chr the character to locate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
537 * @return a substring starting at the last location of \p chr
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
538 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
539 * @see cx_strrchr()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
540 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
541 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
542 cxmutstr cx_strrchr_m(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
543 cxmutstr string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
544 int chr
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
545 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
546
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
547 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
548 * Returns a substring starting at the location of the first occurrence of the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
549 * specified string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
550 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
551 * If \p haystack does not contain \p needle, an empty string is returned.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
552 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
553 * If \p needle is an empty string, the complete \p haystack is
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
554 * returned.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
555 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
556 * @param haystack the string to be scanned
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
557 * @param needle string containing the sequence of characters to match
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
558 * @return a substring starting at the first occurrence of
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
559 * \p needle, or an empty string, if the sequence is not
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
560 * contained
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
561 * @see cx_strstr_m()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
562 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
563 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
564 cxstring cx_strstr(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
565 cxstring haystack,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
566 cxstring needle
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
567 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
568
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
569 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
570 * Returns a substring starting at the location of the first occurrence of the
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
571 * specified string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
572 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
573 * If \p haystack does not contain \p needle, an empty string is returned.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
574 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
575 * If \p needle is an empty string, the complete \p haystack is
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
576 * returned.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
577 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
578 * @param haystack the string to be scanned
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
579 * @param needle string containing the sequence of characters to match
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
580 * @return a substring starting at the first occurrence of
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
581 * \p needle, or an empty string, if the sequence is not
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
582 * contained
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
583 * @see cx_strstr()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
584 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
585 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
586 cxmutstr cx_strstr_m(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
587 cxmutstr haystack,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
588 cxstring needle
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
589 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
590
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
591 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
592 * Splits a given string using a delimiter string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
593 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
594 * \note The resulting array contains strings that point to the source
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
595 * \p string. Use cx_strdup() to get copies.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
596 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
597 * @param string the string to split
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
598 * @param delim the delimiter
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
599 * @param limit the maximum number of split items
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
600 * @param output a pre-allocated array of at least \p limit length
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
601 * @return the actual number of split items
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
602 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
603 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
604 size_t cx_strsplit(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
605 cxstring string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
606 cxstring delim,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
607 size_t limit,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
608 cxstring *output
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
609 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
610
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
611 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
612 * Splits a given string using a delimiter string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
613 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
614 * The array pointed to by \p output will be allocated by \p allocator.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
615 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
616 * \note The resulting array contains strings that point to the source
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
617 * \p string. Use cx_strdup() to get copies.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
618 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
619 * \attention If allocation fails, the \c NULL pointer will be written to
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
620 * \p output and the number returned will be zero.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
621 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
622 * @param allocator the allocator to use for allocating the resulting array
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
623 * @param string the string to split
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
624 * @param delim the delimiter
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
625 * @param limit the maximum number of split items
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
626 * @param output a pointer where the address of the allocated array shall be
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
627 * written to
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
628 * @return the actual number of split items
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
629 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
630 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
631 size_t cx_strsplit_a(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
632 CxAllocator const *allocator,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
633 cxstring string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
634 cxstring delim,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
635 size_t limit,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
636 cxstring **output
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
637 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
638
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
639
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
640 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
641 * Splits a given string using a delimiter string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
642 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
643 * \note The resulting array contains strings that point to the source
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
644 * \p string. Use cx_strdup() to get copies.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
645 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
646 * @param string the string to split
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
647 * @param delim the delimiter
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
648 * @param limit the maximum number of split items
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
649 * @param output a pre-allocated array of at least \p limit length
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
650 * @return the actual number of split items
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
651 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
652 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
653 size_t cx_strsplit_m(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
654 cxmutstr string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
655 cxstring delim,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
656 size_t limit,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
657 cxmutstr *output
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
658 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
659
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
660 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
661 * Splits a given string using a delimiter string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
662 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
663 * The array pointed to by \p output will be allocated by \p allocator.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
664 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
665 * \note The resulting array contains strings that point to the source
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
666 * \p string. Use cx_strdup() to get copies.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
667 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
668 * \attention If allocation fails, the \c NULL pointer will be written to
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
669 * \p output and the number returned will be zero.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
670 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
671 * @param allocator the allocator to use for allocating the resulting array
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
672 * @param string the string to split
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
673 * @param delim the delimiter
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
674 * @param limit the maximum number of split items
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
675 * @param output a pointer where the address of the allocated array shall be
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
676 * written to
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
677 * @return the actual number of split items
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
678 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
679 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
680 size_t cx_strsplit_ma(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
681 CxAllocator const *allocator,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
682 cxmutstr string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
683 cxstring delim,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
684 size_t limit,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
685 cxmutstr **output
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
686 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
687
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
688 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
689 * Compares two strings.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
690 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
691 * @param s1 the first string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
692 * @param s2 the second string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
693 * @return negative if \p s1 is smaller than \p s2, positive if \p s1 is larger
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
694 * than \p s2, zero if both strings equal
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
695 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
696 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
697 int cx_strcmp(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
698 cxstring s1,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
699 cxstring s2
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
700 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
701
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
702 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
703 * Compares two strings ignoring case.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
704 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
705 * @param s1 the first string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
706 * @param s2 the second string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
707 * @return negative if \p s1 is smaller than \p s2, positive if \p s1 is larger
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
708 * than \p s2, zero if both strings equal ignoring case
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
709 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
710 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
711 int cx_strcasecmp(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
712 cxstring s1,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
713 cxstring s2
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
714 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
715
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
716 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
717 * Compares two strings.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
718 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
719 * This function has a compatible signature for the use as a cx_compare_func.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
720 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
721 * @param s1 the first string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
722 * @param s2 the second string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
723 * @return negative if \p s1 is smaller than \p s2, positive if \p s1 is larger
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
724 * than \p s2, zero if both strings equal
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
725 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
726 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
727 int cx_strcmp_p(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
728 void const *s1,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
729 void const *s2
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
730 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
731
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
732 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
733 * Compares two strings ignoring case.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
734 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
735 * This function has a compatible signature for the use as a cx_compare_func.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
736 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
737 * @param s1 the first string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
738 * @param s2 the second string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
739 * @return negative if \p s1 is smaller than \p s2, positive if \p s1 is larger
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
740 * than \p s2, zero if both strings equal ignoring case
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
741 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
742 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
743 int cx_strcasecmp_p(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
744 void const *s1,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
745 void const *s2
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
746 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
747
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
748
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
749 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
750 * Creates a duplicate of the specified string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
751 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
752 * The new string will contain a copy allocated by \p allocator.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
753 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
754 * \note The returned string is guaranteed to be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
755 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
756 * @param allocator the allocator to use
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
757 * @param string the string to duplicate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
758 * @return a duplicate of the string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
759 * @see cx_strdup()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
760 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
761 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
762 cxmutstr cx_strdup_a(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
763 CxAllocator const *allocator,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
764 cxstring string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
765 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
766
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
767 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
768 * Creates a duplicate of the specified string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
769 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
770 * The new string will contain a copy allocated by standard
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
771 * \c malloc(). So developers \em must pass the return value to cx_strfree().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
772 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
773 * \note The returned string is guaranteed to be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
774 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
775 * @param string the string to duplicate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
776 * @return a duplicate of the string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
777 * @see cx_strdup_a()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
778 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
779 #define cx_strdup(string) cx_strdup_a(cxDefaultAllocator, string)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
780
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
781
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
782 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
783 * Creates a duplicate of the specified string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
784 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
785 * The new string will contain a copy allocated by \p allocator.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
786 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
787 * \note The returned string is guaranteed to be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
788 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
789 * @param allocator the allocator to use
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
790 * @param string the string to duplicate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
791 * @return a duplicate of the string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
792 * @see cx_strdup_m()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
793 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
794 #define cx_strdup_ma(allocator, string) cx_strdup_a(allocator, cx_strcast(string))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
795
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
796 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
797 * Creates a duplicate of the specified string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
798 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
799 * The new string will contain a copy allocated by standard
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
800 * \c malloc(). So developers \em must pass the return value to cx_strfree().
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
801 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
802 * \note The returned string is guaranteed to be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
803 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
804 * @param string the string to duplicate
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
805 * @return a duplicate of the string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
806 * @see cx_strdup_ma()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
807 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
808 #define cx_strdup_m(string) cx_strdup_a(cxDefaultAllocator, cx_strcast(string))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
809
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
810 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
811 * Omits leading and trailing spaces.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
812 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
813 * \note the returned string references the same memory, thus you
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
814 * must \em not free the returned memory.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
815 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
816 * @param string the string that shall be trimmed
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
817 * @return the trimmed string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
818 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
819 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
820 cxstring cx_strtrim(cxstring string);
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
821
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
822 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
823 * Omits leading and trailing spaces.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
824 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
825 * \note the returned string references the same memory, thus you
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
826 * must \em not free the returned memory.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
827 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
828 * @param string the string that shall be trimmed
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
829 * @return the trimmed string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
830 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
831 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
832 cxmutstr cx_strtrim_m(cxmutstr string);
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
833
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
834 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
835 * Checks, if a string has a specific prefix.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
836 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
837 * @param string the string to check
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
838 * @param prefix the prefix the string should have
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
839 * @return \c true, if and only if the string has the specified prefix,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
840 * \c false otherwise
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
841 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
842 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
843 bool cx_strprefix(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
844 cxstring string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
845 cxstring prefix
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
846 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
847
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
848 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
849 * Checks, if a string has a specific suffix.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
850 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
851 * @param string the string to check
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
852 * @param suffix the suffix the string should have
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
853 * @return \c true, if and only if the string has the specified suffix,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
854 * \c false otherwise
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
855 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
856 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
857 bool cx_strsuffix(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
858 cxstring string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
859 cxstring suffix
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
860 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
861
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
862 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
863 * Checks, if a string has a specific prefix, ignoring the case.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
864 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
865 * @param string the string to check
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
866 * @param prefix the prefix the string should have
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
867 * @return \c true, if and only if the string has the specified prefix,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
868 * \c false otherwise
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
869 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
870 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
871 bool cx_strcaseprefix(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
872 cxstring string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
873 cxstring prefix
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
874 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
875
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
876 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
877 * Checks, if a string has a specific suffix, ignoring the case.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
878 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
879 * @param string the string to check
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
880 * @param suffix the suffix the string should have
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
881 * @return \c true, if and only if the string has the specified suffix,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
882 * \c false otherwise
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
883 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
884 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
885 bool cx_strcasesuffix(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
886 cxstring string,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
887 cxstring suffix
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
888 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
889
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
890 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
891 * Converts the string to lower case.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
892 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
893 * The change is made in-place. If you want a copy, use cx_strdup(), first.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
894 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
895 * @param string the string to modify
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
896 * @see cx_strdup()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
897 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
898 void cx_strlower(cxmutstr string);
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
899
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
900 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
901 * Converts the string to upper case.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
902 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
903 * The change is made in-place. If you want a copy, use cx_strdup(), first.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
904 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
905 * @param string the string to modify
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
906 * @see cx_strdup()
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
907 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
908 void cx_strupper(cxmutstr string);
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
909
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
910 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
911 * Replaces a pattern in a string with another string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
912 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
913 * The pattern is taken literally and is no regular expression.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
914 * Replaces at most \p replmax occurrences.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
915 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
916 * The returned string will be allocated by \p allocator and is guaranteed
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
917 * to be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
918 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
919 * If allocation fails, or the input string is empty,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
920 * the returned string will be empty.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
921 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
922 * @param allocator the allocator to use
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
923 * @param str the string where replacements should be applied
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
924 * @param pattern the pattern to search for
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
925 * @param replacement the replacement string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
926 * @param replmax maximum number of replacements
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
927 * @return the resulting string after applying the replacements
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
928 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
929 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
930 cxmutstr cx_strreplacen_a(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
931 CxAllocator const *allocator,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
932 cxstring str,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
933 cxstring pattern,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
934 cxstring replacement,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
935 size_t replmax
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
936 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
937
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
938 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
939 * Replaces a pattern in a string with another string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
940 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
941 * The pattern is taken literally and is no regular expression.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
942 * Replaces at most \p replmax occurrences.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
943 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
944 * The returned string will be allocated by \c malloc() and is guaranteed
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
945 * to be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
946 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
947 * If allocation fails, or the input string is empty,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
948 * the returned string will be empty.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
949 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
950 * @param str the string where replacements should be applied
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
951 * @param pattern the pattern to search for
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
952 * @param replacement the replacement string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
953 * @param replmax maximum number of replacements
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
954 * @return the resulting string after applying the replacements
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
955 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
956 #define cx_strreplacen(str, pattern, replacement, replmax) \
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
957 cx_strreplacen_a(cxDefaultAllocator, str, pattern, replacement, replmax)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
958
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
959 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
960 * Replaces a pattern in a string with another string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
961 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
962 * The pattern is taken literally and is no regular expression.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
963 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
964 * The returned string will be allocated by \p allocator and is guaranteed
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
965 * to be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
966 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
967 * If allocation fails, or the input string is empty,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
968 * the returned string will be empty.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
969 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
970 * @param allocator the allocator to use
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
971 * @param str the string where replacements should be applied
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
972 * @param pattern the pattern to search for
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
973 * @param replacement the replacement string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
974 * @return the resulting string after applying the replacements
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
975 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
976 #define cx_strreplace_a(allocator, str, pattern, replacement) \
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
977 cx_strreplacen_a(allocator, str, pattern, replacement, SIZE_MAX)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
978
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
979 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
980 * Replaces a pattern in a string with another string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
981 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
982 * The pattern is taken literally and is no regular expression.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
983 * Replaces at most \p replmax occurrences.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
984 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
985 * The returned string will be allocated by \c malloc() and is guaranteed
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
986 * to be zero-terminated.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
987 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
988 * If allocation fails, or the input string is empty,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
989 * the returned string will be empty.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
990 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
991 * @param str the string where replacements should be applied
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
992 * @param pattern the pattern to search for
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
993 * @param replacement the replacement string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
994 * @return the resulting string after applying the replacements
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
995 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
996 #define cx_strreplace(str, pattern, replacement) \
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
997 cx_strreplacen_a(cxDefaultAllocator, str, pattern, replacement, SIZE_MAX)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
998
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
999 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1000 * Creates a string tokenization context.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1001 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1002 * @param str the string to tokenize
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1003 * @param delim the delimiter (must not be empty)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1004 * @param limit the maximum number of tokens that shall be returned
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1005 * @return a new string tokenization context
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1006 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1007 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1008 CxStrtokCtx cx_strtok(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1009 cxstring str,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1010 cxstring delim,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1011 size_t limit
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1012 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1013
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1014 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1015 * Creates a string tokenization context for a mutable string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1016 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1017 * @param str the string to tokenize
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1018 * @param delim the delimiter (must not be empty)
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1019 * @param limit the maximum number of tokens that shall be returned
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1020 * @return a new string tokenization context
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1021 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1022 __attribute__((__warn_unused_result__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1023 CxStrtokCtx cx_strtok_m(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1024 cxmutstr str,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1025 cxstring delim,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1026 size_t limit
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1027 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1028
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1029 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1030 * Returns the next token.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1031 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1032 * The token will point to the source string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1033 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1034 * @param ctx the tokenization context
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1035 * @param token a pointer to memory where the next token shall be stored
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1036 * @return true if successful, false if the limit or the end of the string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1037 * has been reached
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1038 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1039 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1040 bool cx_strtok_next(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1041 CxStrtokCtx *ctx,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1042 cxstring *token
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1043 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1044
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1045 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1046 * Returns the next token of a mutable string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1047 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1048 * The token will point to the source string.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1049 * If the context was not initialized over a mutable string, modifying
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1050 * the data of the returned token is undefined behavior.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1051 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1052 * @param ctx the tokenization context
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1053 * @param token a pointer to memory where the next token shall be stored
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1054 * @return true if successful, false if the limit or the end of the string
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1055 * has been reached
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1056 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1057 __attribute__((__warn_unused_result__, __nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1058 bool cx_strtok_next_m(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1059 CxStrtokCtx *ctx,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1060 cxmutstr *token
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1061 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1062
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1063 /**
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1064 * Defines an array of more delimiters for the specified tokenization context.
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1065 *
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1066 * @param ctx the tokenization context
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1067 * @param delim array of more delimiters
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1068 * @param count number of elements in the array
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1069 */
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1070 __attribute__((__nonnull__))
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1071 void cx_strtok_delim(
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1072 CxStrtokCtx *ctx,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1073 cxstring const *delim,
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1074 size_t count
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1075 );
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1076
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1077
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1078 #ifdef __cplusplus
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1079 } // extern "C"
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1080 #endif
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1081
1a157da63d7c add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1082 #endif //UCX_STRING_H

mercurial