Doxygen
Loading...
Searching...
No Matches
dotfilepatcher.h
Go to the documentation of this file.
1/******************************************************************************
2*
3* Copyright (C) 1997-2019 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#ifndef DOTFILEPATCHER_H
17#define DOTFILEPATCHER_H
18
19#include <vector>
20
21#include "dstring.h"
22
23class TextStream;
24
25/** Helper class to insert a set of map file into an output file */
27{
28 public:
29 DotFilePatcher(const DString &patchFile);
30 int addMap(const DString &mapFile,const DString &relPath,
31 bool urlOnly,const DString &context,const DString &label);
32
33 int addFigure(const DString &baseName,
34 const DString &figureName,bool heightCheck);
35
36 int addSVGConversion(const DString &relPath,bool urlOnly,
37 const DString &context,bool zoomable,int graphId);
38
39 int addSVGObject(const DString &baseName, const DString &figureName,
40 const DString &relPath);
41 bool run() const;
42 bool isSVGFile() const;
43
44 static bool convertMapFile(TextStream &t,const DString &mapName,
45 const DString &relPath, bool urlOnly=false,
46 const DString &context=DString());
47
48 static bool writeSVGFigureLink(TextStream &out,const DString &relPath,
49 const DString &baseName,const DString &absImgName);
50
51 static bool writeVecGfxFigure(TextStream& out, const DString& baseName,
52 const DString& figureName);
53
54 /*! To adhere to the requirement that an id cannot have a digit at the first position always place an "a" in front */
55 static DString mapLabelToId(const DString &mapLabel)
56 {
57 if (mapLabel.empty()) return mapLabel;
58 return "a" + mapLabel;
59 }
60
61 private:
62 struct Map
63 {
64 Map(const DString &mf,const DString &rp,bool uo,const DString &ctx,
65 const DString &lab,bool zoom=false,int gId=-1) :
66 mapFile(mf), relPath(rp), urlOnly(uo), context(ctx),
67 label(lab), zoomable(zoom), graphId(gId) {}
70 bool urlOnly;
75 };
76 std::vector<Map> m_maps;
78};
79
80
81#endif
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
int addMap(const DString &mapFile, const DString &relPath, bool urlOnly, const DString &context, const DString &label)
static DString mapLabelToId(const DString &mapLabel)
bool isSVGFile() const
std::vector< Map > m_maps
DotFilePatcher(const DString &patchFile)
static bool writeVecGfxFigure(TextStream &out, const DString &baseName, const DString &figureName)
int addSVGConversion(const DString &relPath, bool urlOnly, const DString &context, bool zoomable, int graphId)
static bool writeSVGFigureLink(TextStream &out, const DString &relPath, const DString &baseName, const DString &absImgName)
Check if a reference to a SVG figure can be written and do so if possible.
static bool convertMapFile(TextStream &t, const DString &mapName, const DString &relPath, bool urlOnly=false, const DString &context=DString())
int addSVGObject(const DString &baseName, const DString &figureName, const DString &relPath)
int addFigure(const DString &baseName, const DString &figureName, bool heightCheck)
Text streaming class that buffers data.
Definition textstream.h:36
Map(const DString &mf, const DString &rp, bool uo, const DString &ctx, const DString &lab, bool zoom=false, int gId=-1)