UniSet  2.2.1
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
00039 {
00041     enum type
00042     {
00044         NONE = 0,
00046         INFO    = (1 << 0),   // 1
00048         INIT    = (1 << 1),   // 2
00050         WARN    = (1 << 2),   // 4
00052         CRIT    = (1 << 3),   // 8
00054         LEVEL1    = (1 << 4),   // 16
00056         LEVEL2    = (1 << 5),   // 32
00058         LEVEL3    = (1 << 6),   // 64
00060         LEVEL4    = (1 << 7),   // 128
00062         LEVEL5    = (1 << 8),   // 256
00064         LEVEL6    = (1 << 9),   // 512
00066         LEVEL7    = (1 << 10),  // 1024
00068         LEVEL8    = (1 << 11),  // 2048
00070         LEVEL9    = (1 << 12),  // 4096
00072         REPOSITORY = (1 << 13),
00074         SYSTEM       = (1 << 14),
00076         EXCEPTION  = (1 << 15)
00077 
00078     };
00080     static type const ANY;
00081 
00083     //    friend inline void operator|=(Debug::type & d1, Debug::type d2);
00084 
00088     static Debug::type value(std::string const& val);
00089 
00093     static void showLevel(std::ostream& o, type level);
00094 
00096     static void showTags(std::ostream& o);
00097 
00098     friend std::ostream& operator<<(std::ostream& os, Debug::type level );
00099 
00100     static std::string str( Debug::type level );
00101 };
00102 
00103 
00104 
00105 inline
00106 void operator|=(Debug::type& d1, Debug::type d2)
00107 {
00108     d1 = static_cast<Debug::type>(d1 | d2);
00109 }
00110 
00111 
00112 #include "DebugStream.h"
00113 
00114 std::ostream& operator<<(std::ostream& o, Debug::type t);
00115 //extern DebugStream ulog;
00116 
00117 #endif