UniSet 2.32.1
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#include <cstdint>
23
24
25
30struct Debug
31{
33 enum type
34 {
36 NONE = 0,
38 INFO = (1 << 0), // 1
40 INIT = (1 << 1), // 2
42 WARN = (1 << 2), // 4
44 CRIT = (1 << 3), // 8
46 LEVEL1 = (1 << 4), // 16
48 LEVEL2 = (1 << 5), // 32
50 LEVEL3 = (1 << 6), // 64
52 LEVEL4 = (1 << 7), // 128
54 LEVEL5 = (1 << 8), // 256
56 LEVEL6 = (1 << 9), // 512
58 LEVEL7 = (1 << 10), // 1024
60 LEVEL8 = (1 << 11), // 2048
62 LEVEL9 = (1 << 12), // 4096
64 REPOSITORY = (1 << 13),
66 SYSTEM = (1 << 14),
68 EXCEPTION = (1 << 15)
69
70 };
72 static type const ANY;
73
74 typedef std::uint8_t verbosity;
75
77 // friend inline void operator|=(Debug::type & d1, Debug::type d2);
78
84 static Debug::type value(std::string const& val);
85
89 static void showLevel(std::ostream& o, type level) noexcept;
90
92 static void showTags(std::ostream& o) noexcept;
93
94 friend std::ostream& operator<<(std::ostream& os, Debug::type level ) noexcept;
95
96 static std::string str( Debug::type level ) noexcept;
97};
98
99
100
101inline
102void operator|=(Debug::type& d1, Debug::type d2) noexcept
103{
104 d1 = static_cast<Debug::type>(d1 | d2);
105}
106
107std::ostream& operator<<(std::ostream& o, Debug::type t) noexcept;
108
109#include "DebugStream.h"
110#endif
Definition Debug.h:31
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