#include <SflexPdfWithPdflatex.hpp>
Abgeleitet von SflexPdf.
Klassendiagramm für SflexPdfWithPdflatex:


Öffentliche Datenelemente | |
| SflexPdfWithPdflatex () | |
| virtual | ~SflexPdfWithPdflatex () |
| virtual void | work (std::string latex) |
| Veranlaßt die Erzeugung von PDF. Mehr... | |
| virtual const std::string | getResult () const |
| Liefert das Ergebnis des jeweiligen Arbeiters. Mehr... | |
| virtual bool | isSuccess () const |
| Liefert den Status des Arbeiters. Mehr... | |
Private Attribute | |
| bool | isSuccess_ |
| der Status. Mehr... | |
| std::ostringstream | resultStream_ |
| das Ergebnis. Mehr... | |
Sie benutzt dazu das Programm 'pdflatex', das auf dem Zielrechner ausführbar sein muß. Der Pfad zu 'pdflatex' muß in der Konfigurationsdatei angegeben werden.
|
|
00027 : isSuccess_(false) 00028 { 00029 00030 } |
|
|
00035 {
00036
00037 }
|
|
|
Liefert das Ergebnis des jeweiligen Arbeiters. Im Falle eines Fehlers liefert diese Methode auch die Fehlermeldung.
Implementiert SflexWorker.
00103 {
00104 return resultStream_.str();
00105 }
|
|
|
Liefert den Status des Arbeiters.
Implementiert SflexWorker.
00111 {
00112 return isSuccess_;
00113 }
|
|
|
Veranlaßt die Erzeugung von PDF. Dazu wird eine LaTeX-Quelle (als string) benötigt, aus der dann die PDF-Datei erzeugt wird.
Implementiert SflexPdf.
00043 {
00044 using std::string;
00045 using sflexhelper::changeDir;
00046 using std::ifstream;
00047 using std::ofstream;
00048 using std::system;
00049 using std::ostringstream;
00050 using std::istringstream;
00051
00052 SflexConfig *config = SflexConfig::getConfig();
00053
00054 bool b = changeDir( config->getValue( "sflex", "temp_dir" ) );
00055 if ( !b ) {
00056 resultStream_ << "Pdf with pdflatex: "
00057 << "konnte Verzeichnis nicht wechseln!\n";
00058 isSuccess_ = false;
00059 return;
00060 }
00061
00062 ofstream tex;
00063 tex.open( "sflexPDF.tex" );
00064 istringstream texStream( latex );
00065 tex << texStream.rdbuf();
00066 tex.close();
00067
00068 string path = config->getValue( "sflex", "pdflatex" );
00069 if ( path.empty() ) {
00070 resultStream_ << "Pdf with pdflatex: kein Pfad zu pdflatex!\n";
00071 isSuccess_ = false;
00072 return;
00073 }
00074 string command = path
00075 + " --interaction nonstopmode sflexPDF.tex > /dev/null";
00076
00077 int flag = system( command.c_str() );
00078
00079 if ( flag != 0 ) {
00080 resultStream_ << "Pdf with pdflatex: Fehler beim TeX-Lauf!\n";
00081 isSuccess_ = false;
00082 return;
00083 }
00084
00085 ifstream pdf;
00086 pdf.open( "sflexPDF.pdf" );
00087 if (!pdf ) {
00088 resultStream_ << "Pdf with pdflatex: kann pdf-Datei nicht öffnen\n";
00089 isSuccess_ = false;
00090 return;
00091 }
00092 resultStream_ << pdf.rdbuf();
00093 pdf.close();
00094
00095 isSuccess_ = true;
00096 return ;
00097 }
|
|
|
der Status.
|
|
|
das Ergebnis.
|
1.2.14 geschrieben von Dimitri van Heesch,
© 1997-2002