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