Design Pattern Examples
Overview of object-oriented design patterns
conststringlist.h
Go to the documentation of this file.
1
5
6#pragma once
7#ifndef __CONSTSTRINGLIST_H__
8#define __CONSTSTRINGLIST_H__
9
10#include <stdbool.h>
11
18typedef struct _ConstStringList
19{
24 const char** strings;
25
30
35
37
38
45
53
65bool ConstStringList_AddString(ConstStringList* stringList, const char* string);
66
79bool ConstStringList_AddStrings(ConstStringList* stringList, const char** strings, size_t numStrings);
80
88void ConstStringList_Remove(ConstStringList* stringList, int removeIndex);
89
99int ConstStringList_Find(ConstStringList* stringList, const char* string);
100
111
112#endif // __CONSTSTRINGLIST_H__
113
int ConstStringList_Find(ConstStringList *stringList, const char *string)
Search the given string list for the given string. If found, return the index of the found string.
void ConstStringList_Initialize(ConstStringList *stringList)
Initialize the given string list.
bool ConstStringList_AddStrings(ConstStringList *stringList, const char **strings, size_t numStrings)
Add an array of strings to the given string list.
struct _ConstStringList ConstStringList
Represents a list of pointers to zero-terminated strings that are to remain constant and never delete...
bool ConstStringList_AreListsEqual(ConstStringList *left, ConstStringList *right)
Compare two strings lists to determine if they have the same contents.
bool ConstStringList_AddString(ConstStringList *stringList, const char *string)
Add a string to the given string list.
void ConstStringList_Remove(ConstStringList *stringList, int removeIndex)
Remove the specified string from the given string list.
void ConstStringList_Clear(ConstStringList *stringList)
Clear the specified string list. The strings in the list are left alone, but the list itself is delet...
Represents a list of pointers to zero-terminated strings that are to remain constant and never delete...
size_t strings_count
Number of strings in the strings list.
const char ** strings
Pointer to an array of zero-terminated string pointers. These strings are constant and will not be du...
size_t allocated_count
The number of strings that can be held in the strings list.