/src/libheif/libheif/error.h
Line | Count | Source |
1 | | /* |
2 | | * HEIF codec. |
3 | | * Copyright (c) 2017 Dirk Farin <dirk.farin@gmail.com> |
4 | | * |
5 | | * This file is part of libheif. |
6 | | * |
7 | | * libheif is free software: you can redistribute it and/or modify |
8 | | * it under the terms of the GNU Lesser General Public License as |
9 | | * published by the Free Software Foundation, either version 3 of |
10 | | * the License, or (at your option) any later version. |
11 | | * |
12 | | * libheif is distributed in the hope that it will be useful, |
13 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | | * GNU Lesser General Public License for more details. |
16 | | * |
17 | | * You should have received a copy of the GNU Lesser General Public License |
18 | | * along with libheif. If not, see <http://www.gnu.org/licenses/>. |
19 | | */ |
20 | | |
21 | | #ifndef LIBHEIF_ERROR_H |
22 | | #define LIBHEIF_ERROR_H |
23 | | |
24 | | #include <cinttypes> |
25 | | #include <cstddef> |
26 | | |
27 | | #include <vector> |
28 | | #include <string> |
29 | | #include <memory> |
30 | | #include <limits> |
31 | | #include <istream> |
32 | | #include <ostream> |
33 | | #include <sstream> |
34 | | |
35 | | #include "libheif/heif.h" |
36 | | #include <cassert> |
37 | | #include <variant> |
38 | | #include <utility> |
39 | | |
40 | | |
41 | | extern const heif_error heif_error_null_pointer_argument; |
42 | | |
43 | | |
44 | | class ErrorBuffer |
45 | | { |
46 | | public: |
47 | 42.5k | ErrorBuffer() = default; |
48 | | |
49 | | void set_success() |
50 | 27.0k | { |
51 | 27.0k | m_error_message = c_success; |
52 | 27.0k | } |
53 | | |
54 | | void set_error(const std::string& err) |
55 | 10.8k | { |
56 | 10.8k | m_buffer = err; |
57 | 10.8k | m_error_message = m_buffer.c_str(); |
58 | 10.8k | } |
59 | | |
60 | | const char* get_error() const |
61 | 37.9k | { |
62 | 37.9k | return m_error_message; |
63 | 37.9k | } |
64 | | |
65 | | private: |
66 | | constexpr static const char* c_success = "Success"; |
67 | | std::string m_buffer; |
68 | | const char* m_error_message = c_success; |
69 | | }; |
70 | | |
71 | | |
72 | | class Error |
73 | | { |
74 | | public: |
75 | | heif_error_code error_code = heif_error_Ok; |
76 | | heif_suberror_code sub_error_code = heif_suberror_Unspecified; |
77 | | std::string message; |
78 | | |
79 | | Error(); |
80 | | |
81 | | Error(heif_error_code c, |
82 | | heif_suberror_code sc = heif_suberror_Unspecified, |
83 | | const std::string& msg = ""); |
84 | | |
85 | | static Error from_heif_error(const heif_error&); |
86 | | |
87 | | static const Error Ok; |
88 | | |
89 | | static const Error InternalError; |
90 | | |
91 | | static const char kSuccess[]; |
92 | | |
93 | 403k | bool operator==(const Error& other) const { return error_code == other.error_code; } |
94 | | |
95 | 190k | bool operator!=(const Error& other) const { return !(*this == other); } |
96 | | |
97 | 3.11k | Error operator||(const Error& other) const { |
98 | 3.11k | if (error_code != heif_error_Ok) { |
99 | 0 | return *this; |
100 | 0 | } |
101 | 3.11k | else { |
102 | 3.11k | return other; |
103 | 3.11k | } |
104 | 3.11k | } |
105 | | |
106 | 932k | operator bool() const { return error_code != heif_error_Ok; } |
107 | | |
108 | | static const char* get_error_string(heif_error_code err); |
109 | | |
110 | | static const char* get_error_string(heif_suberror_code err); |
111 | | |
112 | | heif_error error_struct(ErrorBuffer* error_buffer) const; |
113 | | }; |
114 | | |
115 | | |
116 | | inline std::ostream& operator<<(std::ostream& ostr, const Error& err) |
117 | 0 | { |
118 | 0 | ostr << err.error_code << "/" << err.sub_error_code; |
119 | 0 | return ostr; |
120 | 0 | } |
121 | | |
122 | | |
123 | | template <typename T> class Result |
124 | | { |
125 | | public: |
126 | 103k | Result() = default; Result<std::__1::shared_ptr<HeifPixelImage> >::Result() Line | Count | Source | 126 | 103k | Result() = default; |
Unexecuted instantiation: Result<Encoder::CodedImageData>::Result() Unexecuted instantiation: Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::Result() Unexecuted instantiation: Result<bool>::Result() |
127 | | |
128 | 287k | Result(T v) : m_data(std::move(v)) {}Unexecuted instantiation: Result<std::__1::shared_ptr<Box_udes> >::Result(std::__1::shared_ptr<Box_udes>) Result<std::__1::shared_ptr<Box_imir> >::Result(std::__1::shared_ptr<Box_imir>) Line | Count | Source | 128 | 231 | Result(T v) : m_data(std::move(v)) {} |
Result<std::__1::shared_ptr<Box_irot> >::Result(std::__1::shared_ptr<Box_irot>) Line | Count | Source | 128 | 100 | Result(T v) : m_data(std::move(v)) {} |
Result<std::__1::shared_ptr<Box_clap> >::Result(std::__1::shared_ptr<Box_clap>) Line | Count | Source | 128 | 31 | Result(T v) : m_data(std::move(v)) {} |
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_other> >::Result(std::__1::shared_ptr<Box_other>) Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::Result(std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >) Line | Count | Source | 128 | 28.0k | Result(T v) : m_data(std::move(v)) {} |
Result<std::__1::shared_ptr<HeifPixelImage> >::Result(std::__1::shared_ptr<HeifPixelImage>) Line | Count | Source | 128 | 111k | Result(T v) : m_data(std::move(v)) {} |
Unexecuted instantiation: Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::Result(std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > >) Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Grid> >::Result(std::__1::shared_ptr<ImageItem_Grid>) Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Overlay> >::Result(std::__1::shared_ptr<ImageItem_Overlay>) Unexecuted instantiation: Result<std::__1::shared_ptr<HeifPixelImage const> >::Result(std::__1::shared_ptr<HeifPixelImage const>) Unexecuted instantiation: Result<heif_tai_timestamp_packet>::Result(heif_tai_timestamp_packet) Unexecuted instantiation: Result<std::__1::shared_ptr<RegionItem> >::Result(std::__1::shared_ptr<RegionItem>) Result<unsigned int>::Result(unsigned int) Line | Count | Source | 128 | 2.94k | Result(T v) : m_data(std::move(v)) {} |
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::Result(std::__1::shared_ptr<ImageItem>) Unexecuted instantiation: Result<std::__1::shared_ptr<Box_elng> >::Result(std::__1::shared_ptr<Box_elng>) Unexecuted instantiation: Result<std::__1::shared_ptr<Track> >::Result(std::__1::shared_ptr<Track>) Unexecuted instantiation: Result<std::__1::shared_ptr<Track const> >::Result(std::__1::shared_ptr<Track const>) Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Visual> >::Result(std::__1::shared_ptr<Track_Visual>) Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Metadata> >::Result(std::__1::shared_ptr<Track_Metadata>) Unexecuted instantiation: Result<std::__1::shared_ptr<TextItem> >::Result(std::__1::shared_ptr<TextItem>) Unexecuted instantiation: Result<std::__1::shared_ptr<Box_infe> >::Result(std::__1::shared_ptr<Box_infe>) Unexecuted instantiation: Result<unsigned long>::Result(unsigned long) Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Result(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) Result<std::__1::optional<ImageSize> >::Result(std::__1::optional<ImageSize>) Line | Count | Source | 128 | 12.6k | Result(T v) : m_data(std::move(v)) {} |
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*>::Result(std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*) Line | Count | Source | 128 | 12.1k | Result(T v) : m_data(std::move(v)) {} |
Result<std::__1::shared_ptr<Decoder> >::Result(std::__1::shared_ptr<Decoder>) Line | Count | Source | 128 | 119k | Result(T v) : m_data(std::move(v)) {} |
Unexecuted instantiation: Result<std::__1::shared_ptr<SEIMessage> >::Result(std::__1::shared_ptr<SEIMessage>) Unexecuted instantiation: Result<Encoder::CodedImageData>::Result(Encoder::CodedImageData) Unexecuted instantiation: Result<heif_raw_sequence_sample*>::Result(heif_raw_sequence_sample*) Unexecuted instantiation: Result<bool>::Result(bool) |
129 | | |
130 | 40.9k | Result(const Error& e) : m_data(e) {}Unexecuted instantiation: Result<std::__1::shared_ptr<Box_udes> >::Result(Error const&) Unexecuted instantiation: Result<std::__1::shared_ptr<Box_imir> >::Result(Error const&) Unexecuted instantiation: Result<std::__1::shared_ptr<Box_irot> >::Result(Error const&) Unexecuted instantiation: Result<std::__1::shared_ptr<Box_clap> >::Result(Error const&) Unexecuted instantiation: Result<std::__1::shared_ptr<Box_other> >::Result(Error const&) Result<std::__1::shared_ptr<Decoder> >::Result(Error const&) Line | Count | Source | 130 | 4.05k | Result(const Error& e) : m_data(e) {} |
Result<std::__1::shared_ptr<HeifPixelImage> >::Result(Error const&) Line | Count | Source | 130 | 32.4k | Result(const Error& e) : m_data(e) {} |
Unexecuted instantiation: Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::Result(Error const&) Unexecuted instantiation: Result<Encoder::CodedImageData>::Result(Error const&) Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Grid> >::Result(Error const&) Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Overlay> >::Result(Error const&) Unexecuted instantiation: Result<std::__1::shared_ptr<HeifPixelImage const> >::Result(Error const&) Unexecuted instantiation: Result<heif_tai_timestamp_packet>::Result(Error const&) Unexecuted instantiation: Result<std::__1::shared_ptr<RegionItem> >::Result(Error const&) Result<unsigned int>::Result(Error const&) Line | Count | Source | 130 | 352 | Result(const Error& e) : m_data(e) {} |
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::Result(Error const&) Unexecuted instantiation: Result<std::__1::shared_ptr<Box_elng> >::Result(Error const&) Result<std::__1::shared_ptr<Track> >::Result(Error const&) Line | Count | Source | 130 | 5 | Result(const Error& e) : m_data(e) {} |
Unexecuted instantiation: Result<std::__1::shared_ptr<Track const> >::Result(Error const&) Unexecuted instantiation: Result<std::__1::shared_ptr<TextItem> >::Result(Error const&) Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::Result(Error const&) Line | Count | Source | 130 | 3.29k | Result(const Error& e) : m_data(e) {} |
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_infe> >::Result(Error const&) Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Result(Error const&) Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*>::Result(Error const&) Line | Count | Source | 130 | 594 | Result(const Error& e) : m_data(e) {} |
Unexecuted instantiation: Result<std::__1::shared_ptr<SEIMessage> >::Result(Error const&) Result<std::__1::optional<ImageSize> >::Result(Error const&) Line | Count | Source | 130 | 176 | Result(const Error& e) : m_data(e) {} |
Unexecuted instantiation: Result<heif_raw_sequence_sample*>::Result(Error const&) Unexecuted instantiation: Result<bool>::Result(Error const&) |
131 | | |
132 | 685k | operator bool() const { return std::holds_alternative<T>(m_data); }Result<std::__1::shared_ptr<HeifPixelImage> >::operator bool() const Line | Count | Source | 132 | 294k | operator bool() const { return std::holds_alternative<T>(m_data); } |
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_udes> >::operator bool() const Result<std::__1::shared_ptr<Box_imir> >::operator bool() const Line | Count | Source | 132 | 462 | operator bool() const { return std::holds_alternative<T>(m_data); } |
Result<std::__1::shared_ptr<Box_irot> >::operator bool() const Line | Count | Source | 132 | 200 | operator bool() const { return std::holds_alternative<T>(m_data); } |
Result<std::__1::shared_ptr<Box_clap> >::operator bool() const Line | Count | Source | 132 | 155 | operator bool() const { return std::holds_alternative<T>(m_data); } |
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_other> >::operator bool() const Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::operator bool() const Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Overlay> >::operator bool() const Unexecuted instantiation: Result<Encoder::CodedImageData>::operator bool() const Unexecuted instantiation: Result<std::__1::shared_ptr<Box_infe> >::operator bool() const Result<std::__1::shared_ptr<Decoder> >::operator bool() const Line | Count | Source | 132 | 243k | operator bool() const { return std::holds_alternative<T>(m_data); } |
Unexecuted instantiation: Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::operator bool() const Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::operator bool() const Line | Count | Source | 132 | 84.2k | operator bool() const { return std::holds_alternative<T>(m_data); } |
Result<unsigned int>::operator bool() const Line | Count | Source | 132 | 3.15k | operator bool() const { return std::holds_alternative<T>(m_data); } |
Unexecuted instantiation: Result<std::__1::shared_ptr<HeifPixelImage const> >::operator bool() const Unexecuted instantiation: Result<std::__1::shared_ptr<Box_elng> >::operator bool() const Result<std::__1::shared_ptr<Track> >::operator bool() const Line | Count | Source | 132 | 10 | operator bool() const { return std::holds_alternative<T>(m_data); } |
Unexecuted instantiation: Result<unsigned long>::operator bool() const Unexecuted instantiation: Result<std::__1::shared_ptr<Track const> >::operator bool() const Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*>::operator bool() const Line | Count | Source | 132 | 37.6k | operator bool() const { return std::holds_alternative<T>(m_data); } |
Result<std::__1::optional<ImageSize> >::operator bool() const Line | Count | Source | 132 | 21.4k | operator bool() const { return std::holds_alternative<T>(m_data); } |
Unexecuted instantiation: Result<std::__1::shared_ptr<SEIMessage> >::operator bool() const Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::operator bool() const Unexecuted instantiation: Result<heif_tai_timestamp_packet>::operator bool() const Unexecuted instantiation: Result<bool>::operator bool() const Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Visual> >::operator bool() const Unexecuted instantiation: Result<heif_raw_sequence_sample*>::operator bool() const Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Metadata> >::operator bool() const |
133 | | |
134 | | //void set(const T& v) { m_data = v; } |
135 | | |
136 | | // Pointer-like access for `r->member` |
137 | | T* operator->() |
138 | 48.8k | { |
139 | 48.8k | assert(*this); // Uses the operator bool() above |
140 | 48.8k | return &std::get<T>(m_data); |
141 | 48.8k | } Unexecuted instantiation: Result<Encoder::CodedImageData>::operator->() Unexecuted instantiation: Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::operator->() Result<std::__1::optional<ImageSize> >::operator->() Line | Count | Source | 138 | 12.6k | { | 139 | 12.6k | assert(*this); // Uses the operator bool() above | 140 | 12.6k | return &std::get<T>(m_data); | 141 | 12.6k | } |
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::operator->() Line | Count | Source | 138 | 36.1k | { | 139 | 36.1k | assert(*this); // Uses the operator bool() above | 140 | 36.1k | return &std::get<T>(m_data); | 141 | 36.1k | } |
|
142 | | |
143 | | // Dereference access for `*r` |
144 | | T& operator*() |
145 | 286k | { |
146 | 286k | assert(*this); |
147 | 286k | return std::get<T>(m_data); |
148 | 286k | } Result<std::__1::shared_ptr<HeifPixelImage> >::operator*() Line | Count | Source | 145 | 114k | { | 146 | 114k | assert(*this); | 147 | 114k | return std::get<T>(m_data); | 148 | 114k | } |
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_udes> >::operator*() Result<std::__1::shared_ptr<Box_imir> >::operator*() Line | Count | Source | 145 | 231 | { | 146 | 231 | assert(*this); | 147 | 231 | return std::get<T>(m_data); | 148 | 231 | } |
Result<std::__1::shared_ptr<Box_irot> >::operator*() Line | Count | Source | 145 | 100 | { | 146 | 100 | assert(*this); | 147 | 100 | return std::get<T>(m_data); | 148 | 100 | } |
Result<std::__1::shared_ptr<Box_clap> >::operator*() Line | Count | Source | 145 | 124 | { | 146 | 124 | assert(*this); | 147 | 124 | return std::get<T>(m_data); | 148 | 124 | } |
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_other> >::operator*() Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::operator*() Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Overlay> >::operator*() Unexecuted instantiation: Result<Encoder::CodedImageData>::operator*() Unexecuted instantiation: Result<std::__1::shared_ptr<Box_infe> >::operator*() Result<std::__1::shared_ptr<Decoder> >::operator*() Line | Count | Source | 145 | 119k | { | 146 | 119k | assert(*this); | 147 | 119k | return std::get<T>(m_data); | 148 | 119k | } |
Unexecuted instantiation: Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::operator*() Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::operator*() Line | Count | Source | 145 | 16.0k | { | 146 | 16.0k | assert(*this); | 147 | 16.0k | return std::get<T>(m_data); | 148 | 16.0k | } |
Result<unsigned int>::operator*() Line | Count | Source | 145 | 2.94k | { | 146 | 2.94k | assert(*this); | 147 | 2.94k | return std::get<T>(m_data); | 148 | 2.94k | } |
Unexecuted instantiation: Result<std::__1::shared_ptr<HeifPixelImage const> >::operator*() Unexecuted instantiation: Result<std::__1::shared_ptr<Track> >::operator*() Unexecuted instantiation: Result<unsigned long>::operator*() Unexecuted instantiation: Result<std::__1::shared_ptr<Track const> >::operator*() Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*>::operator*() Line | Count | Source | 145 | 24.3k | { | 146 | 24.3k | assert(*this); | 147 | 24.3k | return std::get<T>(m_data); | 148 | 24.3k | } |
Result<std::__1::optional<ImageSize> >::operator*() Line | Count | Source | 145 | 8.65k | { | 146 | 8.65k | assert(*this); | 147 | 8.65k | return std::get<T>(m_data); | 148 | 8.65k | } |
Unexecuted instantiation: Result<std::__1::shared_ptr<SEIMessage> >::operator*() Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::operator*() Unexecuted instantiation: Result<heif_tai_timestamp_packet>::operator*() Unexecuted instantiation: Result<bool>::operator*() Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Visual> >::operator*() Unexecuted instantiation: Result<heif_raw_sequence_sample*>::operator*() Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Metadata> >::operator*() |
149 | | |
150 | 16.1k | [[nodiscard]] bool is_error() const { |
151 | 16.1k | return std::holds_alternative<Error>(m_data); |
152 | 16.1k | } Result<unsigned int>::is_error() const Line | Count | Source | 150 | 3.29k | [[nodiscard]] bool is_error() const { | 151 | 3.29k | return std::holds_alternative<Error>(m_data); | 152 | 3.29k | } |
Result<std::__1::optional<ImageSize> >::is_error() const Line | Count | Source | 150 | 12.8k | [[nodiscard]] bool is_error() const { | 151 | 12.8k | return std::holds_alternative<Error>(m_data); | 152 | 12.8k | } |
Unexecuted instantiation: Result<bool>::is_error() const |
153 | | |
154 | | // Accessor for the error, if it exists |
155 | | [[nodiscard]] const Error& error() const |
156 | 127k | { |
157 | 127k | if (*this) { |
158 | 102k | return Error::Ok; |
159 | 102k | } |
160 | | |
161 | 25.5k | return std::get<Error>(m_data); |
162 | 127k | } Unexecuted instantiation: Result<Encoder::CodedImageData>::error() const Unexecuted instantiation: Result<std::__1::shared_ptr<Box_infe> >::error() const Result<std::__1::shared_ptr<Decoder> >::error() const Line | Count | Source | 156 | 60 | { | 157 | 60 | if (*this) { | 158 | 0 | return Error::Ok; | 159 | 0 | } | 160 | | | 161 | 60 | return std::get<Error>(m_data); | 162 | 60 | } |
Unexecuted instantiation: Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::error() const Result<std::__1::shared_ptr<HeifPixelImage> >::error() const Line | Count | Source | 156 | 125k | { | 157 | 125k | if (*this) { | 158 | 102k | return Error::Ok; | 159 | 102k | } | 160 | | | 161 | 23.7k | return std::get<Error>(m_data); | 162 | 125k | } |
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::error() const Line | Count | Source | 156 | 707 | { | 157 | 707 | if (*this) { | 158 | 0 | return Error::Ok; | 159 | 0 | } | 160 | | | 161 | 707 | return std::get<Error>(m_data); | 162 | 707 | } |
Result<unsigned int>::error() const Line | Count | Source | 156 | 211 | { | 157 | 211 | if (*this) { | 158 | 0 | return Error::Ok; | 159 | 0 | } | 160 | | | 161 | 211 | return std::get<Error>(m_data); | 162 | 211 | } |
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::error() const Unexecuted instantiation: Result<std::__1::shared_ptr<HeifPixelImage const> >::error() const Result<std::__1::shared_ptr<Track> >::error() const Line | Count | Source | 156 | 10 | { | 157 | 10 | if (*this) { | 158 | 0 | return Error::Ok; | 159 | 0 | } | 160 | | | 161 | 10 | return std::get<Error>(m_data); | 162 | 10 | } |
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*>::error() const Line | Count | Source | 156 | 594 | { | 157 | 594 | if (*this) { | 158 | 0 | return Error::Ok; | 159 | 0 | } | 160 | | | 161 | 594 | return std::get<Error>(m_data); | 162 | 594 | } |
Result<std::__1::optional<ImageSize> >::error() const Line | Count | Source | 156 | 176 | { | 157 | 176 | if (*this) { | 158 | 0 | return Error::Ok; | 159 | 0 | } | 160 | | | 161 | 176 | return std::get<Error>(m_data); | 162 | 176 | } |
Unexecuted instantiation: Result<std::__1::shared_ptr<SEIMessage> >::error() const Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::error() const Unexecuted instantiation: Result<heif_tai_timestamp_packet>::error() const Unexecuted instantiation: Result<bool>::error() const Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Visual> >::error() const |
163 | | |
164 | | // Directly get the C error struct. |
165 | | heif_error error_struct(ErrorBuffer* error_buffer) const |
166 | 9.74k | { |
167 | 9.74k | if (*this) { |
168 | 0 | return heif_error_success; |
169 | 0 | } |
170 | | |
171 | 9.74k | return std::get<Error>(m_data).error_struct(error_buffer); |
172 | 9.74k | } Result<std::__1::shared_ptr<HeifPixelImage> >::error_struct(ErrorBuffer*) const Line | Count | Source | 166 | 9.74k | { | 167 | 9.74k | if (*this) { | 168 | 0 | return heif_error_success; | 169 | 0 | } | 170 | | | 171 | 9.74k | return std::get<Error>(m_data).error_struct(error_buffer); | 172 | 9.74k | } |
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_udes> >::error_struct(ErrorBuffer*) const Unexecuted instantiation: Result<std::__1::shared_ptr<Box_other> >::error_struct(ErrorBuffer*) const Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::error_struct(ErrorBuffer*) const Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Overlay> >::error_struct(ErrorBuffer*) const Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::error_struct(ErrorBuffer*) const Unexecuted instantiation: Result<heif_raw_sequence_sample*>::error_struct(ErrorBuffer*) const Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Visual> >::error_struct(ErrorBuffer*) const Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Metadata> >::error_struct(ErrorBuffer*) const |
173 | | |
174 | | std::variant<T, Error> m_data; |
175 | | }; |
176 | | |
177 | | #endif |