]> git.lyx.org Git - lyx.git/blob - src/debug.h
Dekel's patch -- I didn't fix the xforms-0.88 keysyms stuff so it still doesn't finis...
[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-2000 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 #include "support/lstrings.h"
23
24 /** Ideally this should have been a namespace, but since we try to be
25     compilable on older C++ compilators too, we use a struct instead.
26     This is all the different debug levels that we have.
27 */
28 struct Debug {
29         ///
30         enum type {
31                 ///
32                 NONE = 0,
33                 ///
34                 INFO       = (1 << 0),   // 1
35                 ///
36                 INIT       = (1 << 1),   // 2
37                 ///
38                 KEY        = (1 << 2),   // 4
39                 ///
40                 GUI        = (1 << 3),   // 8
41                 ///
42                 PARSER     = (1 << 4),   // 16
43                 ///
44                 LYXRC      = (1 << 5),   // 32
45                 ///
46                 KBMAP      = (1 << 6),   // 64
47                 ///
48                 LATEX      = (1 << 7),   // 128
49                 ///
50                 MATHED     = (1 << 8),   // 256 // Alejandro, please use this.
51                 ///
52                 FONT       = (1 << 9),   // 512
53                 ///
54                 TCLASS     = (1 << 10),  // 1024
55                 ///
56                 LYXVC      = (1 << 11),  // 2048
57                 ///
58                 LYXSERVER  = (1 << 12),  // 4096
59                 ///
60                 ROFF       = (1 << 13),  // 8192
61                 ///
62                 ACTION     = (1 << 14),   // 16384
63                 ///
64                 LYXLEX     = (1 << 15),
65                 ///
66                 DEPEND     = (1 << 16),
67                 ///
68                 INSETS     = (1 << 17)
69         };
70         ///
71         static const type ANY = type(INFO | INIT | KEY | GUI |
72                                      PARSER | LYXRC | KBMAP | LATEX |
73                                      MATHED | FONT | TCLASS | LYXVC |
74                                      LYXSERVER | ROFF | ACTION | LYXLEX |
75                                      DEPEND | INSETS);
76         ///
77         friend inline void operator|=(Debug::type & d1, Debug::type d2);
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