picox  0.1
xdynamic_string.h
[詳解]
1 
14 /*
15  * License: MIT license
16  * Copyright (c) <2015> <MaskedW [maskedw00@gmail.com]>
17  *
18  * Permission is hereby granted, free of charge, to any person
19  * obtaining a copy of this software and associated documentation
20  * files (the "Software"), to deal in the Software without
21  * restriction, including without limitation the rights to use, copy,
22  * modify, merge, publish, distribute, sublicense, and/or sell copies
23  * of the Software, and to permit persons to whom the Software is
24  * furnished to do so, subject to the following conditions:
25  *
26  * The above copyright notice and this permission notice shall be
27  * included in all copies or substantial portions of the Software.
28  *
29  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
33  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
34  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
35  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36  * SOFTWARE.
37  */
38 
39 
40 #ifndef picox_string_xdynamic_string_h_
41 #define picox_string_xdynamic_string_h_
42 
43 
44 #include <picox/core/xcore.h>
45 
46 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif /* __cplusplus */
58 
59 
60 struct XDynamicString;
61 typedef struct XDynamicString XDynamicString;
62 
63 
66 XDynamicString* xdstr_create(const char* src);
67 
68 
71 XDynamicString* xdstr_create_length(const char* src, size_t len);
72 
73 
76 XDynamicString* xdstr_create_empty(void);
77 
78 
81 void xdstr_destroy(XDynamicString* self);
82 
83 
86 XDynamicString* xdstr_clone(const XDynamicString* self);
87 
88 
91 XDynamicString* xdstr_cat(XDynamicString* self, const char* str);
92 
93 
96 XDynamicString* xdstr_cat_n(XDynamicString* self, const char* str, size_t len);
97 
98 
101 XDynamicString* xdstr_cat_printf(XDynamicString* self, const char *fmt, ...);
102 
103 
106 XDynamicString* xdstr_cat_vprintf(XDynamicString* self, const char *fmt, va_list args);
107 
108 
111 XDynamicString* xdstr_copy(XDynamicString* self, const char* str);
112 
113 
116 XDynamicString* xdstr_copy_n(XDynamicString* self, const char* str, size_t len);
117 
118 
121 void xdstr_trim(XDynamicString* self, const char* char_set);
122 
123 
135 void xdstr_range(XDynamicString* self, int first, int last);
136 
137 
140 void xdstr_to_lower(XDynamicString* self);
141 
142 
145 void xdstr_to_upper(XDynamicString* self);
146 
147 
150 size_t xdstr_length(const XDynamicString* self);
151 
152 
155 size_t xdstr_capacity(const XDynamicString* self);
156 
157 
160 const char* xdstr_c_str(const XDynamicString* self);
161 
162 
165 XDynamicString* xdstr_shrink_to_fit(XDynamicString* self);
166 
167 
172 XDynamicString* xdstr_reserve(XDynamicString* self, size_t size);
173 
174 
175 #ifdef __cplusplus
176 }
177 #endif /* __cplusplus */
178 
179 
185 #endif /* picox_string_xdynamic_string_h_ */
XDynamicString * xdstr_create(const char *src)
srcをコピーした文字列を生成して返します
Definition: xdynamic_string.c:50
size_t xdstr_length(const XDynamicString *self)
文字列の長さを返します
Definition: xdynamic_string.c:215
void xdstr_to_upper(XDynamicString *self)
文字列のアルファベットを大文字に変換します
Definition: xdynamic_string.c:180
XDynamicString * xdstr_clone(const XDynamicString *self)
文字列のコピーを生成して返します
Definition: xdynamic_string.c:77
XDynamicString * xdstr_reserve(XDynamicString *self, size_t size)
ストレージをsizeバイトまで(末尾のnullバイトを除く)格納できるサイズまで拡張して返します ...
Definition: xdynamic_string.c:194
XDynamicString * xdstr_cat_vprintf(XDynamicString *self, const char *fmt, va_list args)
文字列末尾にvprintf形式で文字列を連結して返します
Definition: xdynamic_string.c:116
XDynamicString * xdstr_create_length(const char *src, size_t len)
srcからlenバイトをコピーした文字列を生成して返します
Definition: xdynamic_string.c:57
const char * xdstr_c_str(const XDynamicString *self)
文字列のconst char*を返します
Definition: xdynamic_string.c:208
size_t xdstr_capacity(const XDynamicString *self)
文字列に格納できるバイト数を返します
Definition: xdynamic_string.c:151
XDynamicString * xdstr_cat_n(XDynamicString *self, const char *str, size_t len)
文字列末尾にstrから最大len文字を連結して返します
Definition: xdynamic_string.c:93
XDynamicString * xdstr_copy_n(XDynamicString *self, const char *str, size_t len)
文字列にstrから最大len文字をコピーして返します
Definition: xdynamic_string.c:138
void xdstr_trim(XDynamicString *self, const char *char_set)
文字列からchar_setに含まれる各文字を除去します
Definition: xdynamic_string.c:158
void xdstr_to_lower(XDynamicString *self)
文字列のアルファベットを小文字に変換します
Definition: xdynamic_string.c:173
XDynamicString * xdstr_create_empty(void)
長さ0の文字列を生成して返します
Definition: xdynamic_string.c:64
XDynamicString * xdstr_shrink_to_fit(XDynamicString *self)
ストレージサイズを文字列長がちょうど収まるサイズにまで縮小して返します
Definition: xdynamic_string.c:187
void xdstr_range(XDynamicString *self, int first, int last)
文字列からfirst ~ lastまで(last自身も含む)の範囲外の部分を除去します
Definition: xdynamic_string.c:166
XDynamicString * xdstr_cat_printf(XDynamicString *self, const char *fmt,...)
文字列末尾にprintf形式で文字列を連結して返します
Definition: xdynamic_string.c:102
void xdstr_destroy(XDynamicString *self)
文字列のリソースを開放します
Definition: xdynamic_string.c:71
XDynamicString * xdstr_cat(XDynamicString *self, const char *str)
文字列末尾にstrを連結して返します
Definition: xdynamic_string.c:84
XDynamicString * xdstr_copy(XDynamicString *self, const char *str)
文字列にstrをコピーして返します
Definition: xdynamic_string.c:125