/src/libheif/libheif/logging.h
Line | Count | Source (jump to first uncovered line) |
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_LOGGING_H |
22 | | #define LIBHEIF_LOGGING_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 | | |
33 | | |
34 | | class Indent |
35 | | { |
36 | | public: |
37 | 0 | Indent() = default; |
38 | | |
39 | 0 | int get_indent() const { return m_indent; } |
40 | | |
41 | 0 | void operator++(int) { m_indent++; } |
42 | | |
43 | | void operator--(int) |
44 | 0 | { |
45 | 0 | m_indent--; |
46 | 0 | if (m_indent < 0) m_indent = 0; |
47 | 0 | } |
48 | | |
49 | | std::string get_string() const; |
50 | | |
51 | | private: |
52 | | int m_indent = 0; |
53 | | }; |
54 | | |
55 | | |
56 | | inline std::ostream& operator<<(std::ostream& ostr, const Indent& indent) |
57 | 0 | { |
58 | 0 | ostr << indent.get_string(); |
59 | 0 | return ostr; |
60 | 0 | } |
61 | | |
62 | | std::string write_raw_data_as_hex(const uint8_t* data, size_t len, |
63 | | const std::string& firstLineIndent, |
64 | | const std::string& remainingLinesIndent); |
65 | | |
66 | | #endif |