Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/fmt/obj/PushParser.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: 22 апр. 2020 г.
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_FMT_OBJ_PUSHPARSER_H_
23 #define LSP_PLUG_IN_FMT_OBJ_PUSHPARSER_H_
24
25 #include <lsp-plug.in/runtime/version.h>
26 #include <lsp-plug.in/fmt/obj/PullParser.h>
27 #include <lsp-plug.in/fmt/obj/IObjHandler.h>
28
29 namespace lsp
30 {
31 namespace obj
32 {
33
34 class PushParser
35 {
36 protected:
37 PullParser sParser;
38
39 protected:
40 status_t parse_document(IObjHandler *handler);
41
42 public:
43 explicit PushParser();
44 PushParser(const PushParser &) = delete;
45 PushParser(PushParser &&) = delete;
46 virtual ~PushParser();
47
48 PushParser & operator = (const PushParser &) = delete;
49 PushParser & operator = (PushParser &&) = delete;
50
51 public:
52 /**
53 * Parse file
54 * @param handler Wavefront Object file handler
55 * @param path UTF-8 path to the file
56 * @param charset character set encoding of the file
57 * @return status of operation
58 */
59 status_t parse_file(IObjHandler *handler, const char *path, const char *charset = NULL);
60
61 /**
62 * Parse file
63 * @param handler Wavefront Object file handler
64 * @param path path to the file
65 * @param charset character set encoding of the file
66 * @return status of operation
67 */
68 status_t parse_file(IObjHandler *handler, const LSPString *path, const char *charset = NULL);
69
70 /**
71 * Parse file
72 * @param handler Wavefront Object file handler
73 * @param path path to the file
74 * @param charset character set encoding of the file
75 * @return status of operation
76 */
77 status_t parse_file(IObjHandler *handler, const io::Path *path, const char *charset = NULL);
78
79 /**
80 * Parse data from input stream
81 * @param handler Wavefront Object file handler
82 * @param is input stream
83 * @param flags wrap flags
84 * @param charset character set
85 * @return status of operation
86 */
87 status_t parse_data(IObjHandler *handler, io::IInStream *is, size_t flags = WRAP_NONE, const char *charset = NULL);
88
89 /**
90 * Parse data from native encoded string
91 * @param handler Wavefront Object file handler
92 * @param str data input
93 * @param charset character set
94 * @return status of operation
95 */
96 status_t parse_data(IObjHandler *handler, const char *str, const char *charset = NULL);
97
98 /**
99 * Parse data from text string
100 * @param handler Wavefront Object file handler
101 * @param str data input
102 * @return status of operation
103 */
104 status_t parse_data(IObjHandler *handler, const LSPString *str);
105
106 /**
107 * Parse data from character sequence
108 * @param handler Wavefront Object file handler
109 * @param seq input sequence
110 * @param flags wrap flags
111 * @return status of operation
112 */
113 status_t parse_data(IObjHandler *handler, io::IInSequence *seq, size_t flags = WRAP_NONE);
114 };
115
116 } /* namespace obj */
117 } /* namespace lsp */
118
119 #endif /* LSP_PLUG_IN_FMT_OBJ_PUSHPARSER_H_ */