7#ifndef TOY_REFSTRING_H_
8#define TOY_REFSTRING_H_
25typedef void* (*Toy_RefStringAllocatorFn)(
void *pointer,
size_t oldSize,
size_t newSize);
Definition: toy_refstring.h:41
char data[]
Definition: toy_refstring.h:44
int refCount
Definition: toy_refstring.h:43
size_t length
Definition: toy_refstring.h:42
TOY_API void Toy_setRefStringAllocatorFn(Toy_RefStringAllocatorFn)
Conforms to and is invoked by Toy's memory API, and generally shouldn't be used.
void *(* Toy_RefStringAllocatorFn)(void *pointer, size_t oldSize, size_t newSize)
Prototype for interface conforms to Toy's memory API, and generally shouldn't be used.
Definition: toy_refstring.h:25
TOY_API const char * Toy_toCString(Toy_RefString *refString)
Exposes the interal cstring of refString. Only use this function when dealing with external APIs.
TOY_API Toy_RefString * Toy_copyRefString(Toy_RefString *refString)
Increases the reference counter of refString by 1, before returning the given pointer.
TOY_API void Toy_deleteRefString(Toy_RefString *refString)
Reduces the refString's reference counter by 1 and, if it reaches 0, frees the memory.
TOY_API Toy_RefString * Toy_deepCopyRefString(Toy_RefString *refString)
Behaves identically to Toy_copyRefString, except that it explicitly preforms a deep copy of the inter...
TOY_API size_t Toy_lengthRefString(Toy_RefString *refString)
Returns the length of the underlying cstring of refString.
TOY_API int Toy_countRefString(Toy_RefString *refString)
Returns the total number of references to refString, for debugging.
TOY_API Toy_RefString * Toy_createRefString(const char *cstring)
Wraps Toy_CreateRefStringLength, by determining the length of the given cstring and passing it to the...
TOY_API bool Toy_equalsRefStringCString(Toy_RefString *lhs, char *cstring)
Returns true when the refString contains the same value as the cstring. Otherwise it returns false.
TOY_API Toy_RefString * Toy_createRefStringLength(const char *cstring, size_t length)
Returns a new Toy_RefString, containing a copy of cstring, or NULL on error. This function also sets ...
TOY_API bool Toy_equalsRefString(Toy_RefString *lhs, Toy_RefString *rhs)
Returns true when the two refstrings are either the same refstring, or contain the same value....