ucx/string.h

Tue, 12 Dec 2017 17:41:01 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 12 Dec 2017 17:41:01 +0100
branch
v1.1
changeset 341
7954fdacdb5c
parent 314
8722a668fb2a
permissions
-rw-r--r--

enable va_list fix only on mingw (this is the real release, as usual)

1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
3 *
255
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
4 * Copyright 2016 Olaf Wintermann. All rights reserved.
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
5 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
6 * Redistribution and use in source and binary forms, with or without
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
7 * modification, are permitted provided that the following conditions are met:
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
8 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
10 * notice, this list of conditions and the following disclaimer.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
11 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
14 * documentation and/or other materials provided with the distribution.
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
27 */
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
28 /**
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
29 * Bounded string implementation.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
30 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
31 * The UCX strings (<code>sstr_t</code>) provide an alternative to C strings.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
32 * The main difference to C strings is, that <code>sstr_t</code> does <b>not
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
33 * need to be <code>NULL</code>-terminated</b>. Instead the length is stored
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
34 * within the structure.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
35 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
36 * When using <code>sstr_t</code>, developers must be full aware of what type
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
37 * of string (<code>NULL</code>-terminated) or not) they are using, when
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
38 * accessing the <code>char* ptr</code> directly.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
39 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
40 * The UCX string module provides some common string functions, known from
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
41 * standard libc, working with <code>sstr_t</code>.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
42 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
43 * @file string.h
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
44 * @author Mike Becker
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
45 * @author Olaf Wintermann
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 */
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
48 #ifndef UCX_STRING_H
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
49 #define UCX_STRING_H
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 #include "ucx.h"
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
52 #include "allocator.h"
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 #include <stddef.h>
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
55 /** Shortcut for a <code>sstr_t struct</code> literal. */
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
56 #define ST(s) { (char*)s, sizeof(s)-1 }
17
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
57
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
58 /** Shortcut for the conversion of a C string to a <code>sstr_t</code>. */
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
59 #define S(s) sstrn((char*)s, sizeof(s)-1)
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 #ifdef __cplusplus
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 extern "C" {
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 #endif
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
65 /**
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
66 * The UCX string structure.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
67 */
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
68 typedef struct {
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
69 /** A reference to the string (<b>not necessarily <code>NULL</code>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
70 * -terminated</b>) */
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 char *ptr;
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
72 /** The length of the string */
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 size_t length;
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 } sstr_t;
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
76 /**
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
77 * Creates a new sstr_t based on a C string.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
78 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
79 * The length is implicitly inferred by using a call to <code>strlen()</code>.
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 *
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
81 * <b>Note:</b> the sstr_t will hold a <i>reference</i> to the C string. If you
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
82 * do want a copy, use sstrdup() on the return value of this function.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
83 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
84 * @param cstring the C string to wrap
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
85 * @return a new sstr_t containing the C string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
86 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
87 * @see sstrn()
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 */
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
89 sstr_t sstr(char *cstring);
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
91 /**
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
92 * Creates a new sstr_t of the specified length based on a C string.
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93 *
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
94 * <b>Note:</b> the sstr_t will hold a <i>reference</i> to the C string. If you
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
95 * do want a copy, use sstrdup() on the return value of this function.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
96 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
97 * @param cstring the C string to wrap
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
98 * @param length the length of the string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
99 * @return a new sstr_t containing the C string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
100 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
101 * @see sstr()
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
102 * @see S()
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 */
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
104 sstr_t sstrn(char *cstring, size_t length);
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
107 /**
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
108 * Returns the cumulated length of all specified strings.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
109 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
110 * At least one string must be specified.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
111 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
112 * <b>Attention:</b> if the count argument does not match the count of the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
113 * specified strings, the behavior is undefined.
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 *
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
115 * @param count the total number of specified strings (so at least 1)
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
116 * @param string the first string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
117 * @param ... all other strings
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
118 * @return the cumulated length of all strings
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119 */
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
120 size_t sstrnlen(size_t count, sstr_t string, ...);
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
121
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
122 /**
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
123 * Concatenates two or more strings.
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
124 *
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
125 * The resulting string will be allocated by standard <code>malloc()</code>.
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
126 * So developers <b>MUST</b> pass the sstr_t.ptr to <code>free()</code>.
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
127 *
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
128 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>-
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
129 * terminated.
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
130 *
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
131 * @param count the total number of strings to concatenate
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
132 * @param s1 first string
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
133 * @param s2 second string
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
134 * @param ... all remaining strings
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
135 * @return the concatenated string
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
136 */
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
137 sstr_t sstrcat(size_t count, sstr_t s1, sstr_t s2, ...);
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
138
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
139 /**
255
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
140 * Concatenates two or more strings using a UcxAllocator.
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
141 *
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
142 * See sstrcat() for details.
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
143 *
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
144 * @param a the allocator to use
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
145 * @param count the total number of strings to concatenate
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
146 * @param s1 first string
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
147 * @param s2 second string
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
148 * @param ... all remaining strings
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
149 * @return the concatenated string
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
150 */
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
151 sstr_t sstrcat_a(UcxAllocator *a, size_t count, sstr_t s1, sstr_t s2, ...);
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
154 /**
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
155 * Returns a substring starting at the specified location.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
156 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
157 * <b>Attention:</b> the new string references the same memory area as the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
158 * input string and will <b>NOT</b> be <code>NULL</code>-terminated.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
159 * Use sstrdup() to get a copy.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
160 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
161 * @param string input string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
162 * @param start start location of the substring
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
163 * @return a substring of <code>string</code> starting at <code>start</code>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
164 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
165 * @see sstrsubsl()
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
166 * @see sstrchr()
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 */
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
168 sstr_t sstrsubs(sstr_t string, size_t start);
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
170 /**
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
171 * Returns a substring with a maximum length starting at the specified location.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
172 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
173 * <b>Attention:</b> the new string references the same memory area as the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
174 * input string and will <b>NOT</b> be <code>NULL</code>-terminated.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
175 * Use sstrdup() to get a copy.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
176 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
177 * @param string input string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
178 * @param start start location of the substring
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
179 * @param length the maximum length of the substring
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
180 * @return a substring of <code>string</code> starting at <code>start</code>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
181 * with a maximum length of <code>length</code>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
182 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
183 * @see sstrsubs()
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
184 * @see sstrchr()
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 */
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
186 sstr_t sstrsubsl(sstr_t string, size_t start, size_t length);
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
188 /**
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
189 * Returns a substring starting at the location of the first occurrence of the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
190 * specified character.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
191 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
192 * If the string does not contain the character, an empty string is returned.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
193 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
194 * @param string the string where to locate the character
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
195 * @param chr the character to locate
39
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
196 * @return a substring starting at the first location of <code>chr</code>
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
197 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
198 * @see sstrsubs()
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
199 */
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
200 sstr_t sstrchr(sstr_t string, int chr);
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
201
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
202 /**
39
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
203 * Returns a substring starting at the location of the last occurrence of the
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
204 * specified character.
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
205 *
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
206 * If the string does not contain the character, an empty string is returned.
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
207 *
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
208 * @param string the string where to locate the character
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
209 * @param chr the character to locate
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
210 * @return a substring starting at the last location of <code>chr</code>
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
211 *
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
212 * @see sstrsubs()
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
213 */
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
214 sstr_t sstrrchr(sstr_t string, int chr);
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
215
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
216 /**
255
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
217 * Returns a substring starting at the location of the first occurrence of the
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
218 * specified string.
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
219 *
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
220 * If the string does not contain the other string, an empty string is returned.
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
221 *
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
222 * If <code>match</code> is an empty string, the complete <code>string</code> is
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
223 * returned.
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
224 *
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
225 * @param string the string to be scanned
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
226 * @param match string containing the sequence of characters to match
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
227 * @return a substring starting at the first occurrence of
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
228 * <code>match</code>, or an empty string, if the sequence is not
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
229 * present in <code>string</code>
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
230 */
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
231 sstr_t sstrstr(sstr_t string, sstr_t match);
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
232
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
233 /**
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
234 * Splits a string into parts by using a delimiter string.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
235 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
236 * This function will return <code>NULL</code>, if one of the following happens:
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
237 * <ul>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
238 * <li>the string length is zero</li>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
239 * <li>the delimeter length is zero</li>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
240 * <li>the string equals the delimeter</li>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
241 * <li>memory allocation fails</li>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
242 * </ul>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
243 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
244 * The integer referenced by <code>count</code> is used as input and determines
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
245 * the maximum size of the resulting array, i.e. the maximum count of splits to
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
246 * perform + 1.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
247 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
248 * The integer referenced by <code>count</code> is also used as output and is
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
249 * set to
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
250 * <ul>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
251 * <li>-2, on memory allocation errors</li>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
252 * <li>-1, if either the string or the delimiter is an empty string</li>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
253 * <li>0, if the string equals the delimiter</li>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
254 * <li>1, if the string does not contain the delimiter</li>
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
255 * <li>the count of array items, otherwise</li>
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
256 * </ul>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
257 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
258 * If the string starts with the delimiter, the first item of the resulting
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
259 * array will be an empty string.
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
260 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
261 * If the string ends with the delimiter and the maximum list size is not
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
262 * exceeded, the last array item will be an empty string.
314
8722a668fb2a updates ucx version (most importantly this adds the new sstrstr implementation)
Mike Becker <universe@uap-core.de>
parents: 255
diff changeset
263 * In case the list size would be exceeded, the last array item will be the
8722a668fb2a updates ucx version (most importantly this adds the new sstrstr implementation)
Mike Becker <universe@uap-core.de>
parents: 255
diff changeset
264 * remaining string after the last split, <i>including</i> the terminating
8722a668fb2a updates ucx version (most importantly this adds the new sstrstr implementation)
Mike Becker <universe@uap-core.de>
parents: 255
diff changeset
265 * delimiter.
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
266 *
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
267 * <b>Attention:</b> The array pointer <b>AND</b> all sstr_t.ptr of the array
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
268 * items must be manually passed to <code>free()</code>. Use sstrsplit_a() with
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
269 * an allocator to managed memory, to avoid this.
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
270 *
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
271 * @param string the string to split
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
272 * @param delim the delimiter string
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
273 * @param count IN: the maximum size of the resulting array (0 = no limit),
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
274 * OUT: the actual size of the array
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
275 * @return a sstr_t array containing the split strings or
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
276 * <code>NULL</code> on error
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
277 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
278 * @see sstrsplit_a()
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
279 */
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
280 sstr_t* sstrsplit(sstr_t string, sstr_t delim, ssize_t *count);
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
281
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
282 /**
255
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
283 * Performing sstrsplit() using a UcxAllocator.
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
284 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
285 * <i>Read the description of sstrsplit() for details.</i>
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
286 *
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
287 * The memory for the sstr_t.ptr pointers of the array items and the memory for
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
288 * the sstr_t array itself are allocated by using the UcxAllocator.malloc()
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
289 * function.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
290 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
291 * <b>Note:</b> the allocator is not used for memory that is freed within the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
292 * same call of this function (locally scoped variables).
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
293 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
294 * @param allocator the UcxAllocator used for allocating memory
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
295 * @param string the string to split
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
296 * @param delim the delimiter string
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
297 * @param count IN: the maximum size of the resulting array (0 = no limit),
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
298 * OUT: the actual size of the array
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
299 * @return a sstr_t array containing the split strings or
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
300 * <code>NULL</code> on error
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
301 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
302 * @see sstrsplit()
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
303 */
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
304 sstr_t* sstrsplit_a(UcxAllocator *allocator, sstr_t string, sstr_t delim,
70
88092b88ec00 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
305 ssize_t *count);
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
306
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
307 /**
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
308 * Compares two UCX strings with standard <code>memcmp()</code>.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
309 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
310 * At first it compares the sstr_t.length attribute of the two strings. The
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
311 * <code>memcmp()</code> function is called, if and only if the lengths match.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
312 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
313 * @param s1 the first string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
314 * @param s2 the second string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
315 * @return -1, if the length of s1 is less than the length of s2 or 1, if the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
316 * length of s1 is greater than the length of s2 or the result of
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
317 * <code>memcmp()</code> otherwise (i.e. 0 if the strings match)
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
318 */
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
319 int sstrcmp(sstr_t s1, sstr_t s2);
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
320
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
321 /**
39
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
322 * Compares two UCX strings ignoring the case.
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
323 *
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
324 * At first it compares the sstr_t.length attribute of the two strings. If and
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
325 * only if the lengths match, both strings are compared char by char ignoring
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
326 * the case.
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
327 *
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
328 * @param s1 the first string
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
329 * @param s2 the second string
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
330 * @return -1, if the length of s1 is less than the length of s2 or 1, if the
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
331 * length of s1 is greater than the length of s2 or the difference between the
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
332 * first two differing characters otherwise (i.e. 0 if the strings match and
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
333 * no characters differ)
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
334 */
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
335 int sstrcasecmp(sstr_t s1, sstr_t s2);
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
336
3e55bed345f9 added some aes functions + ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 17
diff changeset
337 /**
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
338 * Creates a duplicate of the specified string.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
339 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
340 * The new sstr_t will contain a copy allocated by standard
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
341 * <code>malloc()</code>. So developers <b>MUST</b> pass the sstr_t.ptr to
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
342 * <code>free()</code>.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
343 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
344 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>-
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
345 * terminated.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
346 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
347 * @param string the string to duplicate
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
348 * @return a duplicate of the string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
349 * @see sstrdup_a()
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
350 */
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
351 sstr_t sstrdup(sstr_t string);
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
352
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
353 /**
255
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
354 * Creates a duplicate of the specified string using a UcxAllocator.
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
355 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
356 * The new sstr_t will contain a copy allocated by the allocators
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
357 * ucx_allocator_malloc function. So it is implementation depended, whether the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
358 * returned sstr_t.ptr pointer must be passed to the allocators
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
359 * ucx_allocator_free function manually.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
360 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
361 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>-
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
362 * terminated.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
363 *
255
bf19378aed58 updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents: 174
diff changeset
364 * @param allocator a valid instance of a UcxAllocator
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
365 * @param string the string to duplicate
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
366 * @return a duplicate of the string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
367 * @see sstrdup()
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
368 */
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
369 sstr_t sstrdup_a(UcxAllocator *allocator, sstr_t string);
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
370
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
371 /**
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
372 * Omits leading and trailing spaces.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
373 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
374 * This function returns a new sstr_t containing a trimmed version of the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
375 * specified string.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
376 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
377 * <b>Note:</b> the new sstr_t references the same memory, thus you
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
378 * <b>MUST NOT</b> pass the sstr_t.ptr of the return value to
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
379 * <code>free()</code>. It is also highly recommended to avoid assignments like
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
380 * <code>mystr = sstrtrim(mystr);</code> as you lose the reference to the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
381 * source string. Assignments of this type are only permitted, if the
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
382 * sstr_t.ptr of the source string does not need to be freed or if another
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
383 * reference to the source string exists.
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
384 *
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
385 * @param string the string that shall be trimmed
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
386 * @return a new sstr_t containing the trimmed string
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
387 */
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
388 sstr_t sstrtrim(sstr_t string);
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
389
17
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
390 /**
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
391 * Checks, if a string has a specific prefix.
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
392 * @param string the string to check
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
393 * @param prefix the prefix the string should have
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
394 * @return 1, if and only if the string has the specified prefix, 0 otherwise
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
395 */
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
396 int sstrprefix(sstr_t string, sstr_t prefix);
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
397
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
398 /**
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
399 * Checks, if a string has a specific suffix.
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
400 * @param string the string to check
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
401 * @param suffix the suffix the string should have
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
402 * @return 1, if and only if the string has the specified suffix, 0 otherwise
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
403 */
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
404 int sstrsuffix(sstr_t string, sstr_t suffix);
11dffb40cd91 new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
405
174
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
406 /**
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
407 * Returns a lower case version of a string.
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
408 *
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
409 * This function creates a duplicate of the input string, first. See the
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
410 * documentation of sstrdup() for the implications.
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
411 *
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
412 * @param string the input string
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
413 * @return the resulting lower case string
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
414 * @see sstrdup()
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
415 */
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
416 sstr_t sstrlower(sstr_t string);
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
417
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
418 /**
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
419 * Returns a lower case version of a string.
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
420 *
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
421 * This function creates a duplicate of the input string, first. See the
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
422 * documentation of sstrdup_a() for the implications.
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
423 *
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
424 * @param allocator the allocator used for duplicating the string
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
425 * @param string the input string
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
426 * @return the resulting lower case string
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
427 * @see sstrdup_a()
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
428 */
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
429 sstr_t sstrlower_a(UcxAllocator *allocator, sstr_t string);
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
430
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
431 /**
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
432 * Returns a upper case version of a string.
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
433 *
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
434 * This function creates a duplicate of the input string, first. See the
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
435 * documentation of sstrdup() for the implications.
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
436 *
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
437 * @param string the input string
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
438 * @return the resulting upper case string
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
439 * @see sstrdup()
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
440 */
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
441 sstr_t sstrupper(sstr_t string);
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
442
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
443 /**
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
444 * Returns a upper case version of a string.
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
445 *
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
446 * This function creates a duplicate of the input string, first. See the
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
447 * documentation of sstrdup_a() for the implications.
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
448 *
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
449 * @param allocator the allocator used for duplicating the string
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
450 * @param string the input string
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
451 * @return the resulting upper case string
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
452 * @see sstrdup_a()
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
453 */
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
454 sstr_t sstrupper_a(UcxAllocator *allocator, sstr_t string);
e7e56c56d126 updated ucx and used new sstrlower in util_header_callback
Mike Becker <universe@uap-core.de>
parents: 110
diff changeset
455
1
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
456 #ifdef __cplusplus
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
457 }
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
458 #endif
1bcaac272cdf added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
459
5
88625853ae74 new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
460 #endif /* UCX_STRING_H */

mercurial