blob: daea94c924201fd2a7935fa1860825eeb4ee7b86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
//
// 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"
#include "MCData.h"
@implementation NSData (MCO)
+ (id) mco_objectWithMCObject:(mailcore::Object *)object
{
return [self mco_dataWithMCData:(mailcore::Data *) object];
}
+ (NSData *) mco_dataWithMCData:(mailcore::Data *)cppData
{
if (cppData == NULL)
return nil;
return [NSData dataWithBytes:cppData->bytes() length:cppData->length()];
}
- (mailcore::Data *) mco_mcData
{
return mailcore::Data::dataWithBytes((const char *) [self bytes], (unsigned int) [self length]);
}
@end
|