]> git.lyx.org Git - lyx.git/blob - src/debug.h
Fix the WorkArea problems.
[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         ///
72 //      static const type ANY = type(INFO | INIT | KEY | GUI |
73 //                                   PARSER | LYXRC | KBMAP | LATEX |
74 //                                   MATHED | FONT | TCLASS | LYXVC |
75 //                                   LYXSERVER | ROFF | ACTION | LYXLEX |
76 //                                   DEPEND | INSETS);
77         ///
78         static type const ANY;
79
80         /** A function to convert symbolic string names on debug levels
81             to their numerical value.
82         */
83         static Debug::type value(string const & val); 
84
85         /** Display the tags and descriptions of the current debug level 
86             of ds 
87         */
88         static void showLevel(std::ostream & o, type level);
89
90         /** show all the possible tags that can be used for debugging */
91         static void showTags(std::ostream & o);
92
93 };
94
95
96
97 inline
98 void operator|=(Debug::type & d1, Debug::type d2)
99 {
100         d1 = static_cast<Debug::type>(d1 | d2);
101 }
102
103
104 #include "support/DebugStream.h"
105
106
107
108 std::ostream & operator<<(std::ostream & o, Debug::type t);
109
110 extern DebugStream lyxerr;
111
112 #endif