25#include "mscgen_api.h"
38 err(
"failed to open map file {} for inclusion in the docs!\n"
39 "If you installed Graphviz/dot after a previous failing run, \n"
40 "try deleting the output directory and rerun doxygen.\n",mapName);
43 const int maxLineLen=1024;
46 int x1=0, y1=0, x2=0, y2=0;
48 while (getline(f,line))
55 sscanf(line.c_str(),
"rect %s %d,%d %d,%d",url,&x1,&y1,&x2,&y2);
60 sscanf(line.c_str(),
"rect %s %s %d,%d %d,%d",ref,url,&x1,&y1,&x2,&y2);
64 if (y2<y1) {
int temp=y2; y2=y1; y1=temp; }
65 if (x2<x1) {
int temp=x2; x2=x1; x1=temp; }
74 auto dfAst {
createRef( *parser.get(), url, context, srcFile, srcLine) };
75 auto dfAstImpl =
dynamic_cast<const DocNodeAST*
>(dfAst.get());
76 const DocRef *df = std::get_if<DocRef>(&dfAstImpl->root);
102 t <<
"\" shape=\"rect\" coords=\""
103 << x1 <<
"," << y1 <<
"," << x2 <<
"," << y2 <<
"\""
113 const DString &srcFile,
int srcLine)
116 if (!mscgen_tool.empty())
121 case mscgen_format_png:
124 case mscgen_format_eps:
127 case mscgen_format_svg:
130 case mscgen_format_pngmap:
131 case mscgen_format_svgmap:
135 int exitcode =
Portable::system(mscgen_tool,
"-T"+type+
" -o "+outFile+
" "+inFile);
138 err_full(srcFile,srcLine,
"Problems running external tool {} given via MSCGEN_TOOL (exit status: {})."
139 " Look for typos in your msc file and check error messages above.",
140 mscgen_tool,exitcode);
146 int code = mscgen_generate(inFile.
data(),outFile.
data(),msc_format);
149 err_full(srcFile,srcLine,
"Problems generating msc output (error={}). Look for typos in you msc file '{}'",
150 mscgen_error2str(code),inFile);
159 const DString &srcFile,
int srcLine,
bool toIndex
166 mscgen_format_t msc_format = mscgen_format_png;
171 msc_format = mscgen_format_png;
175 msc_format = mscgen_format_eps;
179 msc_format = mscgen_format_svg;
193 epstopdfArgs.
sprintf(
"\"%s.eps\" --outfile=\"%s.pdf\"",
197 err_full(srcFile,srcLine,
"Problems running epstopdf when processing '{}.eps'. Check your TeX installation!", absOutFile);
201 Dir().remove((absOutFile +
".eps").data());
205 size_t i0 = imgName.
rfind(
'/');
206 size_t i1 = imgName.
rfind(
'\\');
211 imgName=imgName.
mid(i+1);
219 bool writeSVGMap,
const DString &srcFile,
int srcLine)
221 DString outFile = inFile +
".map";
224 writeSVGMap ? mscgen_format_svgmap : mscgen_format_pngmap,
231 Dir().remove(outFile.
str());
246 DString mapName = baseName+
".map";
247 t <<
"<img src=\"" << relPath << baseName <<
".";
266 << baseName <<
"\" border=\"0\" usemap=\"#" << mapName <<
"\"/>\n";
267 t <<
"<map name=\"" << mapName <<
"\" id=\"" << mapName <<
"\">" << imap <<
"</map>\n";
271 t <<
"\" alt=\"" << baseName <<
"\" border=\"0\"/>\n";
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
size_t rfind(char c, size_t pos=npos) const
DString mid(size_t index, size_t len=npos) const
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
DString & sprintf(const char *format,...)
const std::string & str() const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Class representing the abstract syntax tree of a documentation block.
Node representing a reference to some item.
static IndexList * indexList
void addImageFile(const DString &name)
Text streaming class that buffers data.
std::string str() const
Return the contents of the buffer as a std::string object.
#define Config_getBool(name)
#define Config_getString(name)
static const int maxCmdLine
IDocParserPtr createDocParser()
factory function to create a parser
IDocNodeASTPtr createRef(IDocParser &parserIntf, const DString &target, const DString &context, const DString &srcFile, int srcLine)
int dstrcmp(const char *str1, const char *str2)
const char * qPrint(const char *s)
#define err_full(file, line, fmt,...)
void writeMscGraphFromFile(const DString &inFile, const DString &outDir, const DString &outFile, MscOutputFormat format, const DString &srcFile, int srcLine, bool toIndex)
static bool do_mscgen_generate(const DString &inFile, const DString &outFile, mscgen_format_t msc_format, const DString &srcFile, int srcLine)
static DString getMscImageMapFromFile(const DString &inFile, const DString &, const DString &relPath, const DString &context, bool writeSVGMap, const DString &srcFile, int srcLine)
void writeMscImageMapFromFile(TextStream &t, const DString &inFile, const DString &outDir, const DString &relPath, const DString &baseName, const DString &context, MscOutputFormat format, const DString &srcFile, int srcLine)
static bool convertMapFile(TextStream &t, const DString &mapName, const DString &relPath, const DString &context, const DString &srcFile, int srcLine)
std::ifstream openInputStream(const DString &name, bool binary=false, bool openAtEnd=false)
int system(const DString &command, const DString &args, bool commandHasConsole=true)
Portable versions of functions that are platform dependent.
Some helper functions for std::string.
bool literal_at(const char *data, const char(&str)[N])
returns true iff data points to a substring that matches string literal str
DString externalRef(const DString &relPath, const DString &ref, bool href)
void addHtmlExtensionIfMissing(DString &fName)
A bunch of utility functions.