Design Pattern Examples
Overview of object-oriented design patterns
dynamicstring.h
Go to the documentation of this file.
1
5
6#pragma once
7#ifndef __DYNAMICSTRING_H__
8#define __DYNAMICSTRING_H__
9
10#include <stdbool.h>
11
15typedef struct DynamicString
16{
17 char* string;
18 size_t length;
20
28
37
48bool DynamicString_Append(DynamicString* string, const char* s);
49
61bool DynamicString_Set(DynamicString* string, const char* s);
62
63#endif // __DYNAMICSTRING_H__
void DynamicString_Clear(DynamicString *string)
Clear a DynamicString object, releasing any allocated memory. Resets to an empty string.
Definition: dynamicstring.c:27
void DynamicString_Initialize(DynamicString *string)
Initialize a DynamicString object to an empty string.
Definition: dynamicstring.c:15
bool DynamicString_Set(DynamicString *string, const char *s)
Set the DynamicString object to the specified string, replacing whatever is in the DynamicString obje...
Definition: dynamicstring.c:73
bool DynamicString_Append(DynamicString *string, const char *s)
Append the specified string to the DynamicString object.
Definition: dynamicstring.c:39
Represents a string that can be grown dynamically.
Definition: dynamicstring.h:16
size_t length
The current length of the string.
Definition: dynamicstring.h:18
char * string
The string that can grow.
Definition: dynamicstring.h:17