Logo ROOT   6.12/07
Reference Guide
TMacro.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Rene Brun 16/08/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TMacro
13 #define ROOT_TMacro
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TMacro //
18 // //
19 // Class supporting a collection of lines with C++ code. //
20 // A TMacro can be executed, saved to a ROOT file, edited, etc. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TNamed.h"
25 
26 class TList;
27 class TObjString;
28 class TMD5;
29 
30 
31 class TMacro : public TNamed {
32 
33 protected:
34  TList *fLines; //collection of lines
35  TString fParams; //default string of macro parameters
36 
37  void SaveSource(FILE *fp);
38 
39 public:
40  TMacro();
41  TMacro(const TMacro&);
42  TMacro(const char *name, const char *title="");
43  virtual ~TMacro();
44  TMacro& operator=(const TMacro&);
45  virtual TObjString *AddLine(const char *text);
46  virtual void Browse(TBrowser *b);
47  virtual TMD5 *Checksum();
48  virtual TObjString *GetLineWith(const char *text) const;
49  virtual Bool_t Load() const; //*MENU*
50  virtual Long_t Exec(const char *params = 0, Int_t* error = 0); //*MENU*
51  TList *GetListOfLines() const {return fLines;}
52  virtual void Paint(Option_t *option="");
53  virtual void Print(Option_t *option="") const; //*MENU*
54  virtual Int_t ReadFile(const char *filename);
55  virtual void SaveSource(const char *filename); //*MENU*
56  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
57  virtual void SetParams(const char *params=0); //*MENU*
58 
59  ClassDef(TMacro,1) // Class supporting a collection of lines with C++ code.
60 };
61 
62 #endif
TList * GetListOfLines() const
Definition: TMacro.h:51
Collectable string class.
Definition: TObjString.h:28
const char Option_t
Definition: RtypesCore.h:62
virtual void Paint(Option_t *option="")
Execute this macro (called by TPad::Paint).
Definition: TMacro.cxx:315
virtual Long_t Exec(const char *params=0, Int_t *error=0)
Execute this macro with params, if params is 0, default parameters (set via SetParams) are used...
Definition: TMacro.cxx:266
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
Basic string class.
Definition: TString.h:125
TList * fLines
Definition: TMacro.h:34
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:320
virtual TObjString * GetLineWith(const char *text) const
Search the first line containing text.
Definition: TMacro.cxx:301
This code implements the MD5 message-digest algorithm.
Definition: TMD5.h:44
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void Print(Option_t *option="") const
Print contents of this macro.
Definition: TMacro.cxx:323
virtual Bool_t Load() const
Load the macro into the interpreter.
Definition: TMacro.cxx:247
A doubly linked list.
Definition: TList.h:44
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
TMacro & operator=(const TMacro &)
Copy constructor.
Definition: TMacro.cxx:119
void SaveSource(FILE *fp)
Save macro source in file pointer fp.
Definition: TMacro.cxx:381
virtual Int_t ReadFile(const char *filename)
Read lines in filename in this macro.
Definition: TMacro.cxx:336
long Long_t
Definition: RtypesCore.h:50
TText * text
virtual TMD5 * Checksum()
Returns checksum of the current content.
Definition: TMacro.cxx:194
TMacro()
Create an empty macro, use AddLine() or ReadFile() to fill this macro.
Definition: TMacro.cxx:62
virtual void Browse(TBrowser *b)
When clicking in the browser, the following action is performed on this macro, depending the content ...
Definition: TMacro.cxx:172
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
TString fParams
Definition: TMacro.h:35
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save macro source on stream out.
Definition: TMacro.cxx:395
virtual void SetParams(const char *params=0)
Set default parameters to execute this macro.
Definition: TMacro.cxx:419
char name[80]
Definition: TGX11.cxx:109
virtual TObjString * AddLine(const char *text)
Add line with text in the list of lines of this macro.
Definition: TMacro.cxx:139
virtual ~TMacro()
Delete this macro.
Definition: TMacro.cxx:110