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