-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsubstitute.h
More file actions
51 lines (40 loc) · 2.21 KB
/
substitute.h
File metadata and controls
51 lines (40 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Copyright (C) 2025 Clownacy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SUBSTITUTE_H
#define SUBSTITUTE_H
#include "clowncommon/clowncommon.h"
#include "string.h"
typedef struct Substitute_ListEntry
{
struct Substitute_ListEntry *next;
String identifier;
const StringView *value;
} Substitute_ListEntry;
typedef struct Substitute_State
{
Substitute_ListEntry *list_head;
} Substitute_State;
typedef const StringView* (*Substitute_CustomSearch)(void *user_data, const StringView *view_to_search, size_t starting_position, cc_bool case_insensitive, size_t* const found_position, size_t* const found_length);
void Substitute_Initialise(Substitute_State *state);
void Substitute_Deinitialise(Substitute_State *state);
cc_bool Substitute_PushSubstitute(Substitute_State *state, const StringView *identifier, const StringView *value);
void Substitute_PopSubstitute(Substitute_State *state);
void Substitute_ProcessSubString(Substitute_State *state, Substitute_State *other_state, String *string, StringView *view_to_search, Substitute_CustomSearch custom_search_callback, const void *custom_search_user_data, cc_bool allow_implicit_matches, cc_bool case_insensitive);
void Substitute_ProcessString(Substitute_State *state, Substitute_State *other_state, String *string, Substitute_CustomSearch custom_search_callback, const void *custom_search_user_data, cc_bool allow_implicit_matches, cc_bool case_insensitive);
cc_bool Substitute_IsSubstituteBlockingCharacter(char character);
cc_bool Substitute_IsWhitespaceCharacter(char character);
#endif /* SUBSTITUTE_H */