UniSet  2.24.2
Debug.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  * LyX, The Document Processor
6  *
7  * Copyright 1995 Matthias Ettrich
8  * Copyright 1995-2000 The LyX Team.
9  *
10  * ====================================================== */
11 // (c) 2002 adapted for UniSet by Lav, GNU LGPL license
12 
13 #ifndef LYXDEBUG_H
14 #define LYXDEBUG_H
15 
16 #if __GNUC__ > 2
17 #define MODERN_STL_STREAMS
18 #endif
19 
20 #include <iosfwd>
21 #include <string>
22 
23 
24 
29 struct Debug
30 {
32  enum type
33  {
35  NONE = 0,
37  INFO = (1 << 0), // 1
39  INIT = (1 << 1), // 2
41  WARN = (1 << 2), // 4
43  CRIT = (1 << 3), // 8
45  LEVEL1 = (1 << 4), // 16
47  LEVEL2 = (1 << 5), // 32
49  LEVEL3 = (1 << 6), // 64
51  LEVEL4 = (1 << 7), // 128
53  LEVEL5 = (1 << 8), // 256
55  LEVEL6 = (1 << 9), // 512
57  LEVEL7 = (1 << 10), // 1024
59  LEVEL8 = (1 << 11), // 2048
61  LEVEL9 = (1 << 12), // 4096
63  REPOSITORY = (1 << 13),
65  SYSTEM = (1 << 14),
67  EXCEPTION = (1 << 15)
68 
69  };
71  static type const ANY;
72 
73  typedef uint8_t verbosity;
74 
76  // friend inline void operator|=(Debug::type & d1, Debug::type d2);
77 
83  static Debug::type value(std::string const& val);
84 
88  static void showLevel(std::ostream& o, type level) noexcept;
89 
91  static void showTags(std::ostream& o) noexcept;
92 
93  friend std::ostream& operator<<(std::ostream& os, Debug::type level ) noexcept;
94 
95  static std::string str( Debug::type level ) noexcept;
96 };
97 
98 
99 
100 inline
101 void operator|=(Debug::type& d1, Debug::type d2) noexcept
102 {
103  d1 = static_cast<Debug::type>(d1 | d2);
104 }
105 
106 std::ostream& operator<<(std::ostream& o, Debug::type t) noexcept;
107 
108 #include "DebugStream.h"
109 #endif
Definition: Debug.h:30
static void showLevel(std::ostream &o, type level) noexcept
Definition: Debug.cc:104
static void showTags(std::ostream &o) noexcept
Definition: Debug.cc:115
static Debug::type value(std::string const &val)
Definition: Debug.cc:62