source: trunk/MagicSoft/Mars/mbase/MArgs.h@ 9311

Last change on this file since 9311 was 9141, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 1.7 KB
Line 
1#ifndef MARS_MArgs
2#define MARS_MArgs
3
4#ifndef ROOT_TNamed
5#include <TNamed.h>
6#endif
7
8#ifndef ROOT_TList
9#include <TList.h>
10#endif
11
12class MArgsEntry : public TString, public TObject
13{
14public:
15 MArgsEntry(const char *c) : TString(c), TObject()
16 {
17 ReplaceAll("\015", "");
18 dynamic_cast<TString&>(*this) = Strip(TString::kBoth);
19 }
20
21 void Print(const Option_t *o) const;
22
23 ClassDef(MArgsEntry, 0)
24};
25
26class MArgs : public TNamed
27{
28private:
29 Int_t fArgc; //!
30 TList fArgv; //!
31
32public:
33 MArgs(int argc, char **argv);
34
35 // TObject
36 void Print(const Option_t *o="") const;
37
38 // FIXME: Add max, min option
39 // FIXME: Add default option
40
41 // MArgs
42 Int_t RemoveRootArgs();
43
44 Int_t GetInt(const TString name) const;
45 Double_t GetFloat(const TString name) const;
46 TString GetString(const TString name) const;
47
48 Int_t GetIntAndRemove(const TString name);
49 Double_t GetFloatAndRemove(const TString name);
50 TString GetStringAndRemove(const TString name);
51
52 Int_t GetIntAndRemove(const TString name, Int_t def);
53 Double_t GetFloatAndRemove(const TString name, Double_t def);
54 TString GetStringAndRemove(const TString name, const TString def);
55
56 Bool_t Has(const TString name) const;
57 Bool_t HasOnly(const TString name) const;
58 Bool_t HasOption(const TString name) const;
59 Bool_t HasOnlyAndRemove(const TString name);
60
61 TString GetArgumentStr(Int_t i) const;
62 Int_t GetArgumentInt(Int_t i) const;
63 Float_t GetArgumentFloat(Int_t i) const;
64 Int_t GetNumArguments() const;
65 Int_t GetNumOptions() const;
66 Int_t GetNumEntries() const;
67
68 ClassDef(MArgs, 0) //Class to parse command line arguments
69};
70
71#endif
Note: See TracBrowser for help on using the repository browser.