Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/protocol/osc/pattern.h

raw
1 /*
2 * Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/>
3 * (C) 2025 Vladimir Sadovnikov <[email protected]>
4 *
5 * This file is part of lsp-runtime-lib
6 * Created on: 29 мая 2019 г.
7 *
8 * lsp-runtime-lib is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * lsp-runtime-lib is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #ifndef LSP_PLUG_IN_PROTOCOL_OSC_PATTERN_H_
23 #define LSP_PLUG_IN_PROTOCOL_OSC_PATTERN_H_
24
25 #include <lsp-plug.in/runtime/version.h>
26 #include <lsp-plug.in/protocol/osc/types.h>
27
28 namespace lsp
29 {
30 namespace osc
31 {
32 typedef struct pattern_t
33 {
34 size_t nparts;
35 char *format;
36 char **parts;
37 } pattern_t;
38
39 /**
40 * Create and prepare pattern, this is not RT-safe method.
41 *
42 * @param pattern pattern to compile
43 * @param format pattern format
44 * @return status of operation
45 */
46 status_t pattern_create(pattern_t *pattern, const char *format);
47
48 /**
49 * Get original format text of the pattern
50 * @param pattern pattern to retrieve text format
51 * @param format pointer to store the output format
52 * @return status of operation
53 */
54 status_t pattern_get_format(pattern_t *pattern, const char **format);
55
56 /**
57 * Match the address to the pattern, this is thread-safe and RT-safe method
58 * @param pattern the pattern to perform match
59 * @param address address to match
60 * @return true if pattern matches, false if not or error occurred
61 */
62 bool pattern_match(const pattern_t *pattern, const char *address);
63
64 /**
65 * Destroy pattern
66 * @param pattern pattern to destroy
67 * @return status of operation
68 */
69 status_t pattern_destroy(pattern_t *pattern);
70 } /* namespace osc */
71 } /* namespace lsp */
72
73
74
75 #endif /* LSP_PLUG_IN_PROTOCOL_OSC_PATTERN_H_ */