Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/fmt/xpm/Parser.h

raw
1 /*
2 * Copyright (C) 2026 Linux Studio Plugins Project <https://lsp-plug.in/>
3 * (C) 2026 Vladimir Sadovnikov <[email protected]>
4 *
5 * This file is part of lsp-runtime-lib
6 * Created on: 20 янв. 2026 г.
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_XPM_PARSER_H_
23 #define LSP_PLUG_IN_FMT_XPM_PARSER_H_
24
25 #include <lsp-plug.in/runtime/version.h>
26
27 #include <lsp-plug.in/io/IInStream.h>
28 #include <lsp-plug.in/io/Path.h>
29 #include <lsp-plug.in/fmt/xpm/Color.h>
30 #include <lsp-plug.in/fmt/xpm/Extension.h>
31 #include <lsp-plug.in/fmt/xpm/Header.h>
32 #include <lsp-plug.in/runtime/LSPString.h>
33
34 namespace lsp
35 {
36 namespace xpm
37 {
38 /**
39 * XPM parser interface
40 */
41 class LSP_RUNTIME_LIB_PUBLIC Parser
42 {
43 public:
44 Parser();
45 Parser(const Parser &) = delete;
46 Parser(Parser &&) = delete;
47 virtual ~Parser();
48
49 Parser & operator = (const Parser &) = delete;
50 Parser & operator = (Parser &&) = delete;
51
52 public:
53 /**
54 * Read XPM header
55 * @param dst destination buffer to store header
56 * @return status of operation
57 */
58 virtual status_t read_header(header_t *dst);
59
60 /**
61 * Read XPM color
62 * @param dst pointer to store color, may be NULL
63 * @return status of operation
64 */
65 virtual status_t read_color(Color *dst);
66
67 /**
68 * Read the image line to buffer
69 * @param dst destination buffer to store image line, should be of enough
70 * size to store character data. @note Parser does not store NULL-terminating
71 * character for the buffer!
72 * @return status of operation
73 */
74 virtual status_t read_line(char *dst);
75
76 /**
77 * Read the image line to buffer
78 * @param dst pointer to store the extension data
79 * @return status of operation
80 */
81 virtual status_t read_ext(Extension *dst);
82
83 /**
84 * Close parser
85 * @return status of operation
86 */
87 virtual status_t close();
88 };
89 } /* namespace xpm */
90 } /* namespace lsp */
91
92
93 #endif /* LSP_PLUG_IN_FMT_XPM_PARSER_H_ */