Logo ROOT  
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
26class TList;
27class TObjString;
28class TMD5;
29
30
31class TMacro : public TNamed {
32
33protected:
34 TList *fLines; //collection of lines
35 TString fParams; //default string of macro parameters
36
37 void SaveSource(FILE *fp);
38
39public:
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
#define b(i)
Definition: RSha256.hxx:100
int Int_t
Definition: RtypesCore.h:41
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
char name[80]
Definition: TGX11.cxx:109
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
A doubly linked list.
Definition: TList.h:44
This code implements the MD5 message-digest algorithm.
Definition: TMD5.h:44
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
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
virtual TMD5 * Checksum()
Returns checksum of the current content.
Definition: TMacro.cxx:194
TString fParams
Definition: TMacro.h:35
TList * fLines
Definition: TMacro.h:34
virtual Bool_t Load() const
Load the macro into the interpreter.
Definition: TMacro.cxx:247
virtual ~TMacro()
Delete this macro.
Definition: TMacro.cxx:110
virtual void Paint(Option_t *option="")
Execute this macro (called by TPad::Paint).
Definition: TMacro.cxx:315
virtual TObjString * AddLine(const char *text)
Add line with text in the list of lines of this macro.
Definition: TMacro.cxx:139
virtual Int_t ReadFile(const char *filename)
Read lines in filename in this macro.
Definition: TMacro.cxx:336
void SaveSource(FILE *fp)
Save macro source in file pointer fp.
Definition: TMacro.cxx:381
TMacro()
Create an empty macro, use AddLine() or ReadFile() to fill this macro.
Definition: TMacro.cxx:62
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save macro source on stream out.
Definition: TMacro.cxx:395
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
TMacro & operator=(const TMacro &)
Copy constructor.
Definition: TMacro.cxx:119
virtual void SetParams(const char *params=0)
Set default parameters to execute this macro.
Definition: TMacro.cxx:419
TList * GetListOfLines() const
Definition: TMacro.h:51
virtual TObjString * GetLineWith(const char *text) const
Search the first line containing text.
Definition: TMacro.cxx:301
virtual void Print(Option_t *option="") const
Print contents of this macro.
Definition: TMacro.cxx:323
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Collectable string class.
Definition: TObjString.h:28
Basic string class.
Definition: TString.h:131
TText * text