/src/libheif/libheif/text.h
Line | Count | Source |
1 | | /* |
2 | | * HEIF codec. |
3 | | * Copyright (c) 2023 Dirk Farin <dirk.farin@gmail.com> |
4 | | * Copyright (c) 2025 Brad Hards <bradh@frogmouth.net> |
5 | | * |
6 | | * This file is part of libheif. |
7 | | * |
8 | | * libheif is free software: you can redistribute it and/or modify |
9 | | * it under the terms of the GNU Lesser General Public License as |
10 | | * published by the Free Software Foundation, either version 3 of |
11 | | * the License, or (at your option) any later version. |
12 | | * |
13 | | * libheif 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 libheif. If not, see <http://www.gnu.org/licenses/>. |
20 | | */ |
21 | | |
22 | | #ifndef LIBHEIF_TEXT_H |
23 | | #define LIBHEIF_TEXT_H |
24 | | |
25 | | #include <cstring> |
26 | | #include <string> |
27 | | #include <vector> |
28 | | #include "error.h" |
29 | | #include "libheif/heif_text.h" |
30 | | |
31 | | class TextItem |
32 | | { |
33 | | public: |
34 | 78 | TextItem() = default; |
35 | | |
36 | 0 | TextItem(heif_item_id itemId, const char *text) : m_item_id(itemId), m_text(text) {} |
37 | | |
38 | | Error parse(const std::vector<uint8_t> &data); |
39 | | |
40 | | Result<std::vector<uint8_t>> encode() const; |
41 | | |
42 | 0 | heif_item_id get_item_id() const { |
43 | 0 | return m_item_id; |
44 | 0 | } |
45 | | |
46 | 78 | void set_item_id(heif_item_id id) { |
47 | 78 | m_item_id = id; |
48 | 78 | } |
49 | | |
50 | 0 | std::string get_item_text() const { return m_text; } |
51 | | |
52 | | private: |
53 | | heif_item_id m_item_id = 0; |
54 | | std::string m_text; |
55 | | }; |
56 | | |
57 | | #endif // LIBHEIF_TEXT_H |