Thu, 29 May 2025 15:59:27 +0200
update ucx
|
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 | /** |
| 16 | 29 | * @file string.h |
| 30 | * @brief Strings that know their length. | |
| 31 | * @author Mike Becker | |
| 32 | * @author Olaf Wintermann | |
| 33 | * @copyright 2-Clause BSD License | |
|
0
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 | |
| 21 | 42 | /** Expands a UCX string as printf arguments. */ |
| 43 | #define CX_SFMT(s) (int) (s).length, (s).ptr | |
| 44 | ||
| 45 | /** Format specifier for a UCX string */ | |
| 46 | #define CX_PRIstr ".*s" | |
| 47 | ||
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | * 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
|
50 | */ |
| 16 | 51 | cx_attr_export |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
52 | extern const unsigned cx_strstr_sbo_size; |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | * 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
|
56 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | 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
|
58 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | * A pointer to the string. |
| 16 | 60 | * @note The string is not necessarily @c NULL terminated. |
|
0
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 | char *ptr; |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | /** 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
|
64 | size_t length; |
|
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 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | * A mutable string. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | 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
|
71 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | * 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
|
74 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | 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
|
76 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | * A pointer to the immutable string. |
| 16 | 78 | * @note The string is not necessarily @c NULL terminated. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
80 | const char *ptr; |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | /** 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
|
82 | size_t length; |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | }; |
|
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 | * An immutable string. |
|
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 | 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
|
89 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | * 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
|
92 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | 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
|
94 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | * 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
|
96 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | cxstring str; |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | * The primary delimiter. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | cxstring delim; |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | * 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
|
104 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
105 | const cxstring *delim_more; |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | * 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
|
108 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | 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
|
110 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | * 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
|
112 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | size_t pos; |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | * 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
|
116 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | * 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
|
118 | * 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
|
119 | * 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
|
120 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | 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
|
122 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | * 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
|
124 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | 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
|
126 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | * 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
|
128 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | size_t found; |
|
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 | * 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
|
132 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | size_t limit; |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
134 | }; |
|
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 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | * 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
|
138 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | 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
|
140 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | #ifdef __cplusplus |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | extern "C" { |
|
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 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
145 | * 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
|
146 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147 | * @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
|
148 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149 | #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
|
150 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151 | #else // __cplusplus |
|
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 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154 | * 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
|
155 | * |
| 16 | 156 | * The argument MUST be a string (const char*) @em literal. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158 | * @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
|
159 | */ |
| 21 | 160 | #define CX_STR(literal) ((cxstring){literal, sizeof(literal) - 1}) |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
161 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
162 | #endif |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
163 | |
|
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 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
166 | * 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
|
167 | * |
| 16 | 168 | * The length is implicitly inferred by using a call to @c strlen(). |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
169 | * |
| 16 | 170 | * @note the wrapped string will share the specified pointer to the string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
171 | * 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
|
172 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
173 | * 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
|
174 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
175 | * @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
|
176 | * @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
|
177 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
178 | * @see cx_mutstrn() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
179 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
180 | cx_attr_nonnull |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
181 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
182 | cx_attr_cstr_arg(1) |
| 16 | 183 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
184 | 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
|
185 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
186 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
187 | * 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
|
188 | * |
| 16 | 189 | * The argument may be @c NULL if the length is zero. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
190 | * |
| 16 | 191 | * @note the wrapped string will share the specified pointer to the string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
192 | * 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
|
193 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
194 | * 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
|
195 | * |
| 16 | 196 | * @param cstring the string to wrap (or @c NULL, only if the length is zero) |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
197 | * @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
|
198 | * @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
|
199 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
200 | * @see cx_mutstr() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
201 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
202 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
203 | cx_attr_access_rw(1, 2) |
| 16 | 204 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
205 | cxmutstr cx_mutstrn( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
206 | char *cstring, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
207 | size_t length |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
208 | ); |
|
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 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
211 | * 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
|
212 | * |
| 16 | 213 | * The length is implicitly inferred by using a call to @c strlen(). |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
214 | * |
| 16 | 215 | * @note the wrapped string will share the specified pointer to the string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
216 | * 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
|
217 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
218 | * 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
|
219 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
220 | * @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
|
221 | * @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
|
222 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
223 | * @see cx_strn() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
224 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
225 | cx_attr_nonnull |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
226 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
227 | cx_attr_cstr_arg(1) |
| 16 | 228 | cx_attr_export |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
229 | cxstring cx_str(const char *cstring); |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
230 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
231 | |
|
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 | * 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
|
234 | * |
| 16 | 235 | * The argument may be @c NULL if the length is zero. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
236 | * |
| 16 | 237 | * @note the wrapped string will share the specified pointer to the string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
238 | * 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
|
239 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
240 | * 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
|
241 | * |
| 16 | 242 | * @param cstring the string to wrap (or @c NULL, only if the length is zero) |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
243 | * @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
|
244 | * @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
|
245 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
246 | * @see cx_str() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
247 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
248 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
249 | cx_attr_access_r(1, 2) |
| 16 | 250 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
251 | cxstring cx_strn( |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
252 | const char *cstring, |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
253 | size_t length |
|
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 | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
256 | #ifdef __cplusplus |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
257 | } // extern "C" |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
258 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
259 | static inline cxstring cx_strcast(cxmutstr str) { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
260 | return cx_strn(str.ptr, str.length); |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
261 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
262 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
263 | static inline cxstring cx_strcast(cxstring str) { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
264 | return str; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
265 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
266 | extern "C" { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
267 | #else |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
268 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
269 | * Internal function, do not use. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
270 | * @param str |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
271 | * @return |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
272 | * @see cx_strcast() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
273 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
274 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
275 | static inline cxstring cx_strcast_m(cxmutstr str) { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
276 | return (cxstring) {str.ptr, str.length}; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
277 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
278 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
279 | * Internal function, do not use. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
280 | * @param str |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
281 | * @return |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
282 | * @see cx_strcast() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
283 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
284 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
285 | static inline cxstring cx_strcast_c(cxstring str) { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
286 | return str; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
287 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
288 | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
289 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
290 | * 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
|
291 | * |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
292 | * Does nothing for already immutable strings. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
293 | * |
| 16 | 294 | * @note This is not seriously a cast. Instead, you get a copy |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
295 | * 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
|
296 | * 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
|
297 | * |
| 16 | 298 | * @param str (@c cxstring or @c cxmutstr) the string to cast |
| 299 | * @return (@c cxstring) an immutable copy of the string pointer | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
300 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
301 | #define cx_strcast(str) _Generic((str), \ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
302 | cxmutstr: cx_strcast_m, \ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
303 | cxstring: cx_strcast_c) \ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
304 | (str) |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
305 | #endif |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
306 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
307 | /** |
| 21 | 308 | * Passes the pointer in this string to the cxDefaultAllocator's @c free() function. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
309 | * |
| 16 | 310 | * The pointer in the struct is set to @c NULL and the length is set to zero |
| 311 | * which means that this function protects you against double-free. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
312 | * |
| 16 | 313 | * @note There is no implementation for cxstring, because it is unlikely that |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
314 | * you ever have a <code>const char*</code> you are really supposed to free. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
315 | * If you encounter such situation, you should double-check your code. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
316 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
317 | * @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
|
318 | */ |
| 16 | 319 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
320 | 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
|
321 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
322 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
323 | * 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
|
324 | * |
| 16 | 325 | * The pointer in the struct is set to @c NULL and the length is set to zero |
| 326 | * which means that this function protects you against double-free. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
327 | * |
| 16 | 328 | * @note There is no implementation for cxstring, because it is unlikely that |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
329 | * you ever have a <code>const char*</code> you are really supposed to free. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
330 | * If you encounter such situation, you should double-check your code. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
331 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
332 | * @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
|
333 | * @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
|
334 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
335 | cx_attr_nonnull_arg(1) |
| 16 | 336 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
337 | void cx_strfree_a( |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
338 | const CxAllocator *alloc, |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
339 | cxmutstr *str |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
340 | ); |
|
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 | /** |
| 21 | 343 | * Copies a string. |
| 344 | * | |
| 345 | * The memory in the @p dest structure is either allocated or re-allocated to fit the entire | |
| 346 | * source string, including a zero-terminator. | |
| 347 | * | |
| 348 | * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is. | |
| 349 | * | |
| 350 | * @param alloc the allocator | |
| 351 | * @param dest a pointer to the structure where to copy the contents to | |
| 352 | * @param src the source string | |
| 353 | * | |
| 354 | * @retval zero success | |
| 355 | * @retval non-zero if re-allocation failed | |
| 356 | */ | |
| 357 | cx_attr_nonnull_arg(1) | |
| 358 | cx_attr_export | |
| 359 | int cx_strcpy_a( | |
| 360 | const CxAllocator *alloc, | |
| 361 | cxmutstr *dest, | |
| 362 | cxstring src | |
| 363 | ); | |
| 364 | ||
| 365 | ||
| 366 | /** | |
| 367 | * Copies a string. | |
| 368 | * | |
| 369 | * The memory in the @p dest structure is either allocated or re-allocated to fit the entire | |
| 370 | * source string, including a zero-terminator. | |
| 371 | * | |
| 372 | * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is. | |
| 373 | * | |
| 374 | * @param dest (@c cxmutstr*) a pointer to the structure where to copy the contents to | |
| 375 | * @param src (@c cxstring) the source string | |
| 376 | * | |
| 377 | * @retval zero success | |
| 378 | * @retval non-zero if re-allocation failed | |
| 379 | */ | |
| 380 | #define cx_strcpy(dest, src) cx_strcpy_a(cxDefaultAllocator, dest, src) | |
| 381 | ||
| 382 | /** | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
383 | * Returns the accumulated length of all specified strings. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
384 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
385 | * If this sum overflows, errno is set to EOVERFLOW. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
386 | * |
| 16 | 387 | * @attention if the count argument is larger than the number of the |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
388 | * 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
|
389 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
390 | * @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
|
391 | * @param ... all strings |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
392 | * @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
|
393 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
394 | cx_attr_nodiscard |
| 16 | 395 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
396 | 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
|
397 | size_t count, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
398 | ... |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
399 | ); |
|
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 | * Concatenates strings. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
403 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
404 | * The resulting string will be allocated by the specified allocator. |
| 16 | 405 | * So developers @em must pass the return value to cx_strfree_a() eventually. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
406 | * |
| 16 | 407 | * If @p str already contains a string, the memory will be reallocated and |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
408 | * 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
|
409 | * |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
410 | * If memory allocation fails, the pointer in the returned string will |
| 16 | 411 | * be @c NULL. Depending on the allocator, @c errno might be set. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
412 | * |
| 16 | 413 | * @note It is guaranteed that there is only one allocation for the |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
414 | * resulting string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
415 | * 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
|
416 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
417 | * @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
|
418 | * @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
|
419 | * @param count the number of the other following strings to concatenate |
| 16 | 420 | * @param ... all other UCX strings |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
421 | * @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
|
422 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
423 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
424 | cx_attr_nonnull |
| 16 | 425 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
426 | cxmutstr cx_strcat_ma( |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
427 | const CxAllocator *alloc, |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
428 | cxmutstr str, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
429 | size_t count, |
|
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 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
432 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
433 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
434 | * 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
|
435 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
436 | * The resulting string will be allocated by the specified allocator. |
| 16 | 437 | * So developers @em must pass the return value to cx_strfree_a() eventually. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
438 | * |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
439 | * If memory allocation fails, the pointer in the returned string will |
| 16 | 440 | * be @c NULL. Depending on the allocator, @c errno might be set. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
441 | * |
| 16 | 442 | * @note It is guaranteed that there is only one allocation for the |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
443 | * resulting string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
444 | * 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
|
445 | * |
| 16 | 446 | * @param alloc (@c CxAllocator*) the allocator to use |
| 447 | * @param count (@c size_t) the number of the other following strings to concatenate | |
| 448 | * @param ... all other UCX strings | |
| 449 | * @return (@c cxmutstr) the concatenated string | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
450 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
451 | #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
|
452 | 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
|
453 | |
|
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 | * 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
|
456 | * |
| 21 | 457 | * The resulting string will be allocated by the cxDefaultAllocator. |
| 16 | 458 | * So developers @em must pass the return value to cx_strfree() eventually. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
459 | * |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
460 | * If memory allocation fails, the pointer in the returned string will |
| 16 | 461 | * be @c NULL and @c errno might be set. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
462 | * |
| 16 | 463 | * @note It is guaranteed that there is only one allocation for the |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
464 | * resulting string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
465 | * 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
|
466 | * |
| 16 | 467 | * @param count (@c size_t) the number of the other following strings to concatenate |
| 468 | * @param ... all other UCX strings | |
| 469 | * @return (@c cxmutstr) the concatenated string | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
470 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
471 | #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
|
472 | 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
|
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 | * Concatenates strings. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
476 | * |
| 21 | 477 | * The resulting string will be allocated by the cxDefaultAllocator. |
| 16 | 478 | * So developers @em must pass the return value to cx_strfree() eventually. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
479 | * |
| 16 | 480 | * If @p str already contains a string, the memory will be reallocated and |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
481 | * 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
|
482 | * |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
483 | * If memory allocation fails, the pointer in the returned string will |
| 16 | 484 | * be @c NULL and @c errno might be set. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
485 | * |
| 16 | 486 | * @note It is guaranteed that there is only one allocation for the |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
487 | * resulting string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
488 | * 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
|
489 | * |
| 16 | 490 | * @param str (@c cxmutstr) the string the other strings shall be concatenated to |
| 491 | * @param count (@c size_t) the number of the other following strings to concatenate | |
| 492 | * @param ... all other strings | |
| 493 | * @return (@c cxmutstr) the concatenated string | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
494 | */ |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
495 | #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
|
496 | 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
|
497 | |
|
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 | * 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
|
500 | * |
| 16 | 501 | * @attention the new string references the same memory area as the |
| 502 | * input string and is usually @em not zero-terminated. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
503 | * 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
|
504 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
505 | * @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
|
506 | * @param start start location of the substring |
| 16 | 507 | * @return a substring of @p string starting at @p start |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
508 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
509 | * @see cx_strsubsl() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
510 | * @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
|
511 | * @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
|
512 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
513 | cx_attr_nodiscard |
| 16 | 514 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
515 | cxstring cx_strsubs( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
516 | cxstring string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
517 | size_t start |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
518 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
519 | |
|
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 | * 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
|
522 | * |
| 16 | 523 | * The returned string will be limited to @p length bytes or the number |
| 524 | * of bytes available in @p string, whichever is smaller. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
525 | * |
| 16 | 526 | * @attention the new string references the same memory area as the |
| 527 | * input string and is usually @em not zero-terminated. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
528 | * 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
|
529 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
530 | * @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
|
531 | * @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
|
532 | * @param length the maximum length of the returned string |
| 16 | 533 | * @return a substring of @p string starting at @p start |
|
0
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 | * @see cx_strsubs() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
536 | * @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
|
537 | * @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
|
538 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
539 | cx_attr_nodiscard |
| 16 | 540 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
541 | cxstring cx_strsubsl( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
542 | cxstring string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
543 | size_t start, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
544 | size_t length |
|
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 specified location. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
549 | * |
| 16 | 550 | * @attention the new string references the same memory area as the |
| 551 | * input string and is usually @em not zero-terminated. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
552 | * 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
|
553 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
554 | * @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
|
555 | * @param start start location of the substring |
| 16 | 556 | * @return a substring of @p string starting at @p start |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
557 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
558 | * @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
|
559 | * @see cx_strsubs() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
560 | * @see cx_strsubsl() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
561 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
562 | cx_attr_nodiscard |
| 16 | 563 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
564 | 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
|
565 | cxmutstr string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
566 | size_t start |
|
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 specified location. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
571 | * |
| 16 | 572 | * The returned string will be limited to @p length bytes or the number |
| 573 | * of bytes available in @p string, whichever is smaller. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
574 | * |
| 16 | 575 | * @attention the new string references the same memory area as the |
| 576 | * input string and is usually @em not zero-terminated. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
577 | * 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
|
578 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
579 | * @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
|
580 | * @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
|
581 | * @param length the maximum length of the returned string |
| 16 | 582 | * @return a substring of @p string starting at @p start |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
583 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
584 | * @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
|
585 | * @see cx_strsubs() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
586 | * @see cx_strsubsl() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
587 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
588 | cx_attr_nodiscard |
| 16 | 589 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
590 | 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
|
591 | cxmutstr string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
592 | size_t start, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
593 | size_t length |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
594 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
595 | |
|
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 | * 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
|
598 | * specified character. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
599 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
600 | * 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
|
601 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
602 | * @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
|
603 | * @param chr the character to locate |
| 16 | 604 | * @return a substring starting at the first location of @p chr |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
605 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
606 | * @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
|
607 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
608 | cx_attr_nodiscard |
| 16 | 609 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
610 | cxstring cx_strchr( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
611 | cxstring string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
612 | int chr |
|
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 | |
|
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 | * 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
|
617 | * specified character. |
|
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 | * 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
|
620 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
621 | * @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
|
622 | * @param chr the character to locate |
| 16 | 623 | * @return a substring starting at the first location of @p chr |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
624 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
625 | * @see cx_strchr() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
626 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
627 | cx_attr_nodiscard |
| 16 | 628 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
629 | 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
|
630 | cxmutstr string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
631 | int chr |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
632 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
633 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
634 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
635 | * 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
|
636 | * specified character. |
|
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 | * 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
|
639 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
640 | * @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
|
641 | * @param chr the character to locate |
| 16 | 642 | * @return a substring starting at the last location of @p chr |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
643 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
644 | * @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
|
645 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
646 | cx_attr_nodiscard |
| 16 | 647 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
648 | cxstring cx_strrchr( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
649 | cxstring string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
650 | int chr |
|
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 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
653 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
654 | * 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
|
655 | * specified character. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
656 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
657 | * 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
|
658 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
659 | * @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
|
660 | * @param chr the character to locate |
| 16 | 661 | * @return a substring starting at the last location of @p chr |
|
0
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 | * @see cx_strrchr() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
664 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
665 | cx_attr_nodiscard |
| 16 | 666 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
667 | 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
|
668 | cxmutstr string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
669 | int chr |
|
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 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
672 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
673 | * 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
|
674 | * specified string. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
675 | * |
| 16 | 676 | * If @p haystack does not contain @p needle, an empty string is returned. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
677 | * |
| 16 | 678 | * If @p needle is an empty string, the complete @p haystack is |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
679 | * returned. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
680 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
681 | * @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
|
682 | * @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
|
683 | * @return a substring starting at the first occurrence of |
| 16 | 684 | * @p needle, or an empty string, if the sequence is not |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
685 | * contained |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
686 | * @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
|
687 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
688 | cx_attr_nodiscard |
| 16 | 689 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
690 | cxstring cx_strstr( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
691 | cxstring haystack, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
692 | cxstring needle |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
693 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
694 | |
|
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 | * 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
|
697 | * specified string. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
698 | * |
| 16 | 699 | * If @p haystack does not contain @p needle, an empty string is returned. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
700 | * |
| 16 | 701 | * If @p needle is an empty string, the complete @p haystack is |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
702 | * returned. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
703 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
704 | * @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
|
705 | * @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
|
706 | * @return a substring starting at the first occurrence of |
| 16 | 707 | * @p needle, or an empty string, if the sequence is not |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
708 | * contained |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
709 | * @see cx_strstr() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
710 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
711 | cx_attr_nodiscard |
| 16 | 712 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
713 | 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
|
714 | cxmutstr haystack, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
715 | cxstring needle |
|
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 | |
|
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 | * 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
|
720 | * |
| 16 | 721 | * @note The resulting array contains strings that point to the source |
| 722 | * @p string. Use cx_strdup() to get copies. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
723 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
724 | * @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
|
725 | * @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
|
726 | * @param limit the maximum number of split items |
| 16 | 727 | * @param output a preallocated array of at least @p limit length |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
728 | * @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
|
729 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
730 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
731 | cx_attr_nonnull |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
732 | cx_attr_access_w(4, 3) |
| 16 | 733 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
734 | 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
|
735 | cxstring string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
736 | cxstring delim, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
737 | size_t limit, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
738 | cxstring *output |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
739 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
740 | |
|
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 | * 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
|
743 | * |
| 16 | 744 | * The array pointed to by @p output will be allocated by @p allocator. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
745 | * |
| 16 | 746 | * @note The resulting array contains strings that point to the source |
| 747 | * @p string. Use cx_strdup() to get copies. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
748 | * |
| 16 | 749 | * @attention If allocation fails, the @c NULL pointer will be written to |
| 750 | * @p output and the number returned will be zero. | |
|
0
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 | * @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
|
753 | * @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
|
754 | * @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
|
755 | * @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
|
756 | * @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
|
757 | * written to |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
758 | * @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
|
759 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
760 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
761 | cx_attr_nonnull |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
762 | cx_attr_access_w(5) |
| 16 | 763 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
764 | size_t cx_strsplit_a( |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
765 | const CxAllocator *allocator, |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
766 | cxstring string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
767 | cxstring delim, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
768 | size_t limit, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
769 | cxstring **output |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
770 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
771 | |
|
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 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
774 | * 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
|
775 | * |
| 16 | 776 | * @note The resulting array contains strings that point to the source |
| 777 | * @p string. Use cx_strdup() to get copies. | |
|
0
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 | * @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
|
780 | * @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
|
781 | * @param limit the maximum number of split items |
| 16 | 782 | * @param output a preallocated array of at least @p limit length |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
783 | * @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
|
784 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
785 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
786 | cx_attr_nonnull |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
787 | cx_attr_access_w(4, 3) |
| 16 | 788 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
789 | 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
|
790 | cxmutstr string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
791 | cxstring delim, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
792 | size_t limit, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
793 | cxmutstr *output |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
794 | ); |
|
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 | * 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
|
798 | * |
| 16 | 799 | * The array pointed to by @p output will be allocated by @p allocator. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
800 | * |
| 16 | 801 | * @note The resulting array contains strings that point to the source |
| 802 | * @p string. Use cx_strdup() to get copies. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
803 | * |
| 16 | 804 | * @attention If allocation fails, the @c NULL pointer will be written to |
| 805 | * @p output and the number returned will be zero. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
806 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
807 | * @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
|
808 | * @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
|
809 | * @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
|
810 | * @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
|
811 | * @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
|
812 | * written to |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
813 | * @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
|
814 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
815 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
816 | cx_attr_nonnull |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
817 | cx_attr_access_w(5) |
| 16 | 818 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
819 | size_t cx_strsplit_ma( |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
820 | const CxAllocator *allocator, |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
821 | cxmutstr string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
822 | cxstring delim, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
823 | size_t limit, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
824 | cxmutstr **output |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
825 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
826 | |
|
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 | * Compares two strings. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
829 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
830 | * @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
|
831 | * @param s2 the second string |
| 16 | 832 | * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger |
| 833 | * than @p s2, zero if both strings equal | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
834 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
835 | cx_attr_nodiscard |
| 16 | 836 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
837 | int cx_strcmp( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
838 | cxstring s1, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
839 | cxstring s2 |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
840 | ); |
|
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 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
843 | * 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
|
844 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
845 | * @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
|
846 | * @param s2 the second string |
| 16 | 847 | * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger |
| 848 | * than @p s2, zero if both strings equal ignoring case | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
849 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
850 | cx_attr_nodiscard |
| 16 | 851 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
852 | int cx_strcasecmp( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
853 | cxstring s1, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
854 | cxstring s2 |
|
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 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
857 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
858 | * Compares two strings. |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
859 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
860 | * 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
|
861 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
862 | * @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
|
863 | * @param s2 the second string |
| 16 | 864 | * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger |
| 865 | * than @p s2, zero if both strings equal | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
866 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
867 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
868 | cx_attr_nonnull |
| 16 | 869 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
870 | int cx_strcmp_p( |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
871 | const void *s1, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
872 | const void *s2 |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
873 | ); |
|
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 | * 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
|
877 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
878 | * 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
|
879 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
880 | * @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
|
881 | * @param s2 the second string |
| 16 | 882 | * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger |
| 883 | * than @p s2, zero if both strings equal ignoring case | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
884 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
885 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
886 | cx_attr_nonnull |
| 16 | 887 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
888 | int cx_strcasecmp_p( |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
889 | const void *s1, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
890 | const void *s2 |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
891 | ); |
|
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 | |
|
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 | * 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
|
896 | * |
| 16 | 897 | * The new string will contain a copy allocated by @p allocator. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
898 | * |
| 16 | 899 | * @note The returned string is guaranteed to be zero-terminated. |
|
0
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 | * @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
|
902 | * @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
|
903 | * @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
|
904 | * @see cx_strdup() |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
905 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
906 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
907 | cx_attr_nonnull |
| 16 | 908 | cx_attr_export |
| 909 | cxmutstr cx_strdup_a_( | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
910 | const CxAllocator *allocator, |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
911 | cxstring 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 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
914 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
915 | * 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
|
916 | * |
| 16 | 917 | * The new string will contain a copy allocated by @p allocator. |
| 918 | * | |
| 919 | * @note The returned string is guaranteed to be zero-terminated. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
920 | * |
| 16 | 921 | * @param allocator (@c CxAllocator*) the allocator to use |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
922 | * @param string the string to duplicate |
| 16 | 923 | * @return (@c cxmutstr) a duplicate of the string |
| 924 | * @see cx_strdup() | |
| 925 | * @see cx_strfree_a() | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
926 | */ |
| 16 | 927 | #define cx_strdup_a(allocator, string) \ |
| 21 | 928 | cx_strdup_a_((allocator), cx_strcast(string)) |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
929 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
930 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
931 | * 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
|
932 | * |
| 21 | 933 | * The new string will contain a copy allocated by the cxDefaultAllocator. |
| 934 | * So developers @em must pass the return value to cx_strfree(). | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
935 | * |
| 16 | 936 | * @note The returned string is guaranteed to be zero-terminated. |
|
0
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 | * @param string the string to duplicate |
| 16 | 939 | * @return (@c cxmutstr) a duplicate of the string |
| 940 | * @see cx_strdup_a() | |
| 941 | * @see cx_strfree() | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
942 | */ |
| 21 | 943 | #define cx_strdup(string) cx_strdup_a(cxDefaultAllocator, string) |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
944 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
945 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
946 | * 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
|
947 | * |
| 16 | 948 | * @note the returned string references the same memory, thus you |
| 949 | * must @em not free the returned memory. | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
950 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
951 | * @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
|
952 | * @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
|
953 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
954 | cx_attr_nodiscard |
| 16 | 955 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
956 | 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
|
957 | |
|
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 | * 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
|
960 | * |
| 16 | 961 | * @note the returned string references the same memory, thus you |
| 962 | * must @em not free the returned memory. | |
|
0
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 | * @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
|
965 | * @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
|
966 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
967 | cx_attr_nodiscard |
| 16 | 968 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
969 | 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
|
970 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
971 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
972 | * 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
|
973 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
974 | * @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
|
975 | * @param prefix the prefix the string should have |
| 16 | 976 | * @return @c true, if and only if the string has the specified prefix, |
| 977 | * @c false otherwise | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
978 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
979 | cx_attr_nodiscard |
| 16 | 980 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
981 | bool cx_strprefix( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
982 | cxstring string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
983 | cxstring prefix |
|
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 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
986 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
987 | * 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
|
988 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
989 | * @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
|
990 | * @param suffix the suffix the string should have |
| 16 | 991 | * @return @c true, if and only if the string has the specified suffix, |
| 992 | * @c false otherwise | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
993 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
994 | cx_attr_nodiscard |
| 16 | 995 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
996 | bool cx_strsuffix( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
997 | cxstring string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
998 | cxstring suffix |
|
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 | |
|
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 | * 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
|
1003 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1004 | * @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
|
1005 | * @param prefix the prefix the string should have |
| 16 | 1006 | * @return @c true, if and only if the string has the specified prefix, |
| 1007 | * @c false otherwise | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1008 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1009 | cx_attr_nodiscard |
| 16 | 1010 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1011 | bool cx_strcaseprefix( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1012 | cxstring string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1013 | cxstring prefix |
|
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 | |
|
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 | * 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
|
1018 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1019 | * @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
|
1020 | * @param suffix the suffix the string should have |
| 16 | 1021 | * @return @c true, if and only if the string has the specified suffix, |
| 1022 | * @c false otherwise | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1023 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1024 | cx_attr_nodiscard |
| 16 | 1025 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1026 | bool cx_strcasesuffix( |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1027 | cxstring string, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1028 | cxstring suffix |
|
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 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1031 | /** |
| 16 | 1032 | * Replaces a string with another string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1033 | * |
| 16 | 1034 | * Replaces at most @p replmax occurrences. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1035 | * |
| 16 | 1036 | * The returned string will be allocated by @p allocator and is guaranteed |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1037 | * 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
|
1038 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1039 | * 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
|
1040 | * 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
|
1041 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1042 | * @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
|
1043 | * @param str the string where replacements should be applied |
| 16 | 1044 | * @param search the string to search for |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1045 | * @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
|
1046 | * @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
|
1047 | * @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
|
1048 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1049 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1050 | cx_attr_nonnull |
| 16 | 1051 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1052 | cxmutstr cx_strreplacen_a( |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1053 | const CxAllocator *allocator, |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1054 | cxstring str, |
| 16 | 1055 | cxstring search, |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1056 | cxstring replacement, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1057 | size_t replmax |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1058 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1059 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1060 | /** |
| 16 | 1061 | * Replaces a string with another string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1062 | * |
| 16 | 1063 | * Replaces at most @p replmax occurrences. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1064 | * |
| 21 | 1065 | * The returned string will be allocated by the cxDefaultAllocator and is guaranteed |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1066 | * 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
|
1067 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1068 | * 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
|
1069 | * 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
|
1070 | * |
| 16 | 1071 | * @param str (@c cxstring) the string where replacements should be applied |
| 1072 | * @param search (@c cxstring) the string to search for | |
| 1073 | * @param replacement (@c cxstring) the replacement string | |
| 1074 | * @param replmax (@c size_t) maximum number of replacements | |
| 1075 | * @return (@c cxmutstr) the resulting string after applying the replacements | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1076 | */ |
| 16 | 1077 | #define cx_strreplacen(str, search, replacement, replmax) \ |
| 1078 | cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, replmax) | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1079 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1080 | /** |
| 16 | 1081 | * Replaces a string with another string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1082 | * |
| 16 | 1083 | * The returned string will be allocated by @p allocator and is guaranteed |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1084 | * 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
|
1085 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1086 | * 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
|
1087 | * 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
|
1088 | * |
| 16 | 1089 | * @param allocator (@c CxAllocator*) the allocator to use |
| 1090 | * @param str (@c cxstring) the string where replacements should be applied | |
| 1091 | * @param search (@c cxstring) the string to search for | |
| 1092 | * @param replacement (@c cxstring) the replacement string | |
| 1093 | * @return (@c cxmutstr) the resulting string after applying the replacements | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1094 | */ |
| 16 | 1095 | #define cx_strreplace_a(allocator, str, search, replacement) \ |
| 1096 | cx_strreplacen_a(allocator, str, search, replacement, SIZE_MAX) | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1097 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1098 | /** |
| 16 | 1099 | * Replaces a string with another string. |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1100 | * |
| 21 | 1101 | * The returned string will be allocated by the cxDefaultAllocator and is guaranteed |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1102 | * 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
|
1103 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1104 | * 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
|
1105 | * 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
|
1106 | * |
| 16 | 1107 | * @param str (@c cxstring) the string where replacements should be applied |
| 1108 | * @param search (@c cxstring) the string to search for | |
| 1109 | * @param replacement (@c cxstring) the replacement string | |
| 1110 | * @return (@c cxmutstr) the resulting string after applying the replacements | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1111 | */ |
| 16 | 1112 | #define cx_strreplace(str, search, replacement) \ |
| 1113 | cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, SIZE_MAX) | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1114 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1115 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1116 | * 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
|
1117 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1118 | * @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
|
1119 | * @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
|
1120 | * @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
|
1121 | * @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
|
1122 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1123 | cx_attr_nodiscard |
| 16 | 1124 | cx_attr_export |
| 1125 | CxStrtokCtx cx_strtok_( | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1126 | cxstring str, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1127 | cxstring delim, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1128 | size_t limit |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1129 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1130 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1131 | /** |
| 16 | 1132 | * Creates a string tokenization context. |
| 1133 | * | |
| 1134 | * @param str the string to tokenize | |
| 1135 | * @param delim the delimiter string (must not be empty) | |
| 1136 | * @param limit (@c size_t) the maximum number of tokens that shall be returned | |
| 1137 | * @return (@c CxStrtokCtx) a new string tokenization context | |
| 1138 | */ | |
| 1139 | #define cx_strtok(str, delim, limit) \ | |
| 21 | 1140 | cx_strtok_(cx_strcast(str), cx_strcast(delim), (limit)) |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1141 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1142 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1143 | * 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
|
1144 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1145 | * 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
|
1146 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1147 | * @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
|
1148 | * @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
|
1149 | * @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
|
1150 | * has been reached |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1151 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1152 | cx_attr_nonnull |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1153 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1154 | cx_attr_access_w(2) |
| 16 | 1155 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1156 | 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
|
1157 | CxStrtokCtx *ctx, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1158 | cxstring *token |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1159 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1160 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1161 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1162 | * 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
|
1163 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1164 | * The token will point to the source string. |
| 16 | 1165 | * |
| 1166 | * @attention | |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1167 | * 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
|
1168 | * 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
|
1169 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1170 | * @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
|
1171 | * @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
|
1172 | * @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
|
1173 | * has been reached |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1174 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1175 | cx_attr_nonnull |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1176 | cx_attr_nodiscard |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1177 | cx_attr_access_w(2) |
| 16 | 1178 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1179 | 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
|
1180 | CxStrtokCtx *ctx, |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1181 | cxmutstr *token |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1182 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1183 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1184 | /** |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1185 | * 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
|
1186 | * |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1187 | * @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
|
1188 | * @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
|
1189 | * @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
|
1190 | */ |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1191 | cx_attr_nonnull |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1192 | cx_attr_access_r(2, 3) |
| 16 | 1193 | cx_attr_export |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1194 | 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
|
1195 | CxStrtokCtx *ctx, |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1196 | const cxstring *delim, |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1197 | size_t count |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1198 | ); |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1199 | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1200 | /* ------------------------------------------------------------------------- * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1201 | * string to number conversion functions * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1202 | * ------------------------------------------------------------------------- */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1203 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1204 | /** |
| 16 | 1205 | * Converts a string to a number. |
| 1206 | * | |
| 1207 | * The function returns non-zero when conversion is not possible. | |
| 1208 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1209 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1210 | * | |
| 1211 | * @param str the string to convert | |
| 1212 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1213 | * @param base 2, 8, 10, or 16 | |
| 1214 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1215 | * @retval zero success | |
| 1216 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1217 | */ |
| 16 | 1218 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1219 | int cx_strtos_lc_(cxstring str, short *output, int base, const char *groupsep); | |
| 1220 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1221 | /** |
| 16 | 1222 | * Converts a string to a number. |
| 1223 | * | |
| 1224 | * The function returns non-zero when conversion is not possible. | |
| 1225 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1226 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1227 | * | |
| 1228 | * @param str the string to convert | |
| 1229 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1230 | * @param base 2, 8, 10, or 16 | |
| 1231 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1232 | * @retval zero success | |
| 1233 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1234 | */ |
| 16 | 1235 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1236 | int cx_strtoi_lc_(cxstring str, int *output, int base, const char *groupsep); | |
| 1237 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1238 | /** |
| 16 | 1239 | * Converts a string to a number. |
| 1240 | * | |
| 1241 | * The function returns non-zero when conversion is not possible. | |
| 1242 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1243 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1244 | * | |
| 1245 | * @param str the string to convert | |
| 1246 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1247 | * @param base 2, 8, 10, or 16 | |
| 1248 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1249 | * @retval zero success | |
| 1250 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1251 | */ |
| 16 | 1252 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1253 | int cx_strtol_lc_(cxstring str, long *output, int base, const char *groupsep); | |
| 1254 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1255 | /** |
| 16 | 1256 | * Converts a string to a number. |
| 1257 | * | |
| 1258 | * The function returns non-zero when conversion is not possible. | |
| 1259 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1260 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1261 | * | |
| 1262 | * @param str the string to convert | |
| 1263 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1264 | * @param base 2, 8, 10, or 16 | |
| 1265 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1266 | * @retval zero success | |
| 1267 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1268 | */ |
| 16 | 1269 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1270 | int cx_strtoll_lc_(cxstring str, long long *output, int base, const char *groupsep); | |
| 1271 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1272 | /** |
| 16 | 1273 | * Converts a string to a number. |
| 1274 | * | |
| 1275 | * The function returns non-zero when conversion is not possible. | |
| 1276 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1277 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1278 | * | |
| 1279 | * @param str the string to convert | |
| 1280 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1281 | * @param base 2, 8, 10, or 16 | |
| 1282 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1283 | * @retval zero success | |
| 1284 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1285 | */ |
| 16 | 1286 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1287 | int cx_strtoi8_lc_(cxstring str, int8_t *output, int base, const char *groupsep); | |
| 1288 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1289 | /** |
| 16 | 1290 | * Converts a string to a number. |
| 1291 | * | |
| 1292 | * The function returns non-zero when conversion is not possible. | |
| 1293 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1294 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1295 | * | |
| 1296 | * @param str the string to convert | |
| 1297 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1298 | * @param base 2, 8, 10, or 16 | |
| 1299 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1300 | * @retval zero success | |
| 1301 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1302 | */ |
| 16 | 1303 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1304 | int cx_strtoi16_lc_(cxstring str, int16_t *output, int base, const char *groupsep); | |
| 1305 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1306 | /** |
| 16 | 1307 | * Converts a string to a number. |
| 1308 | * | |
| 1309 | * The function returns non-zero when conversion is not possible. | |
| 1310 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1311 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1312 | * | |
| 1313 | * @param str the string to convert | |
| 1314 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1315 | * @param base 2, 8, 10, or 16 | |
| 1316 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1317 | * @retval zero success | |
| 1318 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1319 | */ |
| 16 | 1320 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1321 | int cx_strtoi32_lc_(cxstring str, int32_t *output, int base, const char *groupsep); | |
| 1322 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1323 | /** |
| 16 | 1324 | * Converts a string to a number. |
| 1325 | * | |
| 1326 | * The function returns non-zero when conversion is not possible. | |
| 1327 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1328 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1329 | * | |
| 1330 | * @param str the string to convert | |
| 1331 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1332 | * @param base 2, 8, 10, or 16 | |
| 1333 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1334 | * @retval zero success | |
| 1335 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1336 | */ |
| 16 | 1337 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1338 | int cx_strtoi64_lc_(cxstring str, int64_t *output, int base, const char *groupsep); | |
| 1339 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1340 | /** |
| 16 | 1341 | * Converts a string to a number. |
| 1342 | * | |
| 1343 | * The function returns non-zero when conversion is not possible. | |
| 1344 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1345 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1346 | * | |
| 1347 | * @param str the string to convert | |
| 1348 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1349 | * @param base 2, 8, 10, or 16 | |
| 1350 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1351 | * @retval zero success | |
| 1352 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1353 | */ |
| 16 | 1354 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1355 | int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep); | |
| 1356 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1357 | /** |
| 16 | 1358 | * Converts a string to a number. |
| 1359 | * | |
| 1360 | * The function returns non-zero when conversion is not possible. | |
| 1361 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1362 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1363 | * | |
| 1364 | * @param str the string to convert | |
| 1365 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1366 | * @param base 2, 8, 10, or 16 | |
| 1367 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1368 | * @retval zero success | |
| 1369 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1370 | */ |
| 16 | 1371 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1372 | int cx_strtou_lc_(cxstring str, unsigned int *output, int base, const char *groupsep); | |
| 1373 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1374 | /** |
| 16 | 1375 | * Converts a string to a number. |
| 1376 | * | |
| 1377 | * The function returns non-zero when conversion is not possible. | |
| 1378 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1379 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1380 | * | |
| 1381 | * @param str the string to convert | |
| 1382 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1383 | * @param base 2, 8, 10, or 16 | |
| 1384 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1385 | * @retval zero success | |
| 1386 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1387 | */ |
| 16 | 1388 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1389 | int cx_strtoul_lc_(cxstring str, unsigned long *output, int base, const char *groupsep); | |
| 1390 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1391 | /** |
| 16 | 1392 | * Converts a string to a number. |
| 1393 | * | |
| 1394 | * The function returns non-zero when conversion is not possible. | |
| 1395 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1396 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1397 | * | |
| 1398 | * @param str the string to convert | |
| 1399 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1400 | * @param base 2, 8, 10, or 16 | |
| 1401 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1402 | * @retval zero success | |
| 1403 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1404 | */ |
| 16 | 1405 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1406 | int cx_strtoull_lc_(cxstring str, unsigned long long *output, int base, const char *groupsep); | |
| 1407 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1408 | /** |
| 16 | 1409 | * Converts a string to a number. |
| 1410 | * | |
| 1411 | * The function returns non-zero when conversion is not possible. | |
| 1412 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1413 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1414 | * | |
| 1415 | * @param str the string to convert | |
| 1416 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1417 | * @param base 2, 8, 10, or 16 | |
| 1418 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1419 | * @retval zero success | |
| 1420 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1421 | */ |
| 16 | 1422 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1423 | int cx_strtou8_lc_(cxstring str, uint8_t *output, int base, const char *groupsep); | |
| 1424 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1425 | /** |
| 16 | 1426 | * Converts a string to a number. |
| 1427 | * | |
| 1428 | * The function returns non-zero when conversion is not possible. | |
| 1429 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1430 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1431 | * | |
| 1432 | * @param str the string to convert | |
| 1433 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1434 | * @param base 2, 8, 10, or 16 | |
| 1435 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1436 | * @retval zero success | |
| 1437 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1438 | */ |
| 16 | 1439 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1440 | int cx_strtou16_lc_(cxstring str, uint16_t *output, int base, const char *groupsep); | |
| 1441 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1442 | /** |
| 16 | 1443 | * Converts a string to a number. |
| 1444 | * | |
| 1445 | * The function returns non-zero when conversion is not possible. | |
| 1446 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1447 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1448 | * | |
| 1449 | * @param str the string to convert | |
| 1450 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1451 | * @param base 2, 8, 10, or 16 | |
| 1452 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1453 | * @retval zero success | |
| 1454 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1455 | */ |
| 16 | 1456 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1457 | int cx_strtou32_lc_(cxstring str, uint32_t *output, int base, const char *groupsep); | |
| 1458 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1459 | /** |
| 16 | 1460 | * Converts a string to a number. |
| 1461 | * | |
| 1462 | * The function returns non-zero when conversion is not possible. | |
| 1463 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1464 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1465 | * | |
| 1466 | * @param str the string to convert | |
| 1467 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1468 | * @param base 2, 8, 10, or 16 | |
| 1469 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1470 | * @retval zero success | |
| 1471 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1472 | */ |
| 16 | 1473 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export |
| 1474 | int cx_strtou64_lc_(cxstring str, uint64_t *output, int base, const char *groupsep); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1475 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1476 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1477 | * Converts a string to a number. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1478 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1479 | * The function returns non-zero when conversion is not possible. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1480 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1481 | * It sets errno to ERANGE when the target datatype is too small. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1482 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1483 | * @param str the string to convert |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1484 | * @param output a pointer to the integer variable where the result shall be stored |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1485 | * @param base 2, 8, 10, or 16 |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1486 | * @param groupsep each character in this string is treated as group separator and ignored during conversion |
| 16 | 1487 | * @retval zero success |
| 1488 | * @retval non-zero conversion was not possible | |
| 1489 | */ | |
| 1490 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export | |
| 1491 | int cx_strtoz_lc_(cxstring str, size_t *output, int base, const char *groupsep); | |
| 1492 | ||
| 1493 | /** | |
| 1494 | * Converts a string to a single precision floating point number. | |
| 1495 | * | |
| 1496 | * The function returns non-zero when conversion is not possible. | |
| 1497 | * In that case the function sets errno to EINVAL when the reason is an invalid character. | |
| 1498 | * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. | |
| 1499 | * | |
| 1500 | * @param str the string to convert | |
| 1501 | * @param output a pointer to the float variable where the result shall be stored | |
| 1502 | * @param decsep the decimal separator | |
| 1503 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1504 | * @retval zero success | |
| 1505 | * @retval non-zero conversion was not possible | |
| 1506 | */ | |
| 1507 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export | |
| 1508 | int cx_strtof_lc_(cxstring str, float *output, char decsep, const char *groupsep); | |
| 1509 | ||
| 1510 | /** | |
| 1511 | * Converts a string to a double precision floating point number. | |
| 1512 | * | |
| 1513 | * The function returns non-zero when conversion is not possible. | |
| 1514 | * In that case the function sets errno to EINVAL when the reason is an invalid character. | |
| 1515 | * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. | |
| 1516 | * | |
| 1517 | * @param str the string to convert | |
| 1518 | * @param output a pointer to the float variable where the result shall be stored | |
| 1519 | * @param decsep the decimal separator | |
| 1520 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 1521 | * @retval zero success | |
| 1522 | * @retval non-zero conversion was not possible | |
| 1523 | */ | |
| 1524 | cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export | |
| 1525 | int cx_strtod_lc_(cxstring str, double *output, char decsep, const char *groupsep); | |
| 1526 | ||
| 1527 | /** | |
| 1528 | * Converts a string to a number. | |
| 1529 | * | |
| 1530 | * The function returns non-zero when conversion is not possible. | |
| 1531 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1532 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1533 | * | |
| 1534 | * @param str the string to convert | |
| 1535 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1536 | * @param base 2, 8, 10, or 16 | |
| 1537 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1538 | * @retval zero success | |
| 1539 | * @retval non-zero conversion was not possible | |
| 1540 | */ | |
| 1541 | #define cx_strtos_lc(str, output, base, groupsep) cx_strtos_lc_(cx_strcast(str), output, base, groupsep) | |
| 1542 | ||
| 1543 | /** | |
| 1544 | * Converts a string to a number. | |
| 1545 | * | |
| 1546 | * The function returns non-zero when conversion is not possible. | |
| 1547 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1548 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1549 | * | |
| 1550 | * @param str the string to convert | |
| 1551 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1552 | * @param base 2, 8, 10, or 16 | |
| 1553 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1554 | * @retval zero success | |
| 1555 | * @retval non-zero conversion was not possible | |
| 1556 | */ | |
| 1557 | #define cx_strtoi_lc(str, output, base, groupsep) cx_strtoi_lc_(cx_strcast(str), output, base, groupsep) | |
| 1558 | ||
| 1559 | /** | |
| 1560 | * Converts a string to a number. | |
| 1561 | * | |
| 1562 | * The function returns non-zero when conversion is not possible. | |
| 1563 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1564 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1565 | * | |
| 1566 | * @param str the string to convert | |
| 1567 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1568 | * @param base 2, 8, 10, or 16 | |
| 1569 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1570 | * @retval zero success | |
| 1571 | * @retval non-zero conversion was not possible | |
| 1572 | */ | |
| 1573 | #define cx_strtol_lc(str, output, base, groupsep) cx_strtol_lc_(cx_strcast(str), output, base, groupsep) | |
| 1574 | ||
| 1575 | /** | |
| 1576 | * Converts a string to a number. | |
| 1577 | * | |
| 1578 | * The function returns non-zero when conversion is not possible. | |
| 1579 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1580 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1581 | * | |
| 1582 | * @param str the string to convert | |
| 1583 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1584 | * @param base 2, 8, 10, or 16 | |
| 1585 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1586 | * @retval zero success | |
| 1587 | * @retval non-zero conversion was not possible | |
| 1588 | */ | |
| 1589 | #define cx_strtoll_lc(str, output, base, groupsep) cx_strtoll_lc_(cx_strcast(str), output, base, groupsep) | |
| 1590 | ||
| 1591 | /** | |
| 1592 | * Converts a string to a number. | |
| 1593 | * | |
| 1594 | * The function returns non-zero when conversion is not possible. | |
| 1595 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1596 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1597 | * | |
| 1598 | * @param str the string to convert | |
| 1599 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1600 | * @param base 2, 8, 10, or 16 | |
| 1601 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1602 | * @retval zero success | |
| 1603 | * @retval non-zero conversion was not possible | |
| 1604 | */ | |
| 1605 | #define cx_strtoi8_lc(str, output, base, groupsep) cx_strtoi8_lc_(cx_strcast(str), output, base, groupsep) | |
| 1606 | ||
| 1607 | /** | |
| 1608 | * Converts a string to a number. | |
| 1609 | * | |
| 1610 | * The function returns non-zero when conversion is not possible. | |
| 1611 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1612 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1613 | * | |
| 1614 | * @param str the string to convert | |
| 1615 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1616 | * @param base 2, 8, 10, or 16 | |
| 1617 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1618 | * @retval zero success | |
| 1619 | * @retval non-zero conversion was not possible | |
| 1620 | */ | |
| 1621 | #define cx_strtoi16_lc(str, output, base, groupsep) cx_strtoi16_lc_(cx_strcast(str), output, base, groupsep) | |
| 1622 | ||
| 1623 | /** | |
| 1624 | * Converts a string to a number. | |
| 1625 | * | |
| 1626 | * The function returns non-zero when conversion is not possible. | |
| 1627 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1628 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1629 | * | |
| 1630 | * @param str the string to convert | |
| 1631 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1632 | * @param base 2, 8, 10, or 16 | |
| 1633 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1634 | * @retval zero success | |
| 1635 | * @retval non-zero conversion was not possible | |
| 1636 | */ | |
| 1637 | #define cx_strtoi32_lc(str, output, base, groupsep) cx_strtoi32_lc_(cx_strcast(str), output, base, groupsep) | |
| 1638 | ||
| 1639 | /** | |
| 1640 | * Converts a string to a number. | |
| 1641 | * | |
| 1642 | * The function returns non-zero when conversion is not possible. | |
| 1643 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1644 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1645 | * | |
| 1646 | * @param str the string to convert | |
| 1647 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1648 | * @param base 2, 8, 10, or 16 | |
| 1649 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1650 | * @retval zero success | |
| 1651 | * @retval non-zero conversion was not possible | |
| 1652 | */ | |
| 1653 | #define cx_strtoi64_lc(str, output, base, groupsep) cx_strtoi64_lc_(cx_strcast(str), output, base, groupsep) | |
| 1654 | ||
| 1655 | /** | |
| 1656 | * Converts a string to a number. | |
| 1657 | * | |
| 1658 | * The function returns non-zero when conversion is not possible. | |
| 1659 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1660 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1661 | * | |
| 1662 | * @param str the string to convert | |
| 1663 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1664 | * @param base 2, 8, 10, or 16 | |
| 1665 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1666 | * @retval zero success | |
| 1667 | * @retval non-zero conversion was not possible | |
| 1668 | */ | |
| 1669 | #define cx_strtous_lc(str, output, base, groupsep) cx_strtous_lc_(cx_strcast(str), output, base, groupsep) | |
| 1670 | ||
| 1671 | /** | |
| 1672 | * Converts a string to a number. | |
| 1673 | * | |
| 1674 | * The function returns non-zero when conversion is not possible. | |
| 1675 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1676 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1677 | * | |
| 1678 | * @param str the string to convert | |
| 1679 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1680 | * @param base 2, 8, 10, or 16 | |
| 1681 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1682 | * @retval zero success | |
| 1683 | * @retval non-zero conversion was not possible | |
| 1684 | */ | |
| 1685 | #define cx_strtou_lc(str, output, base, groupsep) cx_strtou_lc_(cx_strcast(str), output, base, groupsep) | |
| 1686 | ||
| 1687 | /** | |
| 1688 | * Converts a string to a number. | |
| 1689 | * | |
| 1690 | * The function returns non-zero when conversion is not possible. | |
| 1691 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1692 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1693 | * | |
| 1694 | * @param str the string to convert | |
| 1695 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1696 | * @param base 2, 8, 10, or 16 | |
| 1697 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1698 | * @retval zero success | |
| 1699 | * @retval non-zero conversion was not possible | |
| 1700 | */ | |
| 1701 | #define cx_strtoul_lc(str, output, base, groupsep) cx_strtoul_lc_(cx_strcast(str), output, base, groupsep) | |
| 1702 | ||
| 1703 | /** | |
| 1704 | * Converts a string to a number. | |
| 1705 | * | |
| 1706 | * The function returns non-zero when conversion is not possible. | |
| 1707 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1708 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1709 | * | |
| 1710 | * @param str the string to convert | |
| 1711 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1712 | * @param base 2, 8, 10, or 16 | |
| 1713 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1714 | * @retval zero success | |
| 1715 | * @retval non-zero conversion was not possible | |
| 1716 | */ | |
| 1717 | #define cx_strtoull_lc(str, output, base, groupsep) cx_strtoull_lc_(cx_strcast(str), output, base, groupsep) | |
| 1718 | ||
| 1719 | /** | |
| 1720 | * Converts a string to a number. | |
| 1721 | * | |
| 1722 | * The function returns non-zero when conversion is not possible. | |
| 1723 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1724 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1725 | * | |
| 1726 | * @param str the string to convert | |
| 1727 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1728 | * @param base 2, 8, 10, or 16 | |
| 1729 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1730 | * @retval zero success | |
| 1731 | * @retval non-zero conversion was not possible | |
| 1732 | */ | |
| 1733 | #define cx_strtou8_lc(str, output, base, groupsep) cx_strtou8_lc_(cx_strcast(str), output, base, groupsep) | |
| 1734 | ||
| 1735 | /** | |
| 1736 | * Converts a string to a number. | |
| 1737 | * | |
| 1738 | * The function returns non-zero when conversion is not possible. | |
| 1739 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1740 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1741 | * | |
| 1742 | * @param str the string to convert | |
| 1743 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1744 | * @param base 2, 8, 10, or 16 | |
| 1745 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1746 | * @retval zero success | |
| 1747 | * @retval non-zero conversion was not possible | |
| 1748 | */ | |
| 1749 | #define cx_strtou16_lc(str, output, base, groupsep) cx_strtou16_lc_(cx_strcast(str), output, base, groupsep) | |
| 1750 | ||
| 1751 | /** | |
| 1752 | * Converts a string to a number. | |
| 1753 | * | |
| 1754 | * The function returns non-zero when conversion is not possible. | |
| 1755 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1756 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1757 | * | |
| 1758 | * @param str the string to convert | |
| 1759 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1760 | * @param base 2, 8, 10, or 16 | |
| 1761 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1762 | * @retval zero success | |
| 1763 | * @retval non-zero conversion was not possible | |
| 1764 | */ | |
| 1765 | #define cx_strtou32_lc(str, output, base, groupsep) cx_strtou32_lc_(cx_strcast(str), output, base, groupsep) | |
| 1766 | ||
| 1767 | /** | |
| 1768 | * Converts a string to a number. | |
| 1769 | * | |
| 1770 | * The function returns non-zero when conversion is not possible. | |
| 1771 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1772 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1773 | * | |
| 1774 | * @param str the string to convert | |
| 1775 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1776 | * @param base 2, 8, 10, or 16 | |
| 1777 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1778 | * @retval zero success | |
| 1779 | * @retval non-zero conversion was not possible | |
| 1780 | */ | |
| 1781 | #define cx_strtou64_lc(str, output, base, groupsep) cx_strtou64_lc_(cx_strcast(str), output, base, groupsep) | |
| 1782 | ||
| 1783 | /** | |
| 1784 | * Converts a string to a number. | |
| 1785 | * | |
| 1786 | * The function returns non-zero when conversion is not possible. | |
| 1787 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1788 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1789 | * | |
| 1790 | * @param str the string to convert | |
| 1791 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1792 | * @param base 2, 8, 10, or 16 | |
| 1793 | * @param groupsep (@c const @c char*) each character in this string is treated as group separator and ignored during conversion | |
| 1794 | * @retval zero success | |
| 1795 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
1796 | */ |
| 16 | 1797 | #define cx_strtoz_lc(str, output, base, groupsep) cx_strtoz_lc_(cx_strcast(str), output, base, groupsep) |
| 1798 | ||
| 1799 | /** | |
| 1800 | * Converts a string to a number. | |
| 1801 | * | |
| 1802 | * The function returns non-zero when conversion is not possible. | |
| 1803 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1804 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1805 | * | |
| 1806 | * The comma character is treated as group separator and ignored during parsing. | |
| 1807 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1808 | * | |
| 1809 | * @param str the string to convert | |
| 1810 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1811 | * @param base 2, 8, 10, or 16 | |
| 1812 | * @retval zero success | |
| 1813 | * @retval non-zero conversion was not possible | |
| 1814 | */ | |
| 1815 | #define cx_strtos(str, output, base) cx_strtos_lc_(cx_strcast(str), output, base, ",") | |
| 1816 | ||
| 1817 | /** | |
| 1818 | * Converts a string to a number. | |
| 1819 | * | |
| 1820 | * The function returns non-zero when conversion is not possible. | |
| 1821 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1822 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1823 | * | |
| 1824 | * The comma character is treated as group separator and ignored during parsing. | |
| 1825 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1826 | * | |
| 1827 | * @param str the string to convert | |
| 1828 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1829 | * @param base 2, 8, 10, or 16 | |
| 1830 | * @retval zero success | |
| 1831 | * @retval non-zero conversion was not possible | |
| 1832 | */ | |
| 1833 | #define cx_strtoi(str, output, base) cx_strtoi_lc_(cx_strcast(str), output, base, ",") | |
| 1834 | ||
| 1835 | /** | |
| 1836 | * Converts a string to a number. | |
| 1837 | * | |
| 1838 | * The function returns non-zero when conversion is not possible. | |
| 1839 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1840 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1841 | * | |
| 1842 | * The comma character is treated as group separator and ignored during parsing. | |
| 1843 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1844 | * | |
| 1845 | * @param str the string to convert | |
| 1846 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1847 | * @param base 2, 8, 10, or 16 | |
| 1848 | * @retval zero success | |
| 1849 | * @retval non-zero conversion was not possible | |
| 1850 | */ | |
| 1851 | #define cx_strtol(str, output, base) cx_strtol_lc_(cx_strcast(str), output, base, ",") | |
| 1852 | ||
| 1853 | /** | |
| 1854 | * Converts a string to a number. | |
| 1855 | * | |
| 1856 | * The function returns non-zero when conversion is not possible. | |
| 1857 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1858 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1859 | * | |
| 1860 | * The comma character is treated as group separator and ignored during parsing. | |
| 1861 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1862 | * | |
| 1863 | * @param str the string to convert | |
| 1864 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1865 | * @param base 2, 8, 10, or 16 | |
| 1866 | * @retval zero success | |
| 1867 | * @retval non-zero conversion was not possible | |
| 1868 | */ | |
| 1869 | #define cx_strtoll(str, output, base) cx_strtoll_lc_(cx_strcast(str), output, base, ",") | |
| 1870 | ||
| 1871 | /** | |
| 1872 | * Converts a string to a number. | |
| 1873 | * | |
| 1874 | * The function returns non-zero when conversion is not possible. | |
| 1875 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1876 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1877 | * | |
| 1878 | * The comma character is treated as group separator and ignored during parsing. | |
| 1879 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1880 | * | |
| 1881 | * @param str the string to convert | |
| 1882 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1883 | * @param base 2, 8, 10, or 16 | |
| 1884 | * @retval zero success | |
| 1885 | * @retval non-zero conversion was not possible | |
| 1886 | */ | |
| 1887 | #define cx_strtoi8(str, output, base) cx_strtoi8_lc_(cx_strcast(str), output, base, ",") | |
| 1888 | ||
| 1889 | /** | |
| 1890 | * Converts a string to a number. | |
| 1891 | * | |
| 1892 | * The function returns non-zero when conversion is not possible. | |
| 1893 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1894 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1895 | * | |
| 1896 | * The comma character is treated as group separator and ignored during parsing. | |
| 1897 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1898 | * | |
| 1899 | * @param str the string to convert | |
| 1900 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1901 | * @param base 2, 8, 10, or 16 | |
| 1902 | * @retval zero success | |
| 1903 | * @retval non-zero conversion was not possible | |
| 1904 | */ | |
| 1905 | #define cx_strtoi16(str, output, base) cx_strtoi16_lc_(cx_strcast(str), output, base, ",") | |
| 1906 | ||
| 1907 | /** | |
| 1908 | * Converts a string to a number. | |
| 1909 | * | |
| 1910 | * The function returns non-zero when conversion is not possible. | |
| 1911 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1912 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1913 | * | |
| 1914 | * The comma character is treated as group separator and ignored during parsing. | |
| 1915 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1916 | * | |
| 1917 | * @param str the string to convert | |
| 1918 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1919 | * @param base 2, 8, 10, or 16 | |
| 1920 | * @retval zero success | |
| 1921 | * @retval non-zero conversion was not possible | |
| 1922 | */ | |
| 1923 | #define cx_strtoi32(str, output, base) cx_strtoi32_lc_(cx_strcast(str), output, base, ",") | |
| 1924 | ||
| 1925 | /** | |
| 1926 | * Converts a string to a number. | |
| 1927 | * | |
| 1928 | * The function returns non-zero when conversion is not possible. | |
| 1929 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1930 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1931 | * | |
| 1932 | * The comma character is treated as group separator and ignored during parsing. | |
| 1933 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1934 | * | |
| 1935 | * @param str the string to convert | |
| 1936 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1937 | * @param base 2, 8, 10, or 16 | |
| 1938 | * @retval zero success | |
| 1939 | * @retval non-zero conversion was not possible | |
| 1940 | */ | |
| 1941 | #define cx_strtoi64(str, output, base) cx_strtoi64_lc_(cx_strcast(str), output, base, ",") | |
| 1942 | ||
| 1943 | /** | |
| 1944 | * Converts a string to a number. | |
| 1945 | * | |
| 1946 | * The function returns non-zero when conversion is not possible. | |
| 1947 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1948 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1949 | * | |
| 1950 | * The comma character is treated as group separator and ignored during parsing. | |
| 1951 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1952 | * | |
| 1953 | * @param str the string to convert | |
| 1954 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1955 | * @param base 2, 8, 10, or 16 | |
| 1956 | * @retval zero success | |
| 1957 | * @retval non-zero conversion was not possible | |
| 1958 | */ | |
| 1959 | #define cx_strtoz(str, output, base) cx_strtoz_lc_(cx_strcast(str), output, base, ",") | |
| 1960 | ||
| 1961 | /** | |
| 1962 | * Converts a string to a number. | |
| 1963 | * | |
| 1964 | * The function returns non-zero when conversion is not possible. | |
| 1965 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1966 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1967 | * | |
| 1968 | * The comma character is treated as group separator and ignored during parsing. | |
| 1969 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1970 | * | |
| 1971 | * @param str the string to convert | |
| 1972 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1973 | * @param base 2, 8, 10, or 16 | |
| 1974 | * @retval zero success | |
| 1975 | * @retval non-zero conversion was not possible | |
| 1976 | */ | |
| 1977 | #define cx_strtous(str, output, base) cx_strtous_lc_(cx_strcast(str), output, base, ",") | |
| 1978 | ||
| 1979 | /** | |
| 1980 | * Converts a string to a number. | |
| 1981 | * | |
| 1982 | * The function returns non-zero when conversion is not possible. | |
| 1983 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 1984 | * It sets errno to ERANGE when the target datatype is too small. | |
| 1985 | * | |
| 1986 | * The comma character is treated as group separator and ignored during parsing. | |
| 1987 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 1988 | * | |
| 1989 | * @param str the string to convert | |
| 1990 | * @param output a pointer to the integer variable where the result shall be stored | |
| 1991 | * @param base 2, 8, 10, or 16 | |
| 1992 | * @retval zero success | |
| 1993 | * @retval non-zero conversion was not possible | |
| 1994 | */ | |
| 1995 | #define cx_strtou(str, output, base) cx_strtou_lc_(cx_strcast(str), output, base, ",") | |
| 1996 | ||
| 1997 | /** | |
| 1998 | * Converts a string to a number. | |
| 1999 | * | |
| 2000 | * The function returns non-zero when conversion is not possible. | |
| 2001 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 2002 | * It sets errno to ERANGE when the target datatype is too small. | |
| 2003 | * | |
| 2004 | * The comma character is treated as group separator and ignored during parsing. | |
| 2005 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 2006 | * | |
| 2007 | * @param str the string to convert | |
| 2008 | * @param output a pointer to the integer variable where the result shall be stored | |
| 2009 | * @param base 2, 8, 10, or 16 | |
| 2010 | * @retval zero success | |
| 2011 | * @retval non-zero conversion was not possible | |
| 2012 | */ | |
| 2013 | #define cx_strtoul(str, output, base) cx_strtoul_lc_(cx_strcast(str), output, base, ",") | |
| 2014 | ||
| 2015 | /** | |
| 2016 | * Converts a string to a number. | |
| 2017 | * | |
| 2018 | * The function returns non-zero when conversion is not possible. | |
| 2019 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 2020 | * It sets errno to ERANGE when the target datatype is too small. | |
| 2021 | * | |
| 2022 | * The comma character is treated as group separator and ignored during parsing. | |
| 2023 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 2024 | * | |
| 2025 | * @param str the string to convert | |
| 2026 | * @param output a pointer to the integer variable where the result shall be stored | |
| 2027 | * @param base 2, 8, 10, or 16 | |
| 2028 | * @retval zero success | |
| 2029 | * @retval non-zero conversion was not possible | |
| 2030 | */ | |
| 2031 | #define cx_strtoull(str, output, base) cx_strtoull_lc_(cx_strcast(str), output, base, ",") | |
| 2032 | ||
| 2033 | /** | |
| 2034 | * Converts a string to a number. | |
| 2035 | * | |
| 2036 | * The function returns non-zero when conversion is not possible. | |
| 2037 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 2038 | * It sets errno to ERANGE when the target datatype is too small. | |
| 2039 | * | |
| 2040 | * The comma character is treated as group separator and ignored during parsing. | |
| 2041 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 2042 | * | |
| 2043 | * @param str the string to convert | |
| 2044 | * @param output a pointer to the integer variable where the result shall be stored | |
| 2045 | * @param base 2, 8, 10, or 16 | |
| 2046 | * @retval zero success | |
| 2047 | * @retval non-zero conversion was not possible | |
| 2048 | */ | |
| 2049 | #define cx_strtou8(str, output, base) cx_strtou8_lc_(cx_strcast(str), output, base, ",") | |
| 2050 | ||
| 2051 | /** | |
| 2052 | * Converts a string to a number. | |
| 2053 | * | |
| 2054 | * The function returns non-zero when conversion is not possible. | |
| 2055 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 2056 | * It sets errno to ERANGE when the target datatype is too small. | |
| 2057 | * | |
| 2058 | * The comma character is treated as group separator and ignored during parsing. | |
| 2059 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 2060 | * | |
| 2061 | * @param str the string to convert | |
| 2062 | * @param output a pointer to the integer variable where the result shall be stored | |
| 2063 | * @param base 2, 8, 10, or 16 | |
| 2064 | * @retval zero success | |
| 2065 | * @retval non-zero conversion was not possible | |
| 2066 | */ | |
| 2067 | #define cx_strtou16(str, output, base) cx_strtou16_lc_(cx_strcast(str), output, base, ",") | |
| 2068 | ||
| 2069 | /** | |
| 2070 | * Converts a string to a number. | |
| 2071 | * | |
| 2072 | * The function returns non-zero when conversion is not possible. | |
| 2073 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 2074 | * It sets errno to ERANGE when the target datatype is too small. | |
| 2075 | * | |
| 2076 | * The comma character is treated as group separator and ignored during parsing. | |
| 2077 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 2078 | * | |
| 2079 | * @param str the string to convert | |
| 2080 | * @param output a pointer to the integer variable where the result shall be stored | |
| 2081 | * @param base 2, 8, 10, or 16 | |
| 2082 | * @retval zero success | |
| 2083 | * @retval non-zero conversion was not possible | |
| 2084 | */ | |
| 2085 | #define cx_strtou32(str, output, base) cx_strtou32_lc_(cx_strcast(str), output, base, ",") | |
| 2086 | ||
| 2087 | /** | |
| 2088 | * Converts a string to a number. | |
| 2089 | * | |
| 2090 | * The function returns non-zero when conversion is not possible. | |
| 2091 | * In that case the function sets errno to EINVAL when the reason is an invalid character or an unsupported base. | |
| 2092 | * It sets errno to ERANGE when the target datatype is too small. | |
| 2093 | * | |
| 2094 | * The comma character is treated as group separator and ignored during parsing. | |
| 2095 | * If you want to choose the set of group separators, use the @c _lc variant of this function (e.g. cx_strtoz_lc()). | |
| 2096 | * | |
| 2097 | * @param str the string to convert | |
| 2098 | * @param output a pointer to the integer variable where the result shall be stored | |
| 2099 | * @param base 2, 8, 10, or 16 | |
| 2100 | * @retval zero success | |
| 2101 | * @retval non-zero conversion was not possible | |
| 2102 | */ | |
| 2103 | #define cx_strtou64(str, output, base) cx_strtou64_lc_(cx_strcast(str), output, base, ",") | |
| 2104 | ||
| 2105 | /** | |
| 2106 | * Converts a string to a single precision floating point number. | |
| 2107 | * | |
| 2108 | * The function returns non-zero when conversion is not possible. | |
| 2109 | * In that case the function sets errno to EINVAL when the reason is an invalid character. | |
| 2110 | * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. | |
| 2111 | * | |
| 2112 | * @param str the string to convert | |
| 2113 | * @param output a pointer to the float variable where the result shall be stored | |
| 2114 | * @param decsep the decimal separator | |
| 2115 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 2116 | * @retval zero success | |
| 2117 | * @retval non-zero conversion was not possible | |
| 2118 | */ | |
| 2119 | #define cx_strtof_lc(str, output, decsep, groupsep) cx_strtof_lc_(cx_strcast(str), output, decsep, groupsep) | |
| 2120 | ||
| 2121 | /** | |
| 2122 | * Converts a string to a double precision floating point number. | |
| 2123 | * | |
| 2124 | * The function returns non-zero when conversion is not possible. | |
| 2125 | * In that case the function sets errno to EINVAL when the reason is an invalid character. | |
| 2126 | * | |
| 2127 | * @param str the string to convert | |
| 2128 | * @param output a pointer to the double variable where the result shall be stored | |
| 2129 | * @param decsep the decimal separator | |
| 2130 | * @param groupsep each character in this string is treated as group separator and ignored during conversion | |
| 2131 | * @retval zero success | |
| 2132 | * @retval non-zero conversion was not possible | |
| 2133 | */ | |
| 2134 | #define cx_strtod_lc(str, output, decsep, groupsep) cx_strtod_lc_(cx_strcast(str), output, decsep, groupsep) | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2135 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2136 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2137 | * Converts a string to a single precision floating point number. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2138 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2139 | * The function returns non-zero when conversion is not possible. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2140 | * In that case the function sets errno to EINVAL when the reason is an invalid character. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2141 | * It sets errno to ERANGE when the necessary representation would exceed the limits defined in libc's float.h. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2142 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2143 | * The decimal separator is assumed to be a dot character. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2144 | * The comma character is treated as group separator and ignored during parsing. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2145 | * If you want to choose a different format, use cx_strtof_lc(). |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2146 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2147 | * @param str the string to convert |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2148 | * @param output a pointer to the float variable where the result shall be stored |
| 16 | 2149 | * @retval zero success |
| 2150 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2151 | */ |
| 16 | 2152 | #define cx_strtof(str, output) cx_strtof_lc_(cx_strcast(str), output, '.', ",") |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2153 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2154 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2155 | * Converts a string to a double precision floating point number. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2156 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2157 | * The function returns non-zero when conversion is not possible. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2158 | * In that case the function sets errno to EINVAL when the reason is an invalid character. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2159 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2160 | * The decimal separator is assumed to be a dot character. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2161 | * The comma character is treated as group separator and ignored during parsing. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2162 | * If you want to choose a different format, use cx_strtof_lc(). |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2163 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2164 | * @param str the string to convert |
| 16 | 2165 | * @param output a pointer to the double variable where the result shall be stored |
| 2166 | * @retval zero success | |
| 2167 | * @retval non-zero conversion was not possible | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
2168 | */ |
| 16 | 2169 | #define cx_strtod(str, output) cx_strtod_lc_(cx_strcast(str), output, '.', ",") |
|
0
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2170 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2171 | #ifdef __cplusplus |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2172 | } // extern "C" |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2173 | #endif |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2174 | |
|
1a157da63d7c
add API for registering types and simple SQLite proof of concept
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2175 | #endif //UCX_STRING_H |