Strs
Description
Vector of strings
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Str.c:289:
}
static Strs str_split_impl(Str *s, Zstr key, size keylen) {
ValidateStr(s);- In
Str.c:292:
ValidateStr(s);
Strs sv = (Strs)VecInit(s->allocator);
sv.copy_deinit = (GenericCopyDeinit)str_deinit;
Zstr prev = s->data;- In
Str.c:317:
}
Strs str_split_zstr(Str *s, Zstr key) {
return str_split_impl(s, key, ZstrLen(key));
}- In
Str.c:321:
}
Strs str_split_str(Str *s, const Str *key) {
if (!key) {
LOG_FATAL("Invalid arguments");- In
Str.c:1152:
}
void ValidateStrs(const Strs *vs) {
ValidateVec(vs);
VecForeachPtr(vs, sp) {- In
Str.Ops.c:209:
// Test StrSplit
Str s = StrInitFromZstr("Hello,World,Test", &alloc);
Strs split = StrSplit(&s, ",");
bool result = (VecLen(&split) == 3);- In
Str.Type.c:45:
// Test Strs type definition
bool test_strs_type(void) {
WriteFmt("Testing Strs type definition\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Str.Type.c:50:
// Create a Strs object (vector of strings)
Strs sv = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
// Add some strings
- In
Str.Type.c:106:
// Create a valid Strs
Strs sv = VecInit(&alloc);
// This should not crash
- In
Str.Type.c:151:
// Deadend test: Test ValidateStrs with invalid Strs (should crash/abort)
bool test_validate_invalid_strs(void) {
WriteFmt("Testing ValidateStrs with invalid Strs (should abort)\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Str.Type.c:156:
// Create an invalid Strs by corrupting its fields
Strs sv = VecInit(&alloc);
// Corrupt the vector to make it invalid
- In
Type.h:54:
/// TAGS: Str, Validate, API
///
void ValidateStrs(const Strs *vs);
#endif // MISRA_STD_CONTAINER_STR_TYPE_H
Last updated on