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