Skip to content

Instantly share code, notes, and snippets.

@Cellane
Created February 24, 2014 19:57
Show Gist options
  • Save Cellane/9195782 to your computer and use it in GitHub Desktop.
Save Cellane/9195782 to your computer and use it in GitHub Desktop.
//
// NSArray+MCO.cpp
// mailcore2
//
// Created by DINH Viêt Hoà on 1/29/13.
// Copyright (c) 2013 MailCore. All rights reserved.
//
#import "NSArray+MCO.h"
#include "MCBaseTypes.h"
#import "NSObject+MCO.h"
@implementation NSArray (MCO)
+ (id) mco_objectWithMCObject:(mailcore::Object *)object
{
return [self mco_arrayWithMCArray:(mailcore::Array *) object];
}
+ (NSArray *) mco_arrayWithMCArray:(mailcore::Array *)array
{
NSMutableArray * result = [NSMutableArray array];
for(unsigned int i = 0 ; i < array->count() ; i ++) {
[result addObject:[NSObject mco_objectWithMCObject:array->objectAtIndex(i)]];
}
return result;
}
- (mailcore::Array *) mco_mcArray
{
mailcore::Array * result = mailcore::Array::array();
for(NSObject * value in self) {
result->addObject([value mco_mcObject]);
}
return result;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment