#ifndef ROOT_TDocDirective
#define ROOT_TDocDirective
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
class TClass;
class TDocParser;
class TDocOutput;
class THtml;
class TLatex;
class TMacro;
class TVirtualPad;
class TDocDirective: public TNamed {
protected:
TDocParser* fDocParser;
THtml* fHtml;
TDocOutput* fDocOutput;
TString fParameters;
Int_t fCounter;
virtual void AddParameter(const TString& , const char* = 0) {}
TDocDirective() {}
TDocDirective(const char* name):
TNamed(name, ""), fDocParser(0), fHtml(0), fDocOutput(0), fCounter(-1) {};
virtual ~TDocDirective() {}
const char* GetName() const { return TNamed::GetName(); }
void GetName(TString& name) const;
TDocParser* GetDocParser() const { return fDocParser; }
TDocOutput* GetDocOutput() const { return fDocOutput; }
THtml* GetHtml() const { return fHtml; }
const char* GetOutputDir() const;
void SetParser(TDocParser* parser);
void SetParameters(const char* params);
void SetTag(const char* tag) { SetTitle(tag); }
void SetCounter(Int_t count) { fCounter = count; }
virtual void DeleteOutputFiles(const char* ext) const;
public:
virtual const char* GetEndTag() const = 0;
virtual void AddLine(const TSubString& line) = 0;
virtual Bool_t GetResult(TString& result) = 0;
virtual void DeleteOutput() const {}
friend class TDocParser;
ClassDef(TDocDirective, 0);
};
class TDocHtmlDirective: public TDocDirective {
private:
TString fText;
Bool_t fVerbatim;
public:
TDocHtmlDirective(): TDocDirective("HTML"), fVerbatim(kFALSE) {}
virtual ~TDocHtmlDirective() {}
virtual void AddLine(const TSubString& line);
virtual const char* GetEndTag() const { return "end_html"; }
virtual Bool_t GetResult(TString& result);
ClassDef(TDocHtmlDirective, 0);
};
class TDocMacroDirective: public TDocDirective {
private:
TMacro* fMacro;
Bool_t fNeedGraphics;
Bool_t fShowSource;
Bool_t fIsFilename;
virtual void AddParameter(const TString& name, const char* value = 0);
public:
TDocMacroDirective():
TDocDirective("MACRO"), fMacro(0), fNeedGraphics(kFALSE),
fShowSource(kFALSE), fIsFilename(kTRUE) {};
virtual ~TDocMacroDirective();
virtual void AddLine(const TSubString& line);
virtual const char* GetEndTag() const { return "end_macro"; }
virtual Bool_t GetResult(TString& result);
virtual void DeleteOutput() const { DeleteOutputFiles(".gif"); }
ClassDef(TDocMacroDirective, 0);
};
class TDocLatexDirective: public TDocDirective {
protected:
TMacro* fLatex;
Int_t fFontSize;
TString fSeparator;
Bool_t fSepIsRegexp;
TString fAlignment;
TVirtualPad* fBBCanvas;
virtual void CreateLatex(const char* filename);
virtual void AddParameter(const TString& name, const char* value = 0);
virtual void GetBoundingBox(TLatex& latex, const char* text, Float_t& width, Float_t& height);
public:
TDocLatexDirective():
TDocDirective("LATEX"), fLatex(0), fFontSize(16),
fSepIsRegexp(kFALSE), fBBCanvas(0) {};
virtual ~TDocLatexDirective();
virtual void AddLine(const TSubString& line);
virtual const char* GetEndTag() const {return "end_latex";}
const char* GetAlignment() const {return fAlignment;}
const char* GetSeparator() const {return fSeparator;}
Bool_t SeparatorIsRegexp() const {return fSepIsRegexp;}
Int_t GetFontSize() const {return fFontSize;}
TList* GetListOfLines() const;
virtual Bool_t GetResult(TString& result);
virtual void DeleteOutput() const { DeleteOutputFiles(".gif"); }
ClassDef(TDocLatexDirective, 0);
};
#endif // ROOT_TDocDirective