]> Creatis software - gdcm.git/blob - src/gdcmUtil.cxx
* Truckload of changes. Parsing of header is barely functional
[gdcm.git] / src / gdcmUtil.cxx
1 #include <ctype.h>
2 #include "gdcmUtil.h"
3
4 gdcmDebug::gdcmDebug(int level = 0) {
5         DebugLevel = level;
6 }
7
8 void gdcmDebug::Verbose(int Level, const char * Msg1, const char * Msg2 = "") {
9         if (Level > DebugLevel)
10                 return ;
11         cerr << Msg1 << ' ' << Msg2 << '\n';
12 }
13
14 void gdcmDebug::Assert(int Level, bool Test,
15                  const char * Msg1, const char * Msg2 = "") {
16         if (Level > DebugLevel)
17                 return ;
18         if (!Test)
19                 cerr << Msg1 << ' ' << Msg2 << '\n';
20 }
21
22 void gdcmDebug::Error( bool Test, const char * Msg1, const char * Msg2 = "") {
23         if (!Test)
24                 return;
25         std::cerr << Msg1 << ' ' << Msg2 << '\n';
26         std::exit(1);
27 }
28
29 void gdcmDebug::Error(const char* Msg1, const char* Msg2 ="",
30                       const char* Msg3 ="") {
31         std::cerr << Msg1 << ' ' << Msg2 << ' ' << Msg3 << '\n';
32         std::exit(1);
33 }
34
35 gdcmDebug dbg;
36
37 // Because is not yet available in g++2.06
38 istream& eatwhite(istream& is) {
39         char c;
40         while (is.get(c)) {
41                 if (!isspace(c)) {
42                         is.putback(c);
43                         break;
44                 }
45         }
46         return is;
47 }
48