UniSet  2.8.0
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 //#ifdef __GNUG__
17 //#pragma interface
18 //#endif
19 
20 #if __GNUC__ > 2
21 #define MODERN_STL_STREAMS
22 #endif
23 
24 #include <iosfwd>
25 
26 #include <string>
27 //#include <lstrings.h>
28 //#ifndef _
29 // #define _(n) n
30 //#endif
31 
32 
37 struct Debug
38 {
40  enum type
41  {
43  NONE = 0,
45  INFO = (1 << 0), // 1
47  INIT = (1 << 1), // 2
49  WARN = (1 << 2), // 4
51  CRIT = (1 << 3), // 8
53  LEVEL1 = (1 << 4), // 16
55  LEVEL2 = (1 << 5), // 32
57  LEVEL3 = (1 << 6), // 64
59  LEVEL4 = (1 << 7), // 128
61  LEVEL5 = (1 << 8), // 256
63  LEVEL6 = (1 << 9), // 512
65  LEVEL7 = (1 << 10), // 1024
67  LEVEL8 = (1 << 11), // 2048
69  LEVEL9 = (1 << 12), // 4096
71  REPOSITORY = (1 << 13),
73  SYSTEM = (1 << 14),
75  EXCEPTION = (1 << 15)
76 
77  };
79  static type const ANY;
80 
82  // friend inline void operator|=(Debug::type & d1, Debug::type d2);
83 
89  static Debug::type value(std::string const& val);
90 
94  static void showLevel(std::ostream& o, type level) noexcept;
95 
97  static void showTags(std::ostream& o) noexcept;
98 
99  friend std::ostream& operator<<(std::ostream& os, Debug::type level ) noexcept;
100 
101  static std::string str( Debug::type level ) noexcept;
102 };
103 
104 
105 
106 inline
107 void operator|=(Debug::type& d1, Debug::type d2) noexcept
108 {
109  d1 = static_cast<Debug::type>(d1 | d2);
110 }
111 
112 
113 #include "DebugStream.h"
114 
115 std::ostream& operator<<(std::ostream& o, Debug::type t) noexcept;
116 //extern DebugStream ulog;
117 
118 #endif
Definition: Debug.h:37
static Debug::type value(std::string const &val)
Definition: Debug.cc:67
static void showLevel(std::ostream &o, type level) noexcept
Definition: Debug.cc:110
static void showTags(std::ostream &o) noexcept
Definition: Debug.cc:121