src/cx/string.h

Tue, 18 Apr 2023 19:15:50 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 18 Apr 2023 19:15:50 +0200
changeset 687
612ed521b1c5
parent 684
380bd45bc94a
child 693
494d9b20b99e
permissions
-rw-r--r--

tweak rehash test to achieve missing coverage

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

mercurial