Probably null change: make sure that all classes with destructors also have copy constructors and assignment operators
This commit is contained in:
@@ -46,6 +46,8 @@ class CirCache {
|
||||
public:
|
||||
CirCache(const std::string& dir);
|
||||
virtual ~CirCache();
|
||||
CirCache(const CirCache&) = delete;
|
||||
CirCache& operator=(const CirCache&) = delete;
|
||||
|
||||
virtual std::string getReason();
|
||||
|
||||
@@ -135,11 +137,6 @@ public:
|
||||
protected:
|
||||
CirCacheInternal *m_d;
|
||||
std::string m_dir;
|
||||
private:
|
||||
CirCache(const CirCache&) {}
|
||||
CirCache& operator=(const CirCache&) {
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _circache_h_included_ */
|
||||
|
||||
+2
-2
@@ -70,6 +70,8 @@ class CmdTalk {
|
||||
public:
|
||||
CmdTalk(int timeosecs);
|
||||
virtual ~CmdTalk();
|
||||
CmdTalk(const CmdTalk&) = delete;
|
||||
CmdTalk& operator=(const CmdTalk&) = delete;
|
||||
|
||||
// @param env each entry should be of the form name=value. They
|
||||
// augment the subprocess environnement.
|
||||
@@ -99,8 +101,6 @@ class CmdTalk {
|
||||
const std::unordered_map<std::string, std::string>& args,
|
||||
std::unordered_map<std::string, std::string>& rep);
|
||||
|
||||
CmdTalk(const CmdTalk&) = delete;
|
||||
CmdTalk &operator=(const CmdTalk &) = delete;
|
||||
private:
|
||||
class Internal;
|
||||
Internal *m{0};
|
||||
|
||||
@@ -86,7 +86,10 @@ public:
|
||||
class ConfNull {
|
||||
public:
|
||||
enum StatusCode {STATUS_ERROR = 0, STATUS_RO = 1, STATUS_RW = 2};
|
||||
ConfNull() {}
|
||||
virtual ~ConfNull() {};
|
||||
ConfNull(const ConfNull&) = delete;
|
||||
ConfNull &operator=(const ConfNull &) = delete;
|
||||
virtual int get(const std::string& name, std::string& value,
|
||||
const std::string& sk = std::string()) const = 0;
|
||||
virtual int set(const std::string& nm, const std::string& val,
|
||||
|
||||
+8
-5
@@ -37,7 +37,10 @@ typedef int pid_t;
|
||||
*/
|
||||
class ExecCmdAdvise {
|
||||
public:
|
||||
ExecCmdAdvise() {}
|
||||
virtual ~ExecCmdAdvise() {}
|
||||
ExecCmdAdvise(const ExecCmdAdvise&) = delete;
|
||||
ExecCmdAdvise &operator=(const ExecCmdAdvise &) = delete;
|
||||
virtual void newData(int cnt) = 0;
|
||||
};
|
||||
|
||||
@@ -47,7 +50,10 @@ public:
|
||||
*/
|
||||
class ExecCmdProvide {
|
||||
public:
|
||||
ExecCmdProvide() {}
|
||||
virtual ~ExecCmdProvide() {}
|
||||
ExecCmdProvide(const ExecCmdProvide&) = delete;
|
||||
ExecCmdProvide &operator=(const ExecCmdProvide &) = delete;
|
||||
virtual void newData() = 0;
|
||||
};
|
||||
|
||||
@@ -220,6 +226,8 @@ public:
|
||||
};
|
||||
ExecCmd(int flags = 0);
|
||||
~ExecCmd();
|
||||
ExecCmd(const ExecCmd&) = delete;
|
||||
ExecCmd &operator=(const ExecCmd &) = delete;
|
||||
|
||||
/**
|
||||
* Utility routine: check if/where a command is found according to the
|
||||
@@ -242,11 +250,6 @@ public:
|
||||
class Internal;
|
||||
private:
|
||||
Internal *m;
|
||||
/* Copyconst and assignment are private and forbidden */
|
||||
ExecCmd(const ExecCmd&) {}
|
||||
ExecCmd& operator=(const ExecCmd&) {
|
||||
return *this;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -84,6 +84,8 @@ public:
|
||||
static const int FtwTravMask;
|
||||
FsTreeWalker(int opts = FtwTravNatural);
|
||||
~FsTreeWalker();
|
||||
FsTreeWalker(const FsTreeWalker&) = delete;
|
||||
FsTreeWalker& operator=(const FsTreeWalker&) = delete;
|
||||
|
||||
void setOpts(int opts);
|
||||
int getOpts();
|
||||
@@ -132,11 +134,14 @@ private:
|
||||
|
||||
class FsTreeWalkerCB {
|
||||
public:
|
||||
FsTreeWalkerCB() {}
|
||||
virtual ~FsTreeWalkerCB() {}
|
||||
FsTreeWalkerCB(const FsTreeWalkerCB&) = delete;
|
||||
FsTreeWalkerCB& operator=(const FsTreeWalkerCB&) = delete;
|
||||
|
||||
// Only st_mtime, st_ctime, st_size, st_mode (filetype bits: dir/reg/lnk),
|
||||
virtual FsTreeWalker::Status
|
||||
processone(const std::string&, const struct PathStat *,
|
||||
FsTreeWalker::CbFlag) = 0;
|
||||
processone(const std::string&, const struct PathStat *, FsTreeWalker::CbFlag) = 0;
|
||||
};
|
||||
|
||||
// Utility function. Somewhat like du.
|
||||
|
||||
+3
-3
@@ -77,9 +77,9 @@ struct HighlightData {
|
||||
std::vector<TermGroup> index_term_groups;
|
||||
|
||||
void clear() {
|
||||
uterms.clear();
|
||||
ugroups.clear();
|
||||
index_term_groups.clear();
|
||||
uterms.clear();
|
||||
ugroups.clear();
|
||||
index_term_groups.clear();
|
||||
}
|
||||
void append(const HighlightData&);
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ public:
|
||||
m_loop(0) {
|
||||
}
|
||||
virtual ~Netcon();
|
||||
Netcon(const Netcon&) = delete;
|
||||
Netcon& operator=(const Netcon&) = delete;
|
||||
/// Remember whom we're talking to. We let external code do this because
|
||||
/// the application may have a non-dns method to find the peer name.
|
||||
virtual void setpeer(const char *hostname);
|
||||
@@ -181,7 +183,11 @@ class NetconData;
|
||||
/// NetconData derived classes).
|
||||
class NetconWorker {
|
||||
public:
|
||||
NetconWorker() {}
|
||||
virtual ~NetconWorker() {}
|
||||
NetconWorker(const NetconWorker&) = delete;
|
||||
NetconWorker& operator=(const NetconWorker&) = delete;
|
||||
|
||||
virtual int data(NetconData *con, Netcon::Event reason) = 0;
|
||||
};
|
||||
|
||||
@@ -190,6 +196,8 @@ class NetconData : public Netcon {
|
||||
public:
|
||||
NetconData(bool cancellable = false);
|
||||
virtual ~NetconData();
|
||||
NetconData(const NetconData&) = delete;
|
||||
NetconData& operator=(const NetconData&) = delete;
|
||||
|
||||
/// Write data to the connection.
|
||||
/// @param buf the data buffer
|
||||
@@ -300,6 +308,8 @@ public:
|
||||
#endif /* NETCON_ACCESSCONTROL */
|
||||
}
|
||||
~NetconServLis();
|
||||
NetconServLis(const NetconServLis&) = delete;
|
||||
NetconServLis& operator=(const NetconServLis&) = delete;
|
||||
/// Open named service. Used absolute pathname to create an
|
||||
/// AF_UNIX path-based socket instead of an IP one.
|
||||
int openservice(const char *serv, int backlog = 10);
|
||||
|
||||
@@ -138,6 +138,8 @@ class PathDirContents {
|
||||
public:
|
||||
PathDirContents(const std::string& dirpath);
|
||||
~PathDirContents();
|
||||
PathDirContents(const PathDirContents&) = delete;
|
||||
PathDirContents& operator=(const PathDirContents&) = delete;
|
||||
|
||||
bool opendir();
|
||||
struct Entry {
|
||||
@@ -233,6 +235,9 @@ class Pidfile {
|
||||
public:
|
||||
Pidfile(const std::string& path) : m_path(path), m_fd(-1) {}
|
||||
~Pidfile();
|
||||
Pidfile(const Pidfile&) = delete;
|
||||
Pidfile& operator=(const Pidfile&) = delete;
|
||||
|
||||
/// Open/create the pid file.
|
||||
/// @return 0 if ok, > 0 for pid of existing process, -1 for other error.
|
||||
int open();
|
||||
|
||||
@@ -72,6 +72,8 @@ public:
|
||||
: m_in(input), m_pos(0) {}
|
||||
|
||||
virtual ~PicoXMLParser() {}
|
||||
PicoXMLParser(const PicoXMLParser&) = delete;
|
||||
PicoXMLParser& operator=(const PicoXMLParser&) = delete;
|
||||
|
||||
virtual bool parse() {
|
||||
return _parse();
|
||||
|
||||
+2
-4
@@ -88,6 +88,8 @@ class TempDir {
|
||||
public:
|
||||
TempDir();
|
||||
~TempDir();
|
||||
TempDir(const TempDir&) = delete;
|
||||
TempDir& operator=(const TempDir&) = delete;
|
||||
const char *dirname() {
|
||||
return m_dirname.c_str();
|
||||
}
|
||||
@@ -102,10 +104,6 @@ public:
|
||||
private:
|
||||
std::string m_dirname;
|
||||
std::string m_reason;
|
||||
TempDir(const TempDir&) {}
|
||||
TempDir& operator=(const TempDir&) {
|
||||
return *this;
|
||||
};
|
||||
};
|
||||
|
||||
// Freedesktop thumbnail standard path routine
|
||||
|
||||
@@ -26,7 +26,10 @@ class FileScanUpstream;
|
||||
/** Data sink for the file reader. */
|
||||
class FileScanDo {
|
||||
public:
|
||||
FileScanDo() {}
|
||||
virtual ~FileScanDo() {}
|
||||
FileScanDo(const FileScanDo&) = delete;
|
||||
FileScanDo& operator=(const FileScanDo&) = delete;
|
||||
/* Initialize and allocate.
|
||||
* @param size if set, lower bound of data size.
|
||||
* @param reason[output] set to error message in case of error.
|
||||
|
||||
@@ -227,6 +227,8 @@ public:
|
||||
/// @param nmatch must be >= the number of parenthesed subexp in exp
|
||||
SimpleRegexp(const std::string& exp, int flags, int nmatch = 0);
|
||||
~SimpleRegexp();
|
||||
SimpleRegexp(const SimpleRegexp&) = delete;
|
||||
SimpleRegexp& operator=(const SimpleRegexp&) = delete;
|
||||
/// Match input against exp, return true if matches
|
||||
bool simpleMatch(const std::string& val) const;
|
||||
/// After simpleMatch success, get nth submatch, 0 is the whole
|
||||
|
||||
@@ -51,21 +51,21 @@ string::size_type StrWildMatcher::baseprefixlen() const
|
||||
|
||||
StrRegexpMatcher::StrRegexpMatcher(const string& exp)
|
||||
: StrMatcher(exp),
|
||||
m_re(exp, SimpleRegexp::SRE_NOSUB)
|
||||
m_re(new SimpleRegexp(exp, SimpleRegexp::SRE_NOSUB))
|
||||
{
|
||||
}
|
||||
|
||||
bool StrRegexpMatcher::setExp(const string& exp)
|
||||
{
|
||||
m_re = SimpleRegexp(exp, SimpleRegexp::SRE_NOSUB);
|
||||
return m_re.ok();
|
||||
m_re = std::unique_ptr<SimpleRegexp>(new SimpleRegexp(exp, SimpleRegexp::SRE_NOSUB));
|
||||
return ok();
|
||||
}
|
||||
|
||||
bool StrRegexpMatcher::match(const string& val) const
|
||||
{
|
||||
if (!m_re.ok())
|
||||
if (ok())
|
||||
return false;
|
||||
return m_re(val);
|
||||
return (*m_re)(val);
|
||||
}
|
||||
|
||||
string::size_type StrRegexpMatcher::baseprefixlen() const
|
||||
@@ -75,5 +75,5 @@ string::size_type StrRegexpMatcher::baseprefixlen() const
|
||||
|
||||
bool StrRegexpMatcher::ok() const
|
||||
{
|
||||
return m_re.ok();
|
||||
return m_re && m_re->ok();
|
||||
}
|
||||
|
||||
+16
-8
@@ -18,6 +18,8 @@
|
||||
#define _STRMATCHER_H_INCLUDED_
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "smallut.h"
|
||||
|
||||
// Encapsulating simple wildcard/regexp string matching.
|
||||
@@ -28,21 +30,23 @@ public:
|
||||
StrMatcher(const std::string& exp)
|
||||
: m_sexp(exp) {}
|
||||
virtual ~StrMatcher() {};
|
||||
StrMatcher(const StrMatcher&) = delete;
|
||||
StrMatcher& operator=(const StrMatcher&) = delete;
|
||||
virtual bool match(const std::string &val) const = 0;
|
||||
virtual std::string::size_type baseprefixlen() const = 0;
|
||||
virtual bool setExp(const std::string& newexp) {
|
||||
m_sexp = newexp;
|
||||
return true;
|
||||
m_sexp = newexp;
|
||||
return true;
|
||||
}
|
||||
virtual bool ok() const {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
virtual const std::string& exp() const {
|
||||
return m_sexp;
|
||||
return m_sexp;
|
||||
}
|
||||
virtual StrMatcher *clone() const = 0;
|
||||
const std::string& getreason() const {
|
||||
return m_reason;
|
||||
return m_reason;
|
||||
}
|
||||
protected:
|
||||
std::string m_sexp;
|
||||
@@ -54,10 +58,12 @@ public:
|
||||
StrWildMatcher(const std::string& exp)
|
||||
: StrMatcher(exp) {}
|
||||
virtual ~StrWildMatcher() {}
|
||||
StrWildMatcher(const StrWildMatcher&) = delete;
|
||||
StrWildMatcher& operator=(const StrWildMatcher&) = delete;
|
||||
virtual bool match(const std::string& val) const override;
|
||||
virtual std::string::size_type baseprefixlen() const override;
|
||||
virtual StrWildMatcher *clone() const override {
|
||||
return new StrWildMatcher(m_sexp);
|
||||
return new StrWildMatcher(m_sexp);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -66,14 +72,16 @@ public:
|
||||
StrRegexpMatcher(const std::string& exp);
|
||||
virtual bool setExp(const std::string& newexp) override;
|
||||
virtual ~StrRegexpMatcher() {};
|
||||
StrRegexpMatcher(const StrRegexpMatcher&) = delete;
|
||||
StrRegexpMatcher& operator=(const StrRegexpMatcher&) = delete;
|
||||
virtual bool match(const std::string& val) const override;
|
||||
virtual std::string::size_type baseprefixlen() const override;
|
||||
virtual bool ok() const override;
|
||||
virtual StrRegexpMatcher *clone() const override {
|
||||
return new StrRegexpMatcher(m_sexp);
|
||||
return new StrRegexpMatcher(m_sexp);
|
||||
}
|
||||
private:
|
||||
SimpleRegexp m_re;
|
||||
std::unique_ptr<SimpleRegexp> m_re;
|
||||
};
|
||||
|
||||
#endif /* _STRMATCHER_H_INCLUDED_ */
|
||||
|
||||
@@ -71,6 +71,8 @@ public:
|
||||
setTerminateAndWait();
|
||||
}
|
||||
}
|
||||
WorkQueue(const WorkQueue&) = delete;
|
||||
WorkQueue& operator=(const WorkQueue&) = delete;
|
||||
|
||||
/** Task deleter
|
||||
* If put() is called with the flush option, and the tasks allocate memory,
|
||||
|
||||
@@ -7,6 +7,9 @@ class ZLibUtBuf {
|
||||
public:
|
||||
ZLibUtBuf();
|
||||
~ZLibUtBuf();
|
||||
ZLibUtBuf(const ZLibUtBuf&) = delete;
|
||||
ZLibUtBuf& operator=(const ZLibUtBuf&) = delete;
|
||||
|
||||
char *getBuf() const;
|
||||
char *takeBuf();
|
||||
size_t getCnt();
|
||||
|
||||
Reference in New Issue
Block a user