Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
dia.cpp
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2021 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*
14
*/
15
16
// own header
17
#include "
dia.h
"
18
19
// other headers
20
#include "
config.h
"
21
#include "
dir.h
"
22
#include "
doxygen.h
"
23
#include "
indexlist.h
"
24
#include "
message.h
"
25
#include "
portable.h
"
26
27
static
const
int
maxCmdLine
= 40960;
28
29
void
writeDiaGraphFromFile
(
const
DString
&inFile,
const
DString
&outDir,
30
const
DString
&outFile,
DiaOutputFormat
format,
31
const
DString
&srcFile,
int
srcLine,
bool
toIndex)
32
{
33
DString
absOutFile = outDir;
34
absOutFile+=
Portable::pathSeparator
();
35
absOutFile+=outFile;
36
37
// chdir to the output dir, so dot can find the font file.
38
std::string oldDir =
Dir::currentDirPath
();
39
// go to the html output directory (i.e. path)
40
Dir::setCurrent
(outDir.
str
());
41
//printf("Going to dir %s\n",Dir::currentDirPath().c_str());
42
DString
diaExe =
Config_getString
(DIA_PATH)+
"dia"
+
Portable::commandExtension
();
43
DString
diaArgs;
44
DString
extension;
45
diaArgs+=
"-n "
;
46
if
(format==
DiaOutputFormat::BITMAP
)
47
{
48
diaArgs+=
"-t png-libart"
;
49
extension=
".png"
;
50
}
51
else
if
(format==
DiaOutputFormat::EPS
)
52
{
53
diaArgs+=
"-t eps"
;
54
extension=
".eps"
;
55
}
56
57
diaArgs+=
" -e \""
;
58
diaArgs+=outFile;
59
diaArgs+=extension+
"\""
;
60
61
diaArgs+=
" \""
;
62
diaArgs+=inFile;
63
diaArgs+=
"\""
;
64
65
//printf("*** running: %s %s outDir:%s %s\n",qPrint(diaExe),qPrint(diaArgs),outDir,outFile);
66
if
(
Portable::system
(diaExe,diaArgs,
false
)!=0)
67
{
68
err_full
(srcFile,srcLine,
"Problems running {}. Check your installation or look typos in you dia file {}"
,
69
diaExe,inFile);
70
goto
error;
71
}
72
if
( (format==
DiaOutputFormat::EPS
) && (
Config_getBool
(USE_PDFLATEX)) )
73
{
74
DString
epstopdfArgs(
maxCmdLine
,
DString::ExplicitSize
);
75
epstopdfArgs.
sprintf
(
"\"%s.eps\" --outfile=\"%s.pdf\""
,
76
qPrint
(outFile),
qPrint
(outFile));
77
if
(
Portable::system
(
"epstopdf"
,epstopdfArgs)!=0)
78
{
79
err
(
"Problems running epstopdf. Check your TeX installation!\n"
);
80
}
81
else
82
{
83
Dir
().
remove
(outFile.
str
()+
".eps"
);
84
}
85
}
86
if
(toIndex)
Doxygen::indexList
->
addImageFile
(outFile+extension);
87
88
error:
89
Dir::setCurrent
(oldDir);
90
}
91
DString
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition
dstring.h:84
DString::sprintf
DString & sprintf(const char *format,...)
Definition
dstring.cpp:34
DString::ExplicitSize
@ ExplicitSize
Definition
dstring.h:131
DString::str
const std::string & str() const
Definition
dstring.h:645
Dir
Class representing a directory in the file system.
Definition
dir.h:73
Dir::currentDirPath
static std::string currentDirPath()
Definition
dir.cpp:348
Dir::remove
bool remove(const std::string &path, bool acceptsAbsPath=true) const
Definition
dir.cpp:320
Dir::setCurrent
static bool setCurrent(const std::string &path)
Definition
dir.cpp:356
Doxygen::indexList
static IndexList * indexList
Definition
doxygen.h:125
IndexList::addImageFile
void addImageFile(const DString &name)
Definition
indexlist.h:124
config.h
Config_getBool
#define Config_getBool(name)
Definition
config.h:33
Config_getString
#define Config_getString(name)
Definition
config.h:32
writeDiaGraphFromFile
void writeDiaGraphFromFile(const DString &inFile, const DString &outDir, const DString &outFile, DiaOutputFormat format, const DString &srcFile, int srcLine, bool toIndex)
Definition
dia.cpp:29
maxCmdLine
static const int maxCmdLine
Definition
dia.cpp:27
dia.h
DiaOutputFormat
DiaOutputFormat
Definition
dia.h:21
DiaOutputFormat::BITMAP
@ BITMAP
Definition
dia.h:21
DiaOutputFormat::EPS
@ EPS
Definition
dia.h:21
dir.h
doxygen.h
qPrint
const char * qPrint(const char *s)
Definition
dstring.h:783
indexlist.h
message.h
err
#define err(fmt,...)
Definition
message.h:127
err_full
#define err_full(file, line, fmt,...)
Definition
message.h:132
Portable::system
int system(const DString &command, const DString &args, bool commandHasConsole=true)
Definition
portable.cpp:121
Portable::pathSeparator
DString pathSeparator()
Definition
portable.cpp:390
Portable::commandExtension
const char * commandExtension()
Definition
portable.cpp:477
portable.h
Portable versions of functions that are platform dependent.
src
dia.cpp
Generated by
1.19.0