From 8a948953484e29ee7f17e3dd90fee352d66373eb Mon Sep 17 00:00:00 2001 From: DINH Viet Hoa Date: Mon, 21 Jan 2013 15:18:09 -0800 Subject: foundation additions --- src/objc/utils/NSData+MCO.h | 19 +++++++++++++++++++ src/objc/utils/NSData+MCO.mm | 18 ++++++++++++++++++ src/objc/utils/NSString+MCO.h | 19 +++++++++++++++++++ src/objc/utils/NSString+MCO.mm | 18 ++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 src/objc/utils/NSData+MCO.h create mode 100644 src/objc/utils/NSData+MCO.mm create mode 100644 src/objc/utils/NSString+MCO.h create mode 100644 src/objc/utils/NSString+MCO.mm (limited to 'src/objc') 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 + +#include + +@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 + +#include + +@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 -- cgit v1.2.3