diff options
-rw-r--r-- | src/dotrunner.cpp | 6 | ||||
-rw-r--r-- | src/dotrunner.h | 67 |
2 files changed, 17 insertions, 56 deletions
diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp index 28c49cd..d6dd1fe 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -146,8 +146,8 @@ bool DotRunner::readBoundingBox(const char *fileName,int *width,int *height,bool //--------------------------------------------------------------------------------- DotRunner::DotRunner(const QCString& absDotName, const QCString& md5Hash) - : m_file(absDotName) - , m_md5Hash(md5Hash) + : m_file(absDotName.data()) + , m_md5Hash(md5Hash.data()) , m_dotExe(Config_getString(DOT_PATH)+"dot") , m_cleanUp(Config_getBool(DOT_CLEANUP)) { @@ -230,7 +230,7 @@ bool DotRunner::run() } // create checksum file - if (!m_md5Hash.isEmpty()) + if (!m_md5Hash.empty()) { QCString md5Name = getBaseNameOfOutput(m_file.data()) + ".md5"; FILE *f = Portable::fopen(md5Name,"w"); diff --git a/src/dotrunner.h b/src/dotrunner.h index 65bc543..fb653dc 100644 --- a/src/dotrunner.h +++ b/src/dotrunner.h @@ -16,7 +16,8 @@ #ifndef DOTRUNNER_H #define DOTRUNNER_H -#include "qcstring.h" +#include <qstring.h> +#include <string> #include <thread> #include <list> #include <queue> @@ -24,59 +25,19 @@ #include <condition_variable> #include <memory> -/** Minimal constant string class that is thread safe, once initialized. */ -class DotConstString -{ - public: - DotConstString() { m_str=0;} - ~DotConstString() { delete[] m_str;} - DotConstString(char const* s) : m_str(0) { set(s); } - DotConstString(const QCString &s) : m_str(0) { set(s); } - DotConstString(const DotConstString &s) : m_str(0) { set(s.data()); } - const char *data() const { return m_str; } - bool isEmpty() const { return m_str==0 || m_str[0]=='\0'; } - - private: - void set(char const* s) - { - delete[] m_str; - m_str=0; - if (s) - { - m_str=new char[strlen(s) + 1]; - qstrcpy(m_str,s); - } - } - - void set(const QCString &s) - { - delete[] m_str; - m_str=0; - if (!s.isEmpty()) - { - m_str=new char[s.length()+1]; - qstrcpy(m_str,s.data()); - } - } - - DotConstString &operator=(const DotConstString &); - - char *m_str; -}; - /** Helper class to run dot from doxygen from multiple threads. */ class DotRunner { public: struct DotJob { - DotJob(const DotConstString & format, - const DotConstString & output, - const DotConstString & args) - : format(format), output(output), args(args) {} - DotConstString format; - DotConstString output; - DotConstString args; + DotJob(std::string format, + std::string output, + std::string args) + : format(std::move(format)), output(std::move(output)), args(std::move(args)) {} + std::string format; + std::string output; + std::string args; }; /** Creates a runner for a dot \a file. */ @@ -94,15 +55,15 @@ class DotRunner bool run(); // DotConstString const& getFileName() { return m_file; } - DotConstString const& getMd5Hash() { return m_md5Hash; } + std::string const & getMd5Hash() { return m_md5Hash; } static bool readBoundingBox(const char* fileName, int* width, int* height, bool isEps); private: - DotConstString m_file; - DotConstString m_md5Hash; - DotConstString m_dotExe; - bool m_cleanUp; + std::string m_file; + std::string m_md5Hash; + std::string m_dotExe; + bool m_cleanUp; std::vector<DotJob> m_jobs; }; |