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