Doxygen
Loading...
Searching...
No Matches
dia.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum class  DiaOutputFormat { BITMAP , EPS }
 

Functions

void writeDiaGraphFromFile (const QCString &inFile, const QCString &outDir, const QCString &outFile, DiaOutputFormat format, const QCString &srcFile, int srcLine)
 

Enumeration Type Documentation

◆ DiaOutputFormat

enum class DiaOutputFormat
strong
Enumerator
BITMAP 
EPS 

Definition at line 23 of file dia.h.

23{ BITMAP , EPS };

Function Documentation

◆ writeDiaGraphFromFile()

void writeDiaGraphFromFile ( const QCString & inFile,
const QCString & outDir,
const QCString & outFile,
DiaOutputFormat format,
const QCString & srcFile,
int srcLine )

Definition at line 26 of file dia.cpp.

29{
30 QCString absOutFile = outDir;
31 absOutFile+=Portable::pathSeparator();
32 absOutFile+=outFile;
33
34 // chdir to the output dir, so dot can find the font file.
35 std::string oldDir = Dir::currentDirPath();
36 // go to the html output directory (i.e. path)
37 Dir::setCurrent(outDir.str());
38 //printf("Going to dir %s\n",Dir::currentDirPath().c_str());
39 QCString diaExe = Config_getString(DIA_PATH)+"dia"+Portable::commandExtension();
40 QCString diaArgs;
41 QCString extension;
42 diaArgs+="-n ";
43 if (format==DiaOutputFormat::BITMAP)
44 {
45 diaArgs+="-t png-libart";
46 extension=".png";
47 }
48 else if (format==DiaOutputFormat::EPS)
49 {
50 diaArgs+="-t eps";
51 extension=".eps";
52 }
53
54 diaArgs+=" -e \"";
55 diaArgs+=outFile;
56 diaArgs+=extension+"\"";
57
58 diaArgs+=" \"";
59 diaArgs+=inFile;
60 diaArgs+="\"";
61
62 //printf("*** running: %s %s outDir:%s %s\n",qPrint(diaExe),qPrint(diaArgs),outDir,outFile);
63 if (Portable::system(diaExe,diaArgs,FALSE)!=0)
64 {
65 err_full(srcFile,srcLine,"Problems running %s. Check your installation or look typos in you dia file %s",
66 qPrint(diaExe),qPrint(inFile));
67 goto error;
68 }
69 if ( (format==DiaOutputFormat::EPS) && (Config_getBool(USE_PDFLATEX)) )
70 {
72 epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"",
73 qPrint(outFile),qPrint(outFile));
74 if (Portable::system("epstopdf",epstopdfArgs)!=0)
75 {
76 err("Problems running epstopdf. Check your TeX installation!\n");
77 }
78 else
79 {
80 Dir().remove(outFile.str()+".eps");
81 }
82 }
83
84error:
85 Dir::setCurrent(oldDir);
86}
Class representing a directory in the file system.
Definition dir.h:75
static std::string currentDirPath()
Definition dir.cpp:340
bool remove(const std::string &path, bool acceptsAbsPath=true) const
Definition dir.cpp:314
static bool setCurrent(const std::string &path)
Definition dir.cpp:348
This is an alternative implementation of QCString.
Definition qcstring.h:101
const std::string & str() const
Definition qcstring.h:526
@ ExplicitSize
Definition qcstring.h:133
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
static const int maxCmdLine
Definition dia.cpp:24
#define err(fmt,...)
Definition message.h:84
#define err_full(file, line, fmt,...)
Definition message.h:89
QCString pathSeparator()
Definition portable.cpp:391
int system(const QCString &command, const QCString &args, bool commandHasConsole=true)
Definition portable.cpp:106
const char * commandExtension()
Definition portable.cpp:478
const char * qPrint(const char *s)
Definition qcstring.h:661
#define FALSE
Definition qcstring.h:34

References BITMAP, Portable::commandExtension(), Config_getBool, Config_getString, Dir::currentDirPath(), EPS, err, err_full, QCString::ExplicitSize, FALSE, maxCmdLine, Portable::pathSeparator(), qPrint(), Dir::remove(), Dir::setCurrent(), QCString::sprintf(), QCString::str(), and Portable::system().

Referenced by DocbookDocVisitor::startDiaFile(), LatexDocVisitor::startDiaFile(), DocbookDocVisitor::writeDiaFile(), HtmlDocVisitor::writeDiaFile(), LatexDocVisitor::writeDiaFile(), and RTFDocVisitor::writeDiaFile().