summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'SwifTools')
-rw-r--r--SwifTools/Application/CocoaApplication.h6
-rw-r--r--SwifTools/Application/CocoaApplication.mm10
-rw-r--r--SwifTools/AutoUpdater/SparkleAutoUpdater.h3
-rw-r--r--SwifTools/AutoUpdater/SparkleAutoUpdater.mm5
-rw-r--r--SwifTools/Notifier/GrowlNotifier.h4
-rw-r--r--SwifTools/Notifier/GrowlNotifier.mm3
-rw-r--r--SwifTools/Notifier/NotificationCenterNotifier.h3
-rw-r--r--SwifTools/Notifier/NotificationCenterNotifier.mm3
-rw-r--r--SwifTools/URIHandler/MacOSXURIHandler.h6
-rw-r--r--SwifTools/URIHandler/MacOSXURIHandler.mm4
10 files changed, 26 insertions, 21 deletions
diff --git a/SwifTools/Application/CocoaApplication.h b/SwifTools/Application/CocoaApplication.h
index a3e281c..4b366c6 100644
--- a/SwifTools/Application/CocoaApplication.h
+++ b/SwifTools/Application/CocoaApplication.h
@@ -1,11 +1,13 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
+#include <memory>
+
namespace Swift {
class CocoaApplication {
public:
@@ -14,6 +16,6 @@ namespace Swift {
private:
class Private;
- Private* d;
+ const std::unique_ptr<Private> d;
};
}
diff --git a/SwifTools/Application/CocoaApplication.mm b/SwifTools/Application/CocoaApplication.mm
index f879014..f058ed4 100644
--- a/SwifTools/Application/CocoaApplication.mm
+++ b/SwifTools/Application/CocoaApplication.mm
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2010-2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include <SwifTools/Application/CocoaApplication.h>
#include <AppKit/AppKit.h>
@@ -10,15 +16,13 @@ class CocoaApplication::Private {
NSAutoreleasePool* autoReleasePool_;
};
-CocoaApplication::CocoaApplication() {
- d = new CocoaApplication::Private();
+CocoaApplication::CocoaApplication() : d(new Private()) {
NSApplicationLoad();
d->autoReleasePool_ = [[NSAutoreleasePool alloc] init];
}
CocoaApplication::~CocoaApplication() {
[d->autoReleasePool_ release];
- delete d;
}
}
diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.h b/SwifTools/AutoUpdater/SparkleAutoUpdater.h
index c3394f7..1242128 100644
--- a/SwifTools/AutoUpdater/SparkleAutoUpdater.h
+++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.h
@@ -6,6 +6,7 @@
#pragma once
+#include <memory>
#include <string>
#include <SwifTools/AutoUpdater/AutoUpdater.h>
@@ -27,6 +28,6 @@ namespace Swift {
private:
class Private;
- Private* d;
+ const unique_ptr<Private> d;
};
}
diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
index 7e06b2f..76de34b 100644
--- a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
+++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
@@ -21,9 +21,7 @@ class SparkleAutoUpdater::Private {
bool restartToUpdate = false;
};
-SparkleAutoUpdater::SparkleAutoUpdater(const std::string& url) {
- d = new Private;
-
+SparkleAutoUpdater::SparkleAutoUpdater(const std::string& url) : d(new Private()) {
d->updater = [SUUpdater sharedUpdater];
[d->updater retain];
@@ -45,7 +43,6 @@ SparkleAutoUpdater::SparkleAutoUpdater(const std::string& url) {
SparkleAutoUpdater::~SparkleAutoUpdater() {
[d->updater release];
- delete d;
SWIFT_LOG(warning) << std::endl;
}
diff --git a/SwifTools/Notifier/GrowlNotifier.h b/SwifTools/Notifier/GrowlNotifier.h
index cbfe3e9..1b5f191 100644
--- a/SwifTools/Notifier/GrowlNotifier.h
+++ b/SwifTools/Notifier/GrowlNotifier.h
@@ -6,6 +6,8 @@
#pragma once
+#include <memory>
+
#include <boost/filesystem/fstream.hpp>
#include <SwifTools/Notifier/Notifier.h>
@@ -36,6 +38,6 @@ namespace Swift {
private:
class Private;
- std::shared_ptr<Private> p;
+ const std::unique_ptr<Private> p;
};
}
diff --git a/SwifTools/Notifier/GrowlNotifier.mm b/SwifTools/Notifier/GrowlNotifier.mm
index 1356805..4ca53f7 100644
--- a/SwifTools/Notifier/GrowlNotifier.mm
+++ b/SwifTools/Notifier/GrowlNotifier.mm
@@ -32,8 +32,7 @@ class GrowlNotifier::Private {
boost::intrusive_ptr<GrowlNotifierDelegate> delegate;
};
-GrowlNotifier::GrowlNotifier(const std::string& name) {
- p = std::make_shared<Private>();
+GrowlNotifier::GrowlNotifier(const std::string& name) : p(new Private()){
p->delegate = boost::intrusive_ptr<GrowlNotifierDelegate>([[GrowlNotifierDelegate alloc] init], false);
p->delegate.get().notifier = this;
p->delegate.get().name = std2NSString(name);
diff --git a/SwifTools/Notifier/NotificationCenterNotifier.h b/SwifTools/Notifier/NotificationCenterNotifier.h
index 19eb944..838971c 100644
--- a/SwifTools/Notifier/NotificationCenterNotifier.h
+++ b/SwifTools/Notifier/NotificationCenterNotifier.h
@@ -6,6 +6,7 @@
#pragma once
+#include <memory>
#include <string>
#include <SwifTools/Notifier/Notifier.h>
@@ -32,7 +33,7 @@ public:
private:
class Private;
- std::shared_ptr<Private> p;
+ const std::unique_ptr<Private> p;
};
}
diff --git a/SwifTools/Notifier/NotificationCenterNotifier.mm b/SwifTools/Notifier/NotificationCenterNotifier.mm
index 35c740a..1538186 100644
--- a/SwifTools/Notifier/NotificationCenterNotifier.mm
+++ b/SwifTools/Notifier/NotificationCenterNotifier.mm
@@ -39,8 +39,7 @@ class NotificationCenterNotifier::Private {
boost::intrusive_ptr<NotificationCenterNotifierDelegate> delegate;
};
-NotificationCenterNotifier::NotificationCenterNotifier() {
- p = std::make_shared<Private>();
+NotificationCenterNotifier::NotificationCenterNotifier() : p(new Private()) {
p->delegate = boost::intrusive_ptr<NotificationCenterNotifierDelegate>([[NotificationCenterNotifierDelegate alloc] init], false);
[p->delegate.get() setNotifier: this];
diff --git a/SwifTools/URIHandler/MacOSXURIHandler.h b/SwifTools/URIHandler/MacOSXURIHandler.h
index afa4c6c..8136fa7 100644
--- a/SwifTools/URIHandler/MacOSXURIHandler.h
+++ b/SwifTools/URIHandler/MacOSXURIHandler.h
@@ -1,11 +1,13 @@
/*
- * Copyright (c) 2011 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
+#include <memory>
+
#include <SwifTools/URIHandler/URIHandler.h>
namespace Swift {
@@ -19,6 +21,6 @@ namespace Swift {
private:
class Private;
- Private* p;
+ const std::unique_ptr<Private> p;
};
}
diff --git a/SwifTools/URIHandler/MacOSXURIHandler.mm b/SwifTools/URIHandler/MacOSXURIHandler.mm
index 6285e12..ae7dc44 100644
--- a/SwifTools/URIHandler/MacOSXURIHandler.mm
+++ b/SwifTools/URIHandler/MacOSXURIHandler.mm
@@ -44,14 +44,12 @@ class MacOSXURIHandler::Private {
MacOSXURIEventHandler* eventHandler;
};
-MacOSXURIHandler::MacOSXURIHandler() {
- p = new Private();
+MacOSXURIHandler::MacOSXURIHandler() : p(new Private()) {
p->eventHandler = [[MacOSXURIEventHandler alloc] initWithHandler: this];
}
MacOSXURIHandler::~MacOSXURIHandler() {
[p->eventHandler release];
- delete p;
}
void MacOSXURIHandler::start() {