LibJuno 0.32.0
LibJuno is a lightweight C99 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
string_api.h
Go to the documentation of this file.
1/*
2 MIT License
3
4 Copyright (c) 2025 Robin A. Onsay
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files
8 (the "Software"), to deal in the Software without restriction,
9 including without limitation the rights to use, copy, modify, merge,
10 publish, distribute, sublicense, and/or sell copies of the Software,
11 and to permit persons to whom the Software is furnished to do so,
12 subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be
15 included in all copies or substantial portions of the Software.
16*/
17
27#ifndef JUNO_STRING_API_H
28#define JUNO_STRING_API_H
30#include "juno/status.h"
31#include "juno/module.h"
32#ifdef __cplusplus
33extern "C"
34{
35#endif
36
38typedef struct JUNO_STRING_BUFFER_TAG JUNO_STRING_BUFFER_T;
39
40typedef union JUNO_STRING_TAG JUNO_STRING_T;
41typedef struct JUNO_STRING_ROOT_TAG JUNO_STRING_ROOT_T;
42
43
44struct JUNO_STRING_ROOT_TAG JUNO_MODULE_ROOT(JUNO_STRING_API_T,
45 JUNO_MEMORY_ALLOC_T *ptAlloc;
46 JUNO_MEMORY_T tMemory;
47 size_t zSize;
48);
49
51{
53 JUNO_STATUS_T (*Init)(JUNO_STRING_T *ptJunoString, JUNO_MEMORY_ALLOC_T *ptAlloc, const char *pcCStr, size_t zCStrSize);
54 JUNO_STATUS_T (*Append)(JUNO_STRING_T *ptJunoString, JUNO_STRING_T *ptNewJunoString);
55 JUNO_STATUS_T (*AppendCStr)(JUNO_STRING_T *ptJunoString, const char *pcCStr, size_t zCStrSize);
56 JUNO_STATUS_T (*GetSize)(JUNO_STRING_T *ptJunoString, size_t *pzSize);
58 JUNO_STATUS_T (*Free)(JUNO_STRING_T *ptJunoString);
59};
60
61#ifdef __cplusplus
62}
63#endif
64#endif // JUNO_STRING_API_H
union JUNO_MEMORY_ALLOC_TAG JUNO_MEMORY_ALLOC_T
Definition memory_api.h:76
#define JUNO_MODULE_ROOT(API_T, members)
Definition module.h:175
enum JUNO_STATUS_TAG JUNO_STATUS_T
struct JUNO_STRING_BUFFER_TAG JUNO_STRING_BUFFER_T
Definition string_api.h:38
struct JUNO_STRING_ROOT_TAG JUNO_STRING_ROOT_T
Definition string_api.h:41
union JUNO_STRING_TAG JUNO_STRING_T
Definition string_api.h:40
Structure for an allocated memory segment. Describes the allocated memory with a pointer to the start...
Definition memory_api.h:65
Definition string_api.h:51
JUNO_STATUS_T(* AppendCStr)(JUNO_STRING_T *ptJunoString, const char *pcCStr, size_t zCStrSize)
Definition string_api.h:55
JUNO_STATUS_T(* Init)(JUNO_STRING_T *ptJunoString, JUNO_MEMORY_ALLOC_T *ptAlloc, const char *pcCStr, size_t zCStrSize)
Initializes the module and resources for juno_string.
Definition string_api.h:53
JUNO_STATUS_T(* Append)(JUNO_STRING_T *ptJunoString, JUNO_STRING_T *ptNewJunoString)
Definition string_api.h:54
JUNO_STATUS_T(* GetSize)(JUNO_STRING_T *ptJunoString, size_t *pzSize)
Definition string_api.h:56
JUNO_STATUS_T(* Free)(JUNO_STRING_T *ptJunoString)
Frees resources allocated by juno_string.
Definition string_api.h:58