digiKam
logging.h
Go to the documentation of this file.
1 /*
2  * HEIF codec.
3  * Copyright (c) 2017 struktur AG, Dirk Farin <farin@struktur.de>
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 #if defined(HAVE_CONFIG_H)
25 #include "config.h"
26 #endif
27 
28 #include <cinttypes>
29 #include <cstddef>
30 
31 #include <vector>
32 #include <string>
33 #include <memory>
34 #include <limits>
35 #include <istream>
36 
37 
38 namespace heif {
39 
40  class Indent {
41  public:
42  Indent() : m_indent(0) { }
43 
44  int get_indent() const { return m_indent; }
45 
46  void operator++(int) { m_indent++; }
47  void operator--(int) { m_indent--; if (m_indent<0) m_indent=0; }
48 
49  private:
50  int m_indent;
51  };
52 
53 
54  inline std::ostream& operator<<(std::ostream& ostr, const Indent& indent) {
55  for (int i=0;i<indent.get_indent();i++) {
56  ostr << "| ";
57  }
58 
59  return ostr;
60  }
61 }
62 
63 #endif
Definition: logging.h:40
void operator++(int)
Definition: logging.h:46
int get_indent() const
Definition: logging.h:44
Indent()
Definition: logging.h:42
void operator--(int)
Definition: logging.h:47
Definition: bitstream.h:41
std::ostream & operator<<(std::ostream &ostr, const Error &err)
Definition: error.h:103