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 void Browse(TBrowser *b) override;
47 virtual TMD5 *Checksum();
48 virtual TObjString *GetLineWith(const char *text) const;
49 virtual Bool_t Load() const; //*MENU*
50 virtual Longptr_t Exec(const char *params = 0, Int_t* error = 0); //*MENU*
51 TList *GetListOfLines() const {return fLines;}
52 void Paint(Option_t *option="") override;
53 void Print(Option_t *option="") const override; //*MENU*
54 virtual Int_t ReadFile(const char *filename);
55 virtual void SaveSource(const char *filename); //*MENU*
56 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
57 virtual void SetParams(const char *params=0); //*MENU*
58
59 ClassDefOverride(TMacro,1) // Class supporting a collection of lines with C++ code.
60};
61
62#endif
int Int_t
Definition: RtypesCore.h:45
long Longptr_t
Definition: RtypesCore.h:82
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char text
char name[80]
Definition: TGX11.cxx:110
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
A doubly linked list.
Definition: TList.h:38
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 Longptr_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:268
virtual TMD5 * Checksum()
Returns checksum of the current content.
Definition: TMacro.cxx:196
TString fParams
Definition: TMacro.h:35
TList * fLines
Definition: TMacro.h:34
void Print(Option_t *option="") const override
Print contents of this macro.
Definition: TMacro.cxx:325
virtual Bool_t Load() const
Load the macro into the interpreter.
Definition: TMacro.cxx:249
virtual ~TMacro()
Delete this macro.
Definition: TMacro.cxx:112
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save macro source on stream out.
Definition: TMacro.cxx:397
virtual TObjString * AddLine(const char *text)
Add line with text in the list of lines of this macro.
Definition: TMacro.cxx:141
virtual Int_t ReadFile(const char *filename)
Read lines in filename in this macro.
Definition: TMacro.cxx:338
void SaveSource(FILE *fp)
Save macro source in file pointer fp.
Definition: TMacro.cxx:383
TMacro()
Create an empty macro, use AddLine() or ReadFile() to fill this macro.
Definition: TMacro.cxx:64
TMacro & operator=(const TMacro &)
Copy constructor.
Definition: TMacro.cxx:121
virtual void SetParams(const char *params=0)
Set default parameters to execute this macro.
Definition: TMacro.cxx:421
TList * GetListOfLines() const
Definition: TMacro.h:51
void Paint(Option_t *option="") override
Execute this macro (called by TPad::Paint).
Definition: TMacro.cxx:317
void Browse(TBrowser *b) override
When clicking in the browser, the following action is performed on this macro, depending the content ...
Definition: TMacro.cxx:174
virtual TObjString * GetLineWith(const char *text) const
Search the first line containing text.
Definition: TMacro.cxx:303
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:136