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