UniSet  2.6.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 using std::string;
33 
38 struct Debug
39 {
41  enum type
42  {
44  NONE = 0,
46  INFO = (1 << 0), // 1
48  INIT = (1 << 1), // 2
50  WARN = (1 << 2), // 4
52  CRIT = (1 << 3), // 8
54  LEVEL1 = (1 << 4), // 16
56  LEVEL2 = (1 << 5), // 32
58  LEVEL3 = (1 << 6), // 64
60  LEVEL4 = (1 << 7), // 128
62  LEVEL5 = (1 << 8), // 256
64  LEVEL6 = (1 << 9), // 512
66  LEVEL7 = (1 << 10), // 1024
68  LEVEL8 = (1 << 11), // 2048
70  LEVEL9 = (1 << 12), // 4096
72  REPOSITORY = (1 << 13),
74  SYSTEM = (1 << 14),
76  EXCEPTION = (1 << 15)
77 
78  };
80  static type const ANY;
81 
83  // friend inline void operator|=(Debug::type & d1, Debug::type d2);
84 
90  static Debug::type value(std::string const& val);
91 
95  static void showLevel(std::ostream& o, type level) noexcept;
96 
98  static void showTags(std::ostream& o) noexcept;
99 
100  friend std::ostream& operator<<(std::ostream& os, Debug::type level ) noexcept;
101 
102  static std::string str( Debug::type level ) noexcept;
103 };
104 
105 
106 
107 inline
108 void operator|=(Debug::type& d1, Debug::type d2) noexcept
109 {
110  d1 = static_cast<Debug::type>(d1 | d2);
111 }
112 
113 
114 #include "DebugStream.h"
115 
116 std::ostream& operator<<(std::ostream& o, Debug::type t) noexcept;
117 //extern DebugStream ulog;
118 
119 #endif
Definition: Debug.h:38
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