Debian Codegraph @

modules/lsp-runtime-lib/include/lsp-plug.in/fmt/xpm/Extension.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: 22 янв. 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_EXTENSION_H_
23 #define LSP_PLUG_IN_FMT_XPM_EXTENSION_H_
24
25 #include <lsp-plug.in/runtime/version.h>
26
27 #include <lsp-plug.in/lltl/parray.h>
28 #include <lsp-plug.in/fmt/xpm/ColorItem.h>
29
30 namespace lsp
31 {
32 namespace xpm
33 {
34 /**
35 * XPM3 extension
36 */
37 class LSP_RUNTIME_LIB_PUBLIC Extension
38 {
39 private:
40 char *sName;
41 lltl::parray<char> vData;
42
43 private:
44 static bool copy(lltl::parray<char> & dst, const lltl::parray<char> & src);
45 static void destroy(lltl::parray<char> & src);
46
47 public:
48 Extension() noexcept;
49 explicit Extension(const char * name);
50 Extension(const char * name, size_t len);
51 Extension(const Extension & src);
52 Extension(Extension && src) noexcept;
53 ~Extension();
54
55 Extension & operator = (const Extension & src);
56 Extension & operator = (Extension && src) noexcept;
57
58 public:
59 inline const char *name() const noexcept { return sName; }
60 bool set_name(const char *name);
61 bool set_name(const char *name, size_t len);
62 void clear_name();
63 bool has_name(const char *name) const noexcept;
64
65 inline size_t rows() const noexcept { return vData.size(); }
66 inline const char *row(size_t i) const noexcept { return vData.get(i); }
67 bool add_row(const char *row);
68 bool add_row(const char *row, size_t len);
69 inline void clear_rows() { destroy(vData); }
70
71 bool set(const Extension & src);
72
73 public:
74 void swap(Extension & src) noexcept;
75 void swap(Extension * src) noexcept;
76 };
77
78 } /* namespace xpm */
79 } /* namespace lsp */
80
81
82
83 #endif /* LSP_PLUG_IN_FMT_XPM_EXTENSION_H_ */