My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Enumerations | Functions
msc.h File Reference

Go to the source code of this file.

Enumerations

enum  MscOutputFormat { MSC_BITMAP, MSC_EPS, MSC_SVG }
 

Functions

void writeMscGraphFromFile (const char *inFile, const char *outDir, const char *outFile, MscOutputFormat format)
 
QCString getMscImageMapFromFile (const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &context)
 
void writeMscImageMapFromFile (FTextStream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context, MscOutputFormat format)
 

Enumeration Type Documentation

Enumerator
MSC_BITMAP 
MSC_EPS 
MSC_SVG 

Definition at line 24 of file msc.h.

Function Documentation

QCString getMscImageMapFromFile ( const QCString &  inFile,
const QCString &  outDir,
const QCString &  relPath,
const QCString &  context 
)

Definition at line 156 of file msc.cpp.

References Config_getString, convertMapFile(), portable_commandExtension(), portable_system(), portable_sysTimerStart(), and portable_sysTimerStop().

Referenced by writeMscImageMapFromFile().

{
QCString outFile = inFile + ".map";
//printf("*** running:getMscImageMapFromFile \n");
// chdir to the output dir, so dot can find the font file.
QCString oldDir = QDir::currentDirPath().utf8();
// go to the html output directory (i.e. path)
QDir::setCurrent(outDir);
//printf("Going to dir %s\n",QDir::currentDirPath().data());
QCString mscExe = Config_getString(MSCGEN_PATH)+"mscgen"+portable_commandExtension();
QCString mscArgs = "-T ismap -i \"";
mscArgs+=inFile;
mscArgs+="\" -o \"";
mscArgs+=outFile + "\"";
int exitCode;
if ((exitCode=portable_system(mscExe,mscArgs,FALSE))!=0)
{
QDir::setCurrent(oldDir);
return "";
}
QGString result;
FTextStream tmpout(&result);
convertMapFile(tmpout, outFile, relPath, context);
QDir().remove(outFile);
QDir::setCurrent(oldDir);
return result.data();
}
void writeMscGraphFromFile ( const char *  inFile,
const char *  outDir,
const char *  outFile,
MscOutputFormat  format 
)

Definition at line 92 of file msc.cpp.

References Config_getBool, Config_getString, err(), maxCmdLine, MSC_BITMAP, MSC_EPS, MSC_SVG, portable_commandExtension(), portable_pathSeparator(), portable_system(), portable_sysTimerStart(), and portable_sysTimerStop().

Referenced by DocbookDocVisitor::startMscFile(), LatexDocVisitor::startMscFile(), DocbookDocVisitor::writeMscFile(), HtmlDocVisitor::writeMscFile(), RTFDocVisitor::writeMscFile(), and LatexDocVisitor::writeMscFile().

{
QCString absOutFile = outDir;
absOutFile+=portable_pathSeparator();
absOutFile+=outFile;
// chdir to the output dir, so dot can find the font file.
QCString oldDir = QDir::currentDirPath().utf8();
// go to the html output directory (i.e. path)
QDir::setCurrent(outDir);
//printf("Going to dir %s\n",QDir::currentDirPath().data());
QCString mscExe = Config_getString(MSCGEN_PATH)+"mscgen"+portable_commandExtension();
QCString mscArgs;
QCString extension;
switch (format)
{
case MSC_BITMAP:
mscArgs+="-T png";
extension=".png";
break;
case MSC_EPS:
mscArgs+="-T eps";
extension=".eps";
break;
case MSC_SVG:
mscArgs+="-T svg";
extension=".svg";
break;
default:
goto error; // I am not very fond of goto statements, but when in Rome...
}
mscArgs+=" -i \"";
mscArgs+=inFile;
mscArgs+="\" -o \"";
mscArgs+=outFile;
mscArgs+=extension+"\"";
int exitCode;
// printf("*** running: %s %s outDir:%s %s\n",mscExe.data(),mscArgs.data(),outDir,outFile);
if ((exitCode=portable_system(mscExe,mscArgs,FALSE))!=0)
{
goto error;
}
if ( (format==MSC_EPS) && (Config_getBool(USE_PDFLATEX)) )
{
QCString epstopdfArgs(maxCmdLine);
epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"",
outFile,outFile);
if (portable_system("epstopdf",epstopdfArgs)!=0)
{
err("Problems running epstopdf. Check your TeX installation!\n");
}
}
error:
QDir::setCurrent(oldDir);
}
void writeMscImageMapFromFile ( FTextStream t,
const QCString &  inFile,
const QCString &  outDir,
const QCString &  relPath,
const QCString &  baseName,
const QCString &  context,
MscOutputFormat  format 
)

Definition at line 194 of file msc.cpp.

References endl(), getMscImageMapFromFile(), MSC_BITMAP, MSC_EPS, and MSC_SVG.

Referenced by HtmlDocVisitor::writeMscFile().

{
QCString mapName = baseName+".map";
t << "<img src=\"" << relPath << baseName << ".";
switch (format)
{
case MSC_BITMAP:
t << "png";
break;
case MSC_EPS:
t << "eps";
break;
case MSC_SVG:
t << "svg";
break;
default:
t << "unknown";
}
t << "\" alt=\""
<< baseName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>" << endl;
QCString imap = getMscImageMapFromFile(inFile,outDir,relPath,context);
t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">" << imap << "</map>" << endl;
}