]> git.lyx.org Git - lyx.git/blob - src/debug.h
8762fbd66fe5c0ec08a5524f02d60ac84a694269
[lyx.git] / src / 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-2001 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef LYXDEBUG_H
13 #define LYXDEBUG_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include <iosfwd>
20
21 #include "LString.h"
22
23 /** Ideally this should have been a namespace, but since we try to be
24     compilable on older C++ compilators too, we use a struct instead.
25     This is all the different debug levels that we have.
26 */
27 struct Debug {
28         ///
29         enum type {
30                 ///
31                 NONE = 0,
32                 ///
33                 INFO       = (1 << 0),   // 1
34                 ///
35                 INIT       = (1 << 1),   // 2
36                 ///
37                 KEY        = (1 << 2),   // 4
38                 ///
39                 GUI        = (1 << 3),   // 8
40                 ///
41                 PARSER     = (1 << 4),   // 16
42                 ///
43                 LYXRC      = (1 << 5),   // 32
44                 ///
45                 KBMAP      = (1 << 6),   // 64
46                 ///
47                 LATEX      = (1 << 7),   // 128
48                 ///
49                 MATHED     = (1 << 8),   // 256 // Alejandro, please use this.
50                 ///
51                 FONT       = (1 << 9),   // 512
52                 ///
53                 TCLASS     = (1 << 10),  // 1024
54                 ///
55                 LYXVC      = (1 << 11),  // 2048
56                 ///
57                 LYXSERVER  = (1 << 12),  // 4096
58                 ///
59                 ROFF       = (1 << 13),  // 8192
60                 ///
61                 ACTION     = (1 << 14),   // 16384
62                 ///
63                 LYXLEX     = (1 << 15),
64                 ///
65                 DEPEND     = (1 << 16),
66                 ///
67                 INSETS     = (1 << 17),
68                 ///
69                 FILES      = (1 << 18),
70                 ///
71                 WORKAREA   = (1 << 19),
72                 ///
73                 INSETTEXT  = (1 << 20),
74                 ///
75                 GRAPHICS   = (1 << 21),
76                 /// change tracking
77                 CHANGES    = (1 << 22)
78         };
79         ///
80         static type const ANY;
81
82         /** A function to convert symbolic string names on debug levels
83             to their numerical value.
84         */
85         static Debug::type value(string const & val);
86
87         /** Display the tags and descriptions of the current debug level
88             of ds
89         */
90         static void showLevel(std::ostream & o, type level);
91
92         /** show all the possible tags that can be used for debugging */
93         static void showTags(std::ostream & o);
94
95 };
96
97
98
99 inline
100 void operator|=(Debug::type & d1, Debug::type d2)
101 {
102         d1 = static_cast<Debug::type>(d1 | d2);
103 }
104
105
106 #include "support/DebugStream.h"
107
108
109
110 std::ostream & operator<<(std::ostream & o, Debug::type t);
111
112 extern DebugStream lyxerr;
113
114 #endif