c_util
C utility library for low-level programming
Loading...
Searching...
No Matches
core_string.h
Go to the documentation of this file.
1
42#pragma once
43
44#include <stdbool.h>
45#include <stdint.h>
46
47// TODO: core_string_replace() 部分文字列の入れ替え
48
60
70
78#define CORE_STRING_INITIALIZER { 0 }
79
112void core_string_default_create(core_string_t* const string_);
113
146CORE_STRING_ERROR_CODE core_string_create(const char* const src_, core_string_t* const dst_);
147
187
217CORE_STRING_ERROR_CODE core_string_copy_from_char(const char* const src_, core_string_t* const dst_);
218
245void core_string_destroy(core_string_t* const string_);
246
278CORE_STRING_ERROR_CODE core_string_buffer_reserve(uint64_t buffer_size_, core_string_t* const string_);
279
310CORE_STRING_ERROR_CODE core_string_buffer_resize(uint64_t buffer_size_, core_string_t* const string_);
311
334uint64_t core_string_buffer_capacity(const core_string_t* const string_);
335
359bool core_string_is_empty(const core_string_t* const string_);
360
391bool core_string_equal(const core_string_t* const string1_, const core_string_t* const string2_);
392
421bool core_string_equal_from_char(const char* const str1_, const core_string_t* const string2_);
422
448uint64_t core_string_length(const core_string_t* const string_);
449
476const char* core_string_cstr(const core_string_t* const string_);
477
516
558CORE_STRING_ERROR_CODE core_string_substring_copy(const core_string_t* const src_, core_string_t* const dst_, uint16_t from_, uint16_t to_);
559
595CORE_STRING_ERROR_CODE core_string_trim(const core_string_t* const src_, core_string_t* const dst_, char ltrim_, char rtrim_);
596
625CORE_STRING_ERROR_CODE core_string_to_i32(const core_string_t* const string_, int32_t* out_value_);
CORE_STRING_ERROR_CODE core_string_to_i32(const core_string_t *const string_, int32_t *out_value_)
core_string_tオブジェクトの内容をint32_t型整数に変換する。
Definition core_string.c:486
CORE_STRING_ERROR_CODE core_string_copy(const core_string_t *const src_, core_string_t *const dst_)
コピー元src_の文字列内容を、コピー先dst_に複製する。
Definition core_string.c:92
CORE_STRING_ERROR_CODE core_string_create(const char *const src_, core_string_t *const dst_)
引数のsrc_をコピーして、dst_オブジェクトを初期化済み状態にする。
Definition core_string.c:68
uint64_t core_string_length(const core_string_t *const string_)
core_string_tオブジェクトが保持している文字列の長さを取得する
Definition core_string.c:323
bool core_string_is_empty(const core_string_t *const string_)
core_string_tオブジェクトが保持する文字列格納バッファが空かどうかを判定する
Definition core_string.c:260
void core_string_default_create(core_string_t *const string_)
引数で与えたstring_オブジェクトを「デフォルト状態」に初期化する。
Definition core_string.c:63
CORE_STRING_ERROR_CODE core_string_substring_copy(const core_string_t *const src_, core_string_t *const dst_, uint16_t from_, uint16_t to_)
src_ の [from_, to_] 範囲の部分文字列を dst_ にコピーする
Definition core_string.c:389
CORE_STRING_ERROR_CODE core_string_concat(const core_string_t *const string_, core_string_t *const dst_)
dst_の末尾にstring_の内容を連結する
Definition core_string.c:349
uint64_t core_string_buffer_capacity(const core_string_t *const string_)
core_string_tオブジェクトのバッファサイズを取得する。
Definition core_string.c:248
const char * core_string_cstr(const core_string_t *const string_)
core_string_tオブジェクトが保持している文字列の先頭ポインタを取得する
Definition core_string.c:336
CORE_STRING_ERROR_CODE core_string_trim(const core_string_t *const src_, core_string_t *const dst_, char ltrim_, char rtrim_)
指定したトリム文字を取り除いた文字列をdst_にコピーする。
Definition core_string.c:428
CORE_STRING_ERROR_CODE core_string_buffer_reserve(uint64_t buffer_size_, core_string_t *const string_)
string_オブジェクトに指定サイズの文字列バッファを確保する。
Definition core_string.c:168
struct core_string_t core_string_t
文字列オブジェクト構造体
CORE_STRING_ERROR_CODE core_string_copy_from_char(const char *const src_, core_string_t *const dst_)
dst_にchar*型文字列をコピーする
Definition core_string.c:129
bool core_string_equal(const core_string_t *const string1_, const core_string_t *const string2_)
2つのcore_string_tオブジェクトが保持する文字列が等しいかを比較する
Definition core_string.c:275
CORE_STRING_ERROR_CODE
core_string_t関連処理が出力するエラーコード
Definition core_string.h:53
@ CORE_STRING_BUFFER_EMPTY
Definition core_string.h:57
@ CORE_STRING_INVALID_ARGUMENT
Definition core_string.h:55
@ CORE_STRING_MEMORY_ALLOCATE_ERROR
Definition core_string.h:58
@ CORE_STRING_RUNTIME_ERROR
Definition core_string.h:56
@ CORE_STRING_SUCCESS
Definition core_string.h:54
bool core_string_equal_from_char(const char *const str1_, const core_string_t *const string2_)
char*型文字列とcore_string_tオブジェクトが保持する文字列が等しいかを比較する
Definition core_string.c:301
CORE_STRING_ERROR_CODE core_string_buffer_resize(uint64_t buffer_size_, core_string_t *const string_)
core_string_tオブジェクトのバッファサイズをbuffer_size_に拡張する
Definition core_string.c:198
void core_string_destroy(core_string_t *const string_)
string_が保持するメモリを破棄する。
Definition core_string.c:155
文字列オブジェクト構造体
Definition core_string.h:67
void * internal_data
Definition core_string.h:68