source: branches/MarsGapdTimeJitter/mbase/MEnv.h@ 18159

Last change on this file since 18159 was 18018, checked in by dneise, 10 years ago
ticket:#11 MEnv, will now check if the last line ends with a \n ,and if not, it will throw an exception, print an explanation and stop fatally. This will hopefully make the user to add an empty line to the file and be happy.
File size: 3.2 KB
Line 
1#ifndef MARS_MEnv
2#define MARS_MEnv
3
4#ifndef ROOT_TEnv
5#include <TEnv.h>
6#endif
7
8#ifndef ROOT_TOrdCollection
9#include <TOrdCollection.h>
10#endif
11
12class TAttLine;
13class TAttMarker;
14class TAttText;
15class TAttFill;
16class TPave;
17
18class MArgs;
19
20class MEnv : public TEnv
21{
22private:
23 TOrdCollection fChecked; //!
24
25 TString fName;
26
27 TString Compile(TString str, const char *post) const;
28 Int_t ReadInclude();
29 Bool_t IsTEnvCompliant(const char *fname);
30
31public:
32 MEnv(const char *name="", const char *defname=0);
33
34 Bool_t IsValid() const { return !TString(GetRcName()).IsNull(); }
35
36 TObject *Clone(const char *newname="") const;
37
38 Bool_t Touch(const char *name) { return !TString(GetValue(name, "")).IsNull(); }
39
40 Int_t GetEntries() const;
41
42 Int_t GetValue(const char *name, Int_t dflt);
43 Double_t GetValue(const char *name, Double_t dflt);
44 const char *GetValue(const char *name, const char *dflt="");
45
46 // GetValue: regexp
47
48 const char *GetName() const;
49 void SetName(const char *name=0) { fName = name; }
50
51 Int_t GetColor(const char *name, Int_t dftl);
52 Int_t GetAlign(const char *name, Int_t dftl);
53 Int_t GetFillStyle(const char *name, Int_t dftl);
54 Int_t GetLineStyle(const char *name, Int_t dftl);
55
56 void GetAttributes(const char *name, TObject *obj, TObject *dftl=0);
57 void GetAttLine(const char *name, TAttLine &line, TAttLine *dftl=0);
58 void GetAttText(const char *name, TAttText &text, TAttText *dftl=0);
59 void GetAttFill(const char *name, TAttFill &fill, TAttFill *dftl=0);
60 void GetAttMarker(const char *name, TAttMarker &marker, TAttMarker *dftl=0);
61 void GetAttPave(const char *name, TPave &pave, TPave *dftl=0);
62
63 void SetColor(const char *name, Int_t col);
64 void SetAlign(const char *name, Int_t align);
65 void SetFillStyle(const char *name, Int_t style);
66 void SetLineStyle(const char *name, Int_t style);
67 void SetMarkerStyle(const char *name, Int_t style);
68
69 void SetAttributes(const char *name, const TObject *obj);
70 void SetAttLine(const char *name, const TAttLine &line);
71 void SetAttText(const char *name, const TAttText &text);
72 void SetAttFill(const char *name, const TAttFill &fill);
73 void SetAttMarker(const char *name, const TAttMarker &marker);
74 void SetAttPave(const char *name, const TPave &pave);
75
76 void AddEnv(const TEnv &env, Bool_t overwrite=kTRUE);
77 Bool_t TakeEnv(MArgs &args, Bool_t print=kFALSE, Bool_t overwrite=kTRUE);
78
79 Int_t Read(const char *name=0);
80 Int_t ReadFile(const char *fname, EEnvLevel level);
81
82 Int_t WriteFile(const char *filename, EEnvLevel level) { return TEnv::WriteFile(filename, level); }
83 Int_t WriteFile(const char *filename) { return WriteFile(filename, kEnvLocal); } //*MENU*
84
85 void PrintEnv(EEnvLevel level = kEnvAll) const;
86 void Print(Option_t *option) const { TEnv::Print(option); }
87 void Print() const { PrintEnv(kEnvLocal); } //*MENU*
88
89 void PrintUntouched() const;
90 Int_t GetNumUntouched() const;
91
92 ClassDef(MEnv, 1) // A slightly more advanced version of TEnv
93};
94
95#endif
96
Note: See TracBrowser for help on using the repository browser.