Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
JText.cc File Reference

Auxiliary program to create TText. More...

#include <string>
#include <iostream>
#include "TROOT.h"
#include "TFile.h"
#include "TText.h"
#include "Jeep/JProperties.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Classes

struct  JText
 Auxiliary data structure for line. More...
 

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to create TText.

Author
mdejong

Definition in file JText.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 55 of file JText.cc.

56 {
57  using namespace std;
58 
59  string outputFile;
61  Short_t align = 22;
62  Float_t angle = 0.0;
63  Color_t color = kBlack;
64  Font_t font = 43;
65  Float_t size = 40;
66  int debug;
67 
68  try {
69 
70  JProperties properties;
71 
72  properties.insert(gmake_property(align));
73  properties.insert(gmake_property(angle));
74  properties.insert(gmake_property(color));
75  properties.insert(gmake_property(font));
76  properties.insert(gmake_property(size));
77 
78  JParser<> zap("Auxiliary program to create TText.");
79 
80  zap['o'] = make_field(outputFile);
81  zap['p'] = make_field(parameters, "x1 y1 text");
82  zap['@'] = make_field(properties, "text attributes") = JPARSER::initialised();
83  zap['d'] = make_field(debug) = 1;
84 
85  zap(argc, argv);
86  }
87  catch(const exception &error) {
88  FATAL(error.what() << endl);
89  }
90 
91 
92  TFile out(outputFile.c_str(), "recreate");
93 
94  TText* p = new TText(parameters.x1, parameters.y1, parameters.text.c_str());
95 
96  p->SetTextAlign(align);
97  p->SetTextAngle(angle);
98  p->SetTextColor(color);
99  p->SetTextFont (font);
100  p->SetTextSize (size);
101 
102  out.WriteTObject(p);
103 
104  out.Write();
105  out.Close();
106 }
Utility class to parse command line options.
Definition: JParser.hh:1517
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
Definition: JProperties.hh:496
Auxiliary data structure for line.
Definition: JText.cc:16
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level