aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc
diff options
context:
space:
mode:
authorGravatar DINH Viet Hoa <hoa@sprw.me>2013-01-21 15:18:09 -0800
committerGravatar DINH Viet Hoa <hoa@sprw.me>2013-01-21 15:18:09 -0800
commit8a948953484e29ee7f17e3dd90fee352d66373eb (patch)
treec0c16d3512a3da15192a5e778b4955c792c742e4 /src/objc
parent119b654d35db873bb7dbc77e24649462eb1aa4e6 (diff)
foundation additions
Diffstat (limited to 'src/objc')
-rw-r--r--src/objc/utils/NSData+MCO.h19
-rw-r--r--src/objc/utils/NSData+MCO.mm18
-rw-r--r--src/objc/utils/NSString+MCO.h19
-rw-r--r--src/objc/utils/NSString+MCO.mm18
4 files changed, 74 insertions, 0 deletions
diff --git a/src/objc/utils/NSData+MCO.h b/src/objc/utils/NSData+MCO.h
new file mode 100644
index 00000000..18da1492
--- /dev/null
+++ b/src/objc/utils/NSData+MCO.h
@@ -0,0 +1,19 @@
+//
+// NSData+MCO.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/21/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#include <mailcore/mailcore.h>
+
+@interface NSData (MCO)
+
+#ifdef __cplusplus
++ (NSData *) mco_dataWithMCData:(mailcore::Data *)cppData;
+#endif
+
+@end
diff --git a/src/objc/utils/NSData+MCO.mm b/src/objc/utils/NSData+MCO.mm
new file mode 100644
index 00000000..10c63f7e
--- /dev/null
+++ b/src/objc/utils/NSData+MCO.mm
@@ -0,0 +1,18 @@
+//
+// NSData+MCO.m
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/21/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "NSData+MCO.h"
+
+@implementation NSData (MCO)
+
++ (NSData *) mco_dataWithMCData:(mailcore::Data *)cppData
+{
+ return [NSData dataWithBytes:cppData->bytes() length:cppData->length()];
+}
+
+@end
diff --git a/src/objc/utils/NSString+MCO.h b/src/objc/utils/NSString+MCO.h
new file mode 100644
index 00000000..087f5220
--- /dev/null
+++ b/src/objc/utils/NSString+MCO.h
@@ -0,0 +1,19 @@
+//
+// NSString+MCO.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/21/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#include <mailcore/mailcore.h>
+
+@interface NSString (MCO)
+
+#ifdef __cplusplus
++ (NSString *) mco_stringWithMCString:(mailcore::String *)cppString;
+#endif
+
+@end
diff --git a/src/objc/utils/NSString+MCO.mm b/src/objc/utils/NSString+MCO.mm
new file mode 100644
index 00000000..9ef0cf06
--- /dev/null
+++ b/src/objc/utils/NSString+MCO.mm
@@ -0,0 +1,18 @@
+//
+// NSString+MCO.m
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/21/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "NSString+MCO.h"
+
+@implementation NSString (MCO)
+
++ (NSString *) mco_stringWithMCString:(mailcore::String *)cppString
+{
+ return [NSString stringWithCharacters:(const unichar *) cppString->unicodeCharacters() length:cppString->length()];
+}
+
+@end