UniSet  1.4.0
Debug.h
00001 // -*- C++ -*-
00002 /* This file is part of
00003  * ====================================================== 
00004  * 
00005  *           LyX, The Document Processor
00006  *        
00007  *           Copyright 1995 Matthias Ettrich
00008  *           Copyright 1995-2000 The LyX Team.
00009  *
00010  * ====================================================== */
00011 // (c) 2002 adapted for UniSet by Lav, GNU GPL license
00012 
00013 #ifndef LYXDEBUG_H
00014 #define LYXDEBUG_H
00015 
00016 //#ifdef __GNUG__
00017 //#pragma interface
00018 //#endif
00019 
00020 #if __GNUC__ > 2
00021 #define MODERN_STL_STREAMS
00022 #endif
00023 
00024 #include <iosfwd>
00025 
00026 #include <string>
00027 //#include <lstrings.h>
00028 //#ifndef _
00029 //  #define _(n) n
00030 //#endif
00031 
00032 using std::string;
00033 
00038 struct Debug {
00040     enum type {
00042         NONE = 0,
00044         INFO    = (1 << 0),   // 1
00046         INIT    = (1 << 1),   // 2
00048         WARN    = (1 << 2),   // 4
00050         CRIT    = (1 << 3),   // 8
00052         LEVEL1  = (1 << 4),   // 16
00054         LEVEL2  = (1 << 5),   // 32
00056         LEVEL3  = (1 << 6),   // 64
00058         LEVEL4  = (1 << 7),   // 128
00060         LEVEL5  = (1 << 8),   // 256
00062         LEVEL6  = (1 << 9),   // 512
00064         LEVEL7  = (1 << 10),  // 1024
00066         LEVEL8  = (1 << 11),  // 2048
00068         LEVEL9  = (1 << 12),  // 4096
00070         REPOSITORY = (1 << 13),
00072         SYSTEM     = (1 << 14),
00074         EXCEPTION  = (1 << 15)
00075         
00076     };
00078     static type const ANY;
00079 
00081 //  friend inline void operator|=(Debug::type & d1, Debug::type d2);
00082     
00086     static Debug::type value(string const & val); 
00087 
00091     static void showLevel(std::ostream & o, type level);
00092 
00094     static void showTags(std::ostream & o);
00095 
00096     friend std::ostream& operator<<(std::ostream& os, Debug::type level );
00097 };
00098 
00099 
00100 
00101 inline
00102 void operator|=(Debug::type & d1, Debug::type d2)
00103 {
00104     d1 = static_cast<Debug::type>(d1 | d2);
00105 }
00106 
00107 
00108 #include "DebugStream.h"
00109 
00110 std::ostream & operator<<(std::ostream & o, Debug::type t);
00111 //extern DebugStream unideb;
00112 
00113 #endif