source: trunk/Mars/mbase/MEnv.h@ 20034

Last change on this file since 20034 was 19260, checked in by tbretz, 6 years ago
root 6 defined the a const -- worked around.
File size: 3.7 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#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,00)
47 Int_t GetValue(const char *name, Int_t dflt) const
48 {
49 return const_cast<MEnv*>(this)->GetValue(name, dflt);
50 }
51 Double_t GetValue(const char *name, Double_t dflt) const
52 {
53 return const_cast<MEnv*>(this)->GetValue(name, dflt);
54 }
55 const char *GetValue(const char *name, const char *dflt="") const
56 {
57 return const_cast<MEnv*>(this)->GetValue(name, dflt);
58 }
59#endif
60
61 // GetValue: regexp
62
63 const char *GetName() const;
64 void SetName(const char *name=0) { fName = name; }
65
66 Int_t GetColor(const char *name, Int_t dftl);
67 Int_t GetAlign(const char *name, Int_t dftl);
68 Int_t GetFillStyle(const char *name, Int_t dftl);
69 Int_t GetLineStyle(const char *name, Int_t dftl);
70
71 void GetAttributes(const char *name, TObject *obj, TObject *dftl=0);
72 void GetAttLine(const char *name, TAttLine &line, TAttLine *dftl=0);
73 void GetAttText(const char *name, TAttText &text, TAttText *dftl=0);
74 void GetAttFill(const char *name, TAttFill &fill, TAttFill *dftl=0);
75 void GetAttMarker(const char *name, TAttMarker &marker, TAttMarker *dftl=0);
76 void GetAttPave(const char *name, TPave &pave, TPave *dftl=0);
77
78 void SetColor(const char *name, Int_t col);
79 void SetAlign(const char *name, Int_t align);
80 void SetFillStyle(const char *name, Int_t style);
81 void SetLineStyle(const char *name, Int_t style);
82 void SetMarkerStyle(const char *name, Int_t style);
83
84 void SetAttributes(const char *name, const TObject *obj);
85 void SetAttLine(const char *name, const TAttLine &line);
86 void SetAttText(const char *name, const TAttText &text);
87 void SetAttFill(const char *name, const TAttFill &fill);
88 void SetAttMarker(const char *name, const TAttMarker &marker);
89 void SetAttPave(const char *name, const TPave &pave);
90
91 void AddEnv(const TEnv &env, Bool_t overwrite=kTRUE);
92 Bool_t TakeEnv(MArgs &args, Bool_t print=kFALSE, Bool_t overwrite=kTRUE);
93
94 Int_t Read(const char *name=0);
95 Int_t ReadFile(const char *fname, EEnvLevel level);
96
97 Int_t WriteFile(const char *filename, EEnvLevel level) { return TEnv::WriteFile(filename, level); }
98 Int_t WriteFile(const char *filename) { return WriteFile(filename, kEnvLocal); } //*MENU*
99
100 void PrintEnv(EEnvLevel level = kEnvAll) const;
101 void Print(Option_t *option) const { TEnv::Print(option); }
102 void Print() const { PrintEnv(kEnvLocal); } //*MENU*
103
104 void PrintUntouched() const;
105 Int_t GetNumUntouched() const;
106
107 ClassDef(MEnv, 1) // A slightly more advanced version of TEnv
108};
109
110#endif
111
Note: See TracBrowser for help on using the repository browser.