Xephyr  0.0
XeUtils.h
1 #ifndef XE_UTILS
2 #define XE_UTILS
3 
4 #include "TString.h"
5 #include <iostream>
6 
7 static const int ERROR = 3;
8 static const int WARNING = 2;
9 static const int INFO = 1;
10 static const int DEBUG = 0;
11 
12 using namespace std;
13 
22 class errorHandler {
23  public:
26  errorHandler(TString name);
27 
29  //
34  void Error(TString functionName, TString message);
35 
37  //
42  void Warning(TString functionName, TString message);
43 
44 
46  //
51  void Info(TString functionName, TString message);
52 
54  //
59  void Debug(TString functionName, TString message);
60 
61 
63  //
69  void setPrintLevel(int level) {localPrintLevel = level;};
70 
73  int getPrintLevel() {return (localPrintLevel >= 0 ? localPrintLevel : globalPrintLevel) ;};
74 
75 
76  int localPrintLevel;
78  static int globalPrintLevel; /*<! global print level of all objects, modify this with errorHandler::globalPrintLevel.
79  and you'll modify all. */
80 
81  TString className;
82 };
83 
88 class printTools {
89 
90 
91 public:
92 
93 
94  printTools();
95 
96  static TString upperCase(TString s);
97  static TString lowerCase(TString s);
98  static TString trim(TString s);
99  static TString justify(TString s, int w, bool left,bool trim);
100  static TString rightJustify(TString s, int w, bool trim=false);
101  static TString leftJustify(TString s,int w, bool trim=false);
102  static TString format0I(int v, int w=1);
103  static TString formatLI(int v, int w=1, int p=1);
104  static TString formatRI(int v, int w=1, int p=1);
105  static TString formatF(double v, int w=1, int p=1);
106  static TString formatR(double v, int w=1, int p=1);
107  static TString formatLF(double v, int w=1, int p=1);
108  static TString formatRF(double v, int w=1, int p=1);
109  static TString formatG(double v, int w=1, int p=1);
110  static TString formatLG(double v, int w=1, int p=1);
111  static TString formatRG(double v, int w=1, int p=1);
112  static TString formatI(int v, int w=1, int trailer=0);
113  static TString doOrDont(bool b) ;
114 
115 
116 };
117 
118 
119 
120 #endif
printing helpers, probably you wont use this class
Definition: XeUtils.h:88
Helper Class to send consistently formatted messages. It allows different levels of severity for the ...
Definition: XeUtils.h:22
int localPrintLevel
Definition: XeUtils.h:73
static int globalPrintLevel
Definition: XeUtils.h:78
void setPrintLevel(int level)
Set the local printing level (for this instance only)
Definition: XeUtils.h:69