summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-12-23 22:35:52 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-12-23 22:43:52 (GMT)
commit5862dcdf8dc6e1bb160693ad6a5ca0609ddb990a (patch)
tree0f999c987daef5468eae9e2b8e7cd6ddf3c2c110 /SwifTools/Cocoa/CocoaUtil.h
parent732253a9b3e88b99b36dd3298157cf502f743294 (diff)
downloadswift-contrib-5862dcdf8dc6e1bb160693ad6a5ca0609ddb990a.zip
swift-contrib-5862dcdf8dc6e1bb160693ad6a5ca0609ddb990a.tar.bz2
Updated Growl notifier to work against Growl 1.3.
Diffstat (limited to 'SwifTools/Cocoa/CocoaUtil.h')
-rw-r--r--SwifTools/Cocoa/CocoaUtil.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/SwifTools/Cocoa/CocoaUtil.h b/SwifTools/Cocoa/CocoaUtil.h
new file mode 100644
index 0000000..55fc325
--- /dev/null
+++ b/SwifTools/Cocoa/CocoaUtil.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+// Conversion utilities
+#define NS2STDSTRING(a) (a == nil ? std::string() : std::string([a cStringUsingEncoding:NSUTF8StringEncoding]))
+#define STD2NSSTRING(a) [NSString stringWithCString:a.c_str() encoding:NSUTF8StringEncoding]
+
+// Intrusive pointer for NSObjects
+#include <boost/intrusive_ptr.hpp>
+
+namespace boost {
+ inline void intrusive_ptr_add_ref(NSObject* object) {
+ [object retain];
+ }
+
+ inline void intrusive_ptr_release(NSObject* object) {
+ [object release];
+ }
+}