Doxygen
Loading...
Searching...
No Matches
dotgraph.cpp File Reference
#include <mutex>
#include <regex>
#include "config.h"
#include "doxygen.h"
#include "indexlist.h"
#include "md5hash.h"
#include "message.h"
#include "util.h"
#include "dot.h"
#include "dotrunner.h"
#include "dotgraph.h"
#include "dotnode.h"
#include "dotfilepatcher.h"
#include "fileinfo.h"
#include "portable.h"
#include "textstream.h"
Include dependency graph for dotgraph.cpp:

Go to the source code of this file.

Functions

static bool sameMd5Signature (const DString &baseName, const DString &md5)
static bool deliverablesPresent (const DString &file1, const DString &file2)
static bool insertMapFile (TextStream &out, const DString &mapFile, const DString &relPath, const DString &mapLabel)

Variables

std::mutex g_dotIndexListMutex

Function Documentation

◆ deliverablesPresent()

bool deliverablesPresent ( const DString & file1,
const DString & file2 )
static

Definition at line 68 of file dotgraph.cpp.

69{
70 bool file1Ok = true;
71 bool file2Ok = true;
72 if (!file1.empty())
73 {
74 FileInfo fi(file1.str());
75 file1Ok = (fi.exists() && fi.size()>0);
76 }
77 if (!file2.empty())
78 {
79 FileInfo fi(file2.str());
80 file2Ok = (fi.exists() && fi.size()>0);
81 }
82 return file1Ok && file2Ok;
83}
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:152
const std::string & str() const
Definition dstring.h:649
Minimal replacement for QFileInfo.
Definition fileinfo.h:26

References deliverablesPresent(), DString::empty(), FileInfo::exists(), FileInfo::size(), and DString::str().

Referenced by deliverablesPresent(), and DotGraph::prepareDotFile().

◆ insertMapFile()

bool insertMapFile ( TextStream & out,
const DString & mapFile,
const DString & relPath,
const DString & mapLabel )
static

Definition at line 85 of file dotgraph.cpp.

87{
88 FileInfo fi(mapFile.str());
89 if (fi.exists() && fi.size()>0) // reuse existing map file
90 {
91 TextStream t;
92 DotFilePatcher::convertMapFile(t,mapFile,relPath,false);
93 if (!t.empty())
94 {
95 out << "<map name=\"" << mapLabel << "\" id=\"" << mapLabel << "\">\n";
96 out << t.str();
97 out << "</map>\n";
98 }
99 return true;
100 }
101 return false; // no map file yet, need to generate it
102}
static bool convertMapFile(TextStream &t, const DString &mapName, const DString &relPath, bool urlOnly=false, const DString &context=DString())
Text streaming class that buffers data.
Definition textstream.h:36
bool empty() const
Returns true iff the buffer is empty.
Definition textstream.h:256
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:232

References DotFilePatcher::convertMapFile(), TextStream::empty(), FileInfo::exists(), insertMapFile(), FileInfo::size(), DString::str(), and TextStream::str().

Referenced by DotGraph::generateCode(), and insertMapFile().

◆ sameMd5Signature()

bool sameMd5Signature ( const DString & baseName,
const DString & md5 )
static

Checks if a file "baseName".md5 exists. If so the contents are compared with md5. If equal false is returned. The .md5 is created or updated after successful creation of the output file.

Definition at line 42 of file dotgraph.cpp.

44{
45 bool same = false;
46 char md5stored[33];
47 md5stored[0]=0;
48 std::ifstream f = Portable::openInputStream(baseName+".md5",true);
49 if (f.is_open())
50 {
51 // read checksum
52 f.read(md5stored,32);
53 md5stored[32]='\0';
54 // compare checksum
55 if (!f.fail() && md5==md5stored)
56 {
57 same = true;
58 }
59 //printf("sameSignature(%s,%s==%s)=%d\n",qPrint(baseName),md5stored,qPrint(md5),same);
60 }
61 else
62 {
63 //printf("sameSignature(%s) not found\n",qPrint(baseName));
64 }
65 return same;
66}
std::ifstream openInputStream(const DString &name, bool binary=false, bool openAtEnd=false)
Definition portable.cpp:676

References Portable::openInputStream(), and sameMd5Signature().

Referenced by DotGraph::prepareDotFile(), and sameMd5Signature().

Variable Documentation

◆ g_dotIndexListMutex

std::mutex g_dotIndexListMutex

Definition at line 112 of file dotgraph.cpp.

Referenced by DotGraph::writeGraph().