summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2013-01-22 00:32:13 -0800
committerPixel <pixel@nobis-crew.org>2013-01-22 00:32:13 -0800
commit107d87dc983f34e4ff23a4db188baa650ac51f98 (patch)
tree9721dc97d9c2777ab35c3d22909a8fc8e5df92eb /includes
parent6f280f3680e9fad24e00dd63a55577c5409945b3 (diff)
Cleaning up some cruft.
Diffstat (limited to 'includes')
-rw-r--r--includes/Async.h10
-rw-r--r--includes/AtStartExit.h4
-rw-r--r--includes/BRegex.h8
3 files changed, 21 insertions, 1 deletions
diff --git a/includes/Async.h b/includes/Async.h
index 15e0ac7..6c67546 100644
--- a/includes/Async.h
+++ b/includes/Async.h
@@ -14,6 +14,7 @@ typedef void (*IdleReadyCallback_t)(void *);
class AsyncOperation {
protected:
+ AsyncOperation() { }
virtual void run() { }
virtual void finish() { }
virtual void done() { }
@@ -27,6 +28,8 @@ class AsyncOperation {
IdleReadyCallback_t m_idleReadyCallback = NULL;
void * m_idleReadyParam = NULL;
void finalize();
+ AsyncOperation(const AsyncOperation &) = delete;
+ AsyncOperation & operator=(const AsyncOperation &) = delete;
friend class AsyncManager;
friend class AsyncFinishWorker;
@@ -35,6 +38,10 @@ class AsyncOperation {
class AsyncFinishWorker : public Thread {
public:
AsyncFinishWorker(AsyncManager * async, Queue<AsyncOperation> * queue) : m_async(async), m_queue(queue) { }
+ bool stopped() { return m_stopped; }
+ private:
+ AsyncFinishWorker(const AsyncFinishWorker &) = delete;
+ AsyncOperation & operator=(const AsyncFinishWorker &) = delete;
virtual void * proc();
AsyncManager * m_async;
Queue<AsyncOperation> * m_queue;
@@ -44,6 +51,7 @@ class AsyncFinishWorker : public Thread {
class AsyncManager : public Thread {
public:
+ AsyncManager() { }
void setFinishers(int minIdle, int maxIdle) {
AAssert(minIdle < maxIdle, "Minimum number of threads needs to be less than maximum number of threads.");
m_minIdle = minIdle;
@@ -58,6 +66,8 @@ class AsyncManager : public Thread {
virtual void threadExit();
private:
+ AsyncManager(const AsyncManager &) = delete;
+ AsyncManager & operator=(const AsyncManager &) = delete;
void checkIdle();
void killOneFinisher();
void startOneFinisher();
diff --git a/includes/AtStartExit.h b/includes/AtStartExit.h
index 9b55d93..97dc533 100644
--- a/includes/AtStartExit.h
+++ b/includes/AtStartExit.h
@@ -7,6 +7,8 @@ class AtStart {
AtStart(int priority = 0);
virtual void doStart() = 0;
private:
+ AtStart(const AtStart &) = delete;
+ AtStart & operator=(const AtStart &) = delete;
const int m_priority;
AtStart * m_next;
static AtStart * s_head;
@@ -18,6 +20,8 @@ class AtExit {
AtExit(int priority = 0);
virtual void doExit() = 0;
private:
+ AtExit(const AtExit &) = delete;
+ AtExit & operator=(const AtExit &) = delete;
const int m_priority;
AtExit * m_next;
static AtExit * s_head;
diff --git a/includes/BRegex.h b/includes/BRegex.h
index 4a2f207..9b030bc 100644
--- a/includes/BRegex.h
+++ b/includes/BRegex.h
@@ -11,12 +11,18 @@ namespace Balau {
class Regex {
public:
typedef std::vector<String> Captures;
+ Regex(const String & regex, bool icase = false) : Regex(regex.to_charp(), icase) { }
+ Regex(const Regex & regex) : Regex(regex.m_regexStr, regex.m_icase) { }
+ Regex(Regex && regex) { regex.m_moved = true; m_regex = regex.m_regex; }
Regex(const char * regex, bool icase = false) throw (GeneralException);
- ~Regex();
+ ~Regex() { if (!m_moved) regfree(&m_regex); }
Captures match(const char * str) const throw (GeneralException);
private:
+ Regex & operator=(const Regex &) = delete;
String getError(int err) const;
+ String m_regexStr;
regex_t m_regex;
+ bool m_icase, m_moved = false;
};
class Regexes {