String
This commit is contained in:
+11
-11
@@ -18,32 +18,32 @@ typedef struct {
|
||||
c_size_t size; // Current active string rows stored
|
||||
c_size_t capacity; // Max allocated capacity bounds of the internal pointer matrix
|
||||
c_Allocator_t allocator;
|
||||
} c_StringList;
|
||||
} c_StringList_t;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
c_err_t c_StringList_Init(c_StringList* self, c_size_t capacity, c_Allocator_t* allocator);
|
||||
void c_StringList_Destroy(c_StringList* self);
|
||||
c_err_t c_StringList_Init(c_StringList_t* self, c_size_t capacity, c_Allocator_t* allocator);
|
||||
void c_StringList_Destroy(c_StringList_t* self);
|
||||
|
||||
// 核心操作 API (安全深拷贝值复制模式)
|
||||
c_err_t c_StringList_Add(c_StringList* self, const char* str);
|
||||
c_err_t c_StringList_InsertAt(c_StringList* self, c_size_t index, const char* str);
|
||||
c_err_t c_StringList_RemoveAt(c_StringList* self, c_size_t index);
|
||||
void c_StringList_Clear(c_StringList* self);
|
||||
c_err_t c_StringList_Add(c_StringList_t* self, const char* str);
|
||||
c_err_t c_StringList_InsertAt(c_StringList_t* self, c_size_t index, const char* str);
|
||||
c_err_t c_StringList_RemoveAt(c_StringList_t* self, c_size_t index);
|
||||
void c_StringList_Clear(c_StringList_t* self);
|
||||
|
||||
// 高级功能接口
|
||||
c_err_t c_StringList_Clone(c_StringList* dest, const c_StringList* src);
|
||||
c_err_t c_StringList_Deduplicate(c_StringList* self);
|
||||
c_err_t c_StringList_Clone(c_StringList_t* dest, const c_StringList_t* src);
|
||||
c_err_t c_StringList_Deduplicate(c_StringList_t* self);
|
||||
|
||||
// 极致高频内联只读窥探接口
|
||||
C_STATIC_FORCE_INLINE
|
||||
c_size_t c_StringList_Size(const c_StringList* self) {
|
||||
c_size_t c_StringList_Size(const c_StringList_t* self) {
|
||||
return self ? self->size : 0; // O(1) 实时读取
|
||||
}
|
||||
|
||||
C_STATIC_FORCE_INLINE
|
||||
const char* c_StringList_Get(const c_StringList* self, c_size_t index) {
|
||||
const char* c_StringList_Get(const c_StringList_t* self, c_size_t index) {
|
||||
if (!self || index >= self->size || !self->strings) return NULL;
|
||||
return self->strings[index]; // 零拷贝原位返回
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user