Commit aec43dad authored by Miro Knejp's avatar Miro Knejp Committed by Jacob Potter

Extract primitive translation into a predefined support lib helper class

parent 051a36f8
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
- (id)initWithItemList:(TXSItemList *)itemList; - (id)initWithItemList:(TXSItemList *)itemList;
- (id)initWithItems:(NSArray *)items; - (id)initWithItems:(NSArray *)items;
@property (nonatomic, readonly) NSArray *items; @property (nonatomic, readonly) NSArray * items;
@end @end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "TXSItemList+Private.h" #import "TXSItemList+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
......
...@@ -43,6 +43,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) { ...@@ -43,6 +43,7 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
tm.base match { tm.base match {
case o: MOpaque => case o: MOpaque =>
header.add("#import <Foundation/Foundation.h>") header.add("#import <Foundation/Foundation.h>")
body.add("#import " + q(spec.objcBaseLibIncludePrefix + "DJIMarshal+Private.h"))
case d: MDef => d.defType match { case d: MDef => d.defType match {
case DEnum => case DEnum =>
body.add("#import " + q(spec.objcIncludePrefix + headerName(d.name))) body.add("#import " + q(spec.objcIncludePrefix + headerName(d.name)))
...@@ -652,20 +653,15 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) { ...@@ -652,20 +653,15 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
} }
case o => o match { case o => o match {
case p: MPrimitive => case p: MPrimitive =>
if (needRef) val boxed = if(needRef) "::Boxed" else ""
p.idlName match { p.idlName match {
case "i8" => w.wl(s"$objcType$objcIdent = [NSNumber numberWithChar:$cppIdent];") case "i8" => w.wl(s"$objcType$objcIdent = ::djinni::I8$boxed::fromCpp($cppIdent);")
case "i16" => w.wl(s"$objcType$objcIdent = [NSNumber numberWithShort:$cppIdent];") case "i16" => w.wl(s"$objcType$objcIdent = ::djinni::I16$boxed::fromCpp($cppIdent);")
case "i32" => w.wl(s"$objcType$objcIdent = [NSNumber numberWithInt:$cppIdent];") case "i32" => w.wl(s"$objcType$objcIdent = ::djinni::I32$boxed::fromCpp($cppIdent);")
case "i64" => w.wl(s"$objcType$objcIdent = [NSNumber numberWithLongLong:$cppIdent];") case "i64" => w.wl(s"$objcType$objcIdent = ::djinni::I64$boxed::fromCpp($cppIdent);")
case "f64" => w.wl(s"$objcType$objcIdent = [NSNumber numberWithDouble:$cppIdent];") case "f64" => w.wl(s"$objcType$objcIdent = ::djinni::F64$boxed::fromCpp($cppIdent);")
case "bool" => w.wl(s"$objcType$objcIdent = [NSNumber numberWithBool:(($cppIdent) ? YES : NO)];") case "bool" => w.wl(s"$objcType$objcIdent = ::djinni::Bool$boxed::fromCpp($cppIdent);")
} }
else
p.idlName match {
case "bool" => w.wl(s"$objcType$objcIdent = ($cppIdent) ? YES : NO;")
case _ => w.wl(s"$objcType$objcIdent = $cppIdent;")
}
case MString => w.wl(s"$objcType$objcIdent = [[NSString alloc] initWithBytes:$cppIdent.data()").nestedN(2) { case MString => w.wl(s"$objcType$objcIdent = [[NSString alloc] initWithBytes:$cppIdent.data()").nestedN(2) {
w.wl(s"length:$cppIdent.length()") w.wl(s"length:$cppIdent.length()")
w.wl("encoding:NSUTF8StringEncoding];") w.wl("encoding:NSUTF8StringEncoding];")
...@@ -771,17 +767,15 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) { ...@@ -771,17 +767,15 @@ class ObjcppGenerator(spec: Spec) extends Generator(spec) {
} }
case o => o match { case o => o match {
case p: MPrimitive => case p: MPrimitive =>
if (needRef) val boxed = if(needRef) "::Boxed" else ""
p.idlName match { p.idlName match {
case "i8" => w.wl(s"$cppType $cppIdent = [$objcIdent charValue];") case "i8" => w.wl(s"$cppType $cppIdent = ::djinni::I8$boxed::toCpp($objcIdent);")
case "i16" => w.wl(s"$cppType $cppIdent = [$objcIdent shortValue];") case "i16" => w.wl(s"$cppType $cppIdent = ::djinni::I16$boxed::toCpp($objcIdent);")
case "i32" => w.wl(s"$cppType $cppIdent = [$objcIdent intValue];") case "i32" => w.wl(s"$cppType $cppIdent = ::djinni::I32$boxed::toCpp($objcIdent);")
case "i64" => w.wl(s"$cppType $cppIdent = [$objcIdent longLongValue];") case "i64" => w.wl(s"$cppType $cppIdent = ::djinni::I64$boxed::toCpp($objcIdent);")
case "f64" => w.wl(s"$cppType $cppIdent = [$objcIdent doubleValue];") case "f64" => w.wl(s"$cppType $cppIdent = ::djinni::F64$boxed::toCpp($objcIdent);")
case "bool" => w.wl(s"$cppType $cppIdent = [$objcIdent boolValue];") case "bool" => w.wl(s"$cppType $cppIdent = ::djinni::Bool$boxed::toCpp($objcIdent);")
} }
else
w.wl(s"$cppType $cppIdent = $objcIdent;")
case MString => w.wl(s"$cppType $cppIdent([$objcIdent UTF8String], [$objcIdent lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);") case MString => w.wl(s"$cppType $cppIdent([$objcIdent UTF8String], [$objcIdent lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);")
case MDate => w.wl(s"$cppType $cppIdent = ::djinni::convert_date([$objcIdent timeIntervalSince1970]);") case MDate => w.wl(s"$cppType $cppIdent = ::djinni::convert_date([$objcIdent timeIntervalSince1970]);")
case MBinary => case MBinary =>
......
//
// DJIMarshal+Private.h
// Djinni
//
// Created by knejp on 20.3.15.
// Copyright (c) 2015 Dropbox. All rights reserved.
//
#pragma once
#import <Foundation/Foundation.h>
#include <cstdint>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
namespace djinni {
struct Bool {
using CppType = bool;
using ObjcType = BOOL;
static CppType toCpp(ObjcType x) noexcept { return x ? true : false; }
static ObjcType fromCpp(CppType x) noexcept { return x ? YES : NO; }
struct Boxed {
using ObjcType = NSNumber*;
static CppType toCpp(ObjcType x) noexcept { return [x boolValue] ? true : false; }
static ObjcType fromCpp(CppType x) noexcept { return [NSNumber numberWithChar:x ? YES : NO]; }
};
};
template<class T>
struct Primitive {
using CppType = T;
using ObjcType = T;
static CppType toCpp(ObjcType x) noexcept { return x; }
static ObjcType fromCpp(CppType x) noexcept { return x; }
};
struct I8 : public Primitive<int8_t> {
struct Boxed {
using ObjcType = NSNumber*;
static CppType toCpp(ObjcType x) noexcept { return [x charValue]; }
static ObjcType fromCpp(CppType x) noexcept { return [NSNumber numberWithChar:x]; }
};
};
struct I16 : public Primitive<int16_t> {
struct Boxed {
using ObjcType = NSNumber*;
static CppType toCpp(ObjcType x) noexcept { return [x shortValue]; }
static ObjcType fromCpp(CppType x) noexcept { return [NSNumber numberWithShort:x]; }
};
};
struct I32 : public Primitive<int32_t> {
struct Boxed {
using ObjcType = NSNumber*;
static CppType toCpp(ObjcType x) noexcept { return [x intValue]; }
static ObjcType fromCpp(CppType x) noexcept { return [NSNumber numberWithInt:x]; }
};
};
struct I64 : public Primitive<int64_t> {
struct Boxed {
using ObjcType = NSNumber*;
static CppType toCpp(ObjcType x) noexcept { return [x longLongValue]; }
static ObjcType fromCpp(CppType x) noexcept { return [NSNumber numberWithLongLong:x]; }
};
};
struct F64 : public Primitive<double> {
struct Boxed {
using ObjcType = NSNumber*;
static CppType toCpp(ObjcType x) noexcept { return [x doubleValue]; }
static ObjcType fromCpp(CppType x) noexcept { return [NSNumber numberWithDouble:x]; }
};
};
} // namespace djinni
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
@property (nonatomic, readonly) int64_t sixtyfour; @property (nonatomic, readonly) int64_t sixtyfour;
@property (nonatomic, readonly) NSNumber *oEight; @property (nonatomic, readonly) NSNumber * oEight;
@property (nonatomic, readonly) NSNumber *oSixteen; @property (nonatomic, readonly) NSNumber * oSixteen;
@property (nonatomic, readonly) NSNumber *oThirtytwo; @property (nonatomic, readonly) NSNumber * oThirtytwo;
@property (nonatomic, readonly) NSNumber *oSixtyfour; @property (nonatomic, readonly) NSNumber * oSixtyfour;
@end @end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "DBAssortedIntegers+Private.h" #import "DBAssortedIntegers+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -60,27 +61,27 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -60,27 +61,27 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithCppAssortedIntegers:(const AssortedIntegers &)assortedIntegers - (id)initWithCppAssortedIntegers:(const AssortedIntegers &)assortedIntegers
{ {
if (self = [super init]) { if (self = [super init]) {
_eight = assortedIntegers.eight; _eight = ::djinni::I8::fromCpp(assortedIntegers.eight);
_sixteen = assortedIntegers.sixteen; _sixteen = ::djinni::I16::fromCpp(assortedIntegers.sixteen);
_thirtytwo = assortedIntegers.thirtytwo; _thirtytwo = ::djinni::I32::fromCpp(assortedIntegers.thirtytwo);
_sixtyfour = assortedIntegers.sixtyfour; _sixtyfour = ::djinni::I64::fromCpp(assortedIntegers.sixtyfour);
if (assortedIntegers.o_eight) { if (assortedIntegers.o_eight) {
_oEight = [NSNumber numberWithChar:(*(assortedIntegers.o_eight))]; _oEight = ::djinni::I8::Boxed::fromCpp((*(assortedIntegers.o_eight)));
} else { } else {
_oEight = nil; _oEight = nil;
} }
if (assortedIntegers.o_sixteen) { if (assortedIntegers.o_sixteen) {
_oSixteen = [NSNumber numberWithShort:(*(assortedIntegers.o_sixteen))]; _oSixteen = ::djinni::I16::Boxed::fromCpp((*(assortedIntegers.o_sixteen)));
} else { } else {
_oSixteen = nil; _oSixteen = nil;
} }
if (assortedIntegers.o_thirtytwo) { if (assortedIntegers.o_thirtytwo) {
_oThirtytwo = [NSNumber numberWithInt:(*(assortedIntegers.o_thirtytwo))]; _oThirtytwo = ::djinni::I32::Boxed::fromCpp((*(assortedIntegers.o_thirtytwo)));
} else { } else {
_oThirtytwo = nil; _oThirtytwo = nil;
} }
if (assortedIntegers.o_sixtyfour) { if (assortedIntegers.o_sixtyfour) {
_oSixtyfour = [NSNumber numberWithLongLong:(*(assortedIntegers.o_sixtyfour))]; _oSixtyfour = ::djinni::I64::Boxed::fromCpp((*(assortedIntegers.o_sixtyfour)));
} else { } else {
_oSixtyfour = nil; _oSixtyfour = nil;
} }
...@@ -90,28 +91,28 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -90,28 +91,28 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (AssortedIntegers)cppAssortedIntegers - (AssortedIntegers)cppAssortedIntegers
{ {
int8_t eight = _eight; int8_t eight = ::djinni::I8::toCpp(_eight);
int16_t sixteen = _sixteen; int16_t sixteen = ::djinni::I16::toCpp(_sixteen);
int32_t thirtytwo = _thirtytwo; int32_t thirtytwo = ::djinni::I32::toCpp(_thirtytwo);
int64_t sixtyfour = _sixtyfour; int64_t sixtyfour = ::djinni::I64::toCpp(_sixtyfour);
std::experimental::optional<int8_t> oEight; std::experimental::optional<int8_t> oEight;
if (_oEight != nil) { if (_oEight != nil) {
int8_t optValue = [_oEight charValue]; int8_t optValue = ::djinni::I8::Boxed::toCpp(_oEight);
oEight = optValue; oEight = optValue;
} }
std::experimental::optional<int16_t> oSixteen; std::experimental::optional<int16_t> oSixteen;
if (_oSixteen != nil) { if (_oSixteen != nil) {
int16_t optValue = [_oSixteen shortValue]; int16_t optValue = ::djinni::I16::Boxed::toCpp(_oSixteen);
oSixteen = optValue; oSixteen = optValue;
} }
std::experimental::optional<int32_t> oThirtytwo; std::experimental::optional<int32_t> oThirtytwo;
if (_oThirtytwo != nil) { if (_oThirtytwo != nil) {
int32_t optValue = [_oThirtytwo intValue]; int32_t optValue = ::djinni::I32::Boxed::toCpp(_oThirtytwo);
oThirtytwo = optValue; oThirtytwo = optValue;
} }
std::experimental::optional<int64_t> oSixtyfour; std::experimental::optional<int64_t> oSixtyfour;
if (_oSixtyfour != nil) { if (_oSixtyfour != nil) {
int64_t optValue = [_oSixtyfour longLongValue]; int64_t optValue = ::djinni::I64::Boxed::toCpp(_oSixtyfour);
oSixtyfour = optValue; oSixtyfour = optValue;
} }
return AssortedIntegers( return AssortedIntegers(
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#import "DBClientInterfaceObjcProxy+Private.h" #import "DBClientInterfaceObjcProxy+Private.h"
#import "DBClientInterface.h" #import "DBClientInterface.h"
#import "DBClientReturnedRecord+Private.h" #import "DBClientReturnedRecord+Private.h"
#import "DJIMarshal+Private.h"
#include <vector> #include <vector>
namespace djinni_generated { namespace djinni_generated {
...@@ -26,11 +27,11 @@ std::shared_ptr<ClientInterface> ClientInterfaceObjcProxy::client_interface_with ...@@ -26,11 +27,11 @@ std::shared_ptr<ClientInterface> ClientInterfaceObjcProxy::client_interface_with
ClientReturnedRecord ClientInterfaceObjcProxy::get_record (int64_t record_id, const std::string & utf8string) ClientReturnedRecord ClientInterfaceObjcProxy::get_record (int64_t record_id, const std::string & utf8string)
{ {
@autoreleasepool { @autoreleasepool {
int64_t cpp_record_id = record_id; int64_t cpp_record_id = ::djinni::I64::fromCpp(record_id);
NSString *cpp_utf8string = [[NSString alloc] initWithBytes:utf8string.data() NSString *cpp_utf8string = [[NSString alloc] initWithBytes:utf8string.data()
length:utf8string.length() length:utf8string.length()
encoding:NSUTF8StringEncoding]; encoding:NSUTF8StringEncoding];
DBClientReturnedRecord *objcRet = [_objcRef getRecord:cpp_record_id utf8string:cpp_utf8string]; DBClientReturnedRecord * objcRet = [_objcRef getRecord:cpp_record_id utf8string:cpp_utf8string];
ClientReturnedRecord cppRet = std::move([objcRet cppClientReturnedRecord]); ClientReturnedRecord cppRet = std::move([objcRet cppClientReturnedRecord]);
return cppRet; return cppRet;
} }
......
...@@ -10,6 +10,6 @@ ...@@ -10,6 +10,6 @@
@property (nonatomic, readonly) int64_t recordId; @property (nonatomic, readonly) int64_t recordId;
@property (nonatomic, readonly) NSString *content; @property (nonatomic, readonly) NSString * content;
@end @end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "DBClientReturnedRecord+Private.h" #import "DBClientReturnedRecord+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -32,7 +33,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -32,7 +33,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithCppClientReturnedRecord:(const ClientReturnedRecord &)clientReturnedRecord - (id)initWithCppClientReturnedRecord:(const ClientReturnedRecord &)clientReturnedRecord
{ {
if (self = [super init]) { if (self = [super init]) {
_recordId = clientReturnedRecord.record_id; _recordId = ::djinni::I64::fromCpp(clientReturnedRecord.record_id);
_content = [[NSString alloc] initWithBytes:clientReturnedRecord.content.data() _content = [[NSString alloc] initWithBytes:clientReturnedRecord.content.data()
length:clientReturnedRecord.content.length() length:clientReturnedRecord.content.length()
encoding:NSUTF8StringEncoding]; encoding:NSUTF8StringEncoding];
...@@ -42,7 +43,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -42,7 +43,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (ClientReturnedRecord)cppClientReturnedRecord - (ClientReturnedRecord)cppClientReturnedRecord
{ {
int64_t recordId = _recordId; int64_t recordId = ::djinni::I64::toCpp(_recordId);
std::string content([_content UTF8String], [_content lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); std::string content([_content UTF8String], [_content lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
return ClientReturnedRecord( return ClientReturnedRecord(
std::move(recordId), std::move(recordId),
......
...@@ -20,6 +20,6 @@ extern DBConstants * const DBConstantsObjectConstant; ...@@ -20,6 +20,6 @@ extern DBConstants * const DBConstantsObjectConstant;
@property (nonatomic, readonly) int32_t someInteger; @property (nonatomic, readonly) int32_t someInteger;
@property (nonatomic, readonly) NSString *someString; @property (nonatomic, readonly) NSString * someString;
@end @end
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#import "DBConstants+Private.h" #import "DBConstants+Private.h"
#import "DBConstants+Private.h" #import "DBConstants+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -56,7 +57,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -56,7 +57,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithCppConstants:(const Constants &)constants - (id)initWithCppConstants:(const Constants &)constants
{ {
if (self = [super init]) { if (self = [super init]) {
_someInteger = constants.some_integer; _someInteger = ::djinni::I32::fromCpp(constants.some_integer);
_someString = [[NSString alloc] initWithBytes:constants.some_string.data() _someString = [[NSString alloc] initWithBytes:constants.some_string.data()
length:constants.some_string.length() length:constants.some_string.length()
encoding:NSUTF8StringEncoding]; encoding:NSUTF8StringEncoding];
...@@ -66,7 +67,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -66,7 +67,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (Constants)cppConstants - (Constants)cppConstants
{ {
int32_t someInteger = _someInteger; int32_t someInteger = ::djinni::I32::toCpp(_someInteger);
std::string someString([_someString UTF8String], [_someString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); std::string someString([_someString UTF8String], [_someString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
return Constants( return Constants(
std::move(someInteger), std::move(someInteger),
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#import "DJICppWrapperCache+Private.h" #import "DJICppWrapperCache+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIError.h" #import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception> #include <exception>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -42,7 +43,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -42,7 +43,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (int32_t)throwAnException { - (int32_t)throwAnException {
try { try {
int32_t cppRet = _cppRef->throw_an_exception(); int32_t cppRet = _cppRef->throw_an_exception();
int32_t objcRet = cppRet; int32_t objcRet = ::djinni::I32::fromCpp(cppRet);
return objcRet; return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS() } DJINNI_TRANSLATE_EXCEPTIONS()
} }
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
- (id)initWithDateRecord:(DBDateRecord *)dateRecord; - (id)initWithDateRecord:(DBDateRecord *)dateRecord;
- (id)initWithCreatedAt:(NSDate *)createdAt; - (id)initWithCreatedAt:(NSDate *)createdAt;
@property (nonatomic, readonly) NSDate *createdAt; @property (nonatomic, readonly) NSDate * createdAt;
@end @end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "DBDateRecord+Private.h" #import "DBDateRecord+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
- (id)initWithMapDateRecord:(DBMapDateRecord *)mapDateRecord; - (id)initWithMapDateRecord:(DBMapDateRecord *)mapDateRecord;
- (id)initWithDatesById:(NSDictionary *)datesById; - (id)initWithDatesById:(NSDictionary *)datesById;
@property (nonatomic, readonly) NSDictionary *datesById; @property (nonatomic, readonly) NSDictionary * datesById;
@end @end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "DBMapDateRecord+Private.h" #import "DBMapDateRecord+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
- (id)initWithMapListRecord:(DBMapListRecord *)mapListRecord; - (id)initWithMapListRecord:(DBMapListRecord *)mapListRecord;
- (id)initWithMapList:(NSArray *)mapList; - (id)initWithMapList:(NSArray *)mapList;
@property (nonatomic, readonly) NSArray *mapList; @property (nonatomic, readonly) NSArray * mapList;
@end @end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "DBMapListRecord+Private.h" #import "DBMapListRecord+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -59,7 +60,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -59,7 +60,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
NSString *objcKey_1 = [[NSString alloc] initWithBytes:cppPair_1.first.data() NSString *objcKey_1 = [[NSString alloc] initWithBytes:cppPair_1.first.data()
length:cppPair_1.first.length() length:cppPair_1.first.length()
encoding:NSUTF8StringEncoding]; encoding:NSUTF8StringEncoding];
NSNumber *objcValue_1 = [NSNumber numberWithLongLong:cppPair_1.second]; NSNumber *objcValue_1 = ::djinni::I64::Boxed::fromCpp(cppPair_1.second);
objcValue_0TempKeyVector.push_back(objcKey_1); objcValue_0TempKeyVector.push_back(objcKey_1);
objcValue_0TempValueVector.push_back(objcValue_1); objcValue_0TempValueVector.push_back(objcValue_1);
} }
...@@ -79,7 +80,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -79,7 +80,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
std::unordered_map<std::string, int64_t> cppValue_0; std::unordered_map<std::string, int64_t> cppValue_0;
for (id objcKey_1 in objcValue_0) { for (id objcKey_1 in objcValue_0) {
std::string cppKey_1([objcKey_1 UTF8String], [objcKey_1 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); std::string cppKey_1([objcKey_1 UTF8String], [objcKey_1 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
int64_t cppValue_1 = [[objcValue_0 objectForKey:objcKey_1] longLongValue]; int64_t cppValue_1 = ::djinni::I64::Boxed::toCpp([objcValue_0 objectForKey:objcKey_1]);
cppValue_0.emplace(std::move(cppKey_1), std::move(cppValue_1)); cppValue_0.emplace(std::move(cppKey_1), std::move(cppValue_1));
} }
mapList.push_back(std::move(cppValue_0)); mapList.push_back(std::move(cppValue_0));
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
- (id)initWithMapRecord:(DBMapRecord *)mapRecord; - (id)initWithMapRecord:(DBMapRecord *)mapRecord;
- (id)initWithMap:(NSDictionary *)map; - (id)initWithMap:(NSDictionary *)map;
@property (nonatomic, readonly) NSDictionary *map; @property (nonatomic, readonly) NSDictionary * map;
@end @end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "DBMapRecord+Private.h" #import "DBMapRecord+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -49,7 +50,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -49,7 +50,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
NSString *objcKey_0 = [[NSString alloc] initWithBytes:cppPair_0.first.data() NSString *objcKey_0 = [[NSString alloc] initWithBytes:cppPair_0.first.data()
length:cppPair_0.first.length() length:cppPair_0.first.length()
encoding:NSUTF8StringEncoding]; encoding:NSUTF8StringEncoding];
NSNumber *objcValue_0 = [NSNumber numberWithLongLong:cppPair_0.second]; NSNumber *objcValue_0 = ::djinni::I64::Boxed::fromCpp(cppPair_0.second);
_mapTempKeyVector.push_back(objcKey_0); _mapTempKeyVector.push_back(objcKey_0);
_mapTempValueVector.push_back(objcValue_0); _mapTempValueVector.push_back(objcValue_0);
} }
...@@ -63,7 +64,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -63,7 +64,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
std::unordered_map<std::string, int64_t> map; std::unordered_map<std::string, int64_t> map;
for (id objcKey_0 in _map) { for (id objcKey_0 in _map) {
std::string cppKey_0([objcKey_0 UTF8String], [objcKey_0 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); std::string cppKey_0([objcKey_0 UTF8String], [objcKey_0 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
int64_t cppValue_0 = [[_map objectForKey:objcKey_0] longLongValue]; int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp([_map objectForKey:objcKey_0]);
map.emplace(std::move(cppKey_0), std::move(cppValue_0)); map.emplace(std::move(cppKey_0), std::move(cppValue_0));
} }
return MapRecord( return MapRecord(
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
- (id)initWithNestedCollection:(DBNestedCollection *)nestedCollection; - (id)initWithNestedCollection:(DBNestedCollection *)nestedCollection;
- (id)initWithSetList:(NSArray *)setList; - (id)initWithSetList:(NSArray *)setList;
@property (nonatomic, readonly) NSArray *setList; @property (nonatomic, readonly) NSArray * setList;
@end @end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "DBNestedCollection+Private.h" #import "DBNestedCollection+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
- (id)initWithPrimitiveList:(DBPrimitiveList *)primitiveList; - (id)initWithPrimitiveList:(DBPrimitiveList *)primitiveList;
- (id)initWithList:(NSArray *)list; - (id)initWithList:(NSArray *)list;
@property (nonatomic, readonly) NSArray *list; @property (nonatomic, readonly) NSArray * list;
@end @end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "DBPrimitiveList+Private.h" #import "DBPrimitiveList+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -40,7 +41,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -40,7 +41,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
std::vector<NSNumber *> _listTempVector; std::vector<NSNumber *> _listTempVector;
_listTempVector.reserve(primitiveList.list.size()); _listTempVector.reserve(primitiveList.list.size());
for (const auto & cppValue_0 : primitiveList.list) { for (const auto & cppValue_0 : primitiveList.list) {
NSNumber *objcValue_0 = [NSNumber numberWithLongLong:cppValue_0]; NSNumber *objcValue_0 = ::djinni::I64::Boxed::fromCpp(cppValue_0);
_listTempVector.push_back(objcValue_0); _listTempVector.push_back(objcValue_0);
} }
_list = [NSArray arrayWithObjects:&_listTempVector[0] count:_listTempVector.size()]; _list = [NSArray arrayWithObjects:&_listTempVector[0] count:_listTempVector.size()];
...@@ -53,7 +54,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -53,7 +54,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
std::vector<int64_t> list; std::vector<int64_t> list;
list.reserve([_list count]); list.reserve([_list count]);
for (NSNumber *objcValue_0 in _list) { for (NSNumber *objcValue_0 in _list) {
int64_t cppValue_0 = [objcValue_0 longLongValue]; int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp(objcValue_0);
list.push_back(std::move(cppValue_0)); list.push_back(std::move(cppValue_0));
} }
return PrimitiveList( return PrimitiveList(
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
@property (nonatomic, readonly) int32_t key1; @property (nonatomic, readonly) int32_t key1;
@property (nonatomic, readonly) NSString *key2; @property (nonatomic, readonly) NSString * key2;
- (NSComparisonResult)compare:(DBRecordWithDerivings *)other; - (NSComparisonResult)compare:(DBRecordWithDerivings *)other;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "DBRecordWithDerivings+Private.h" #import "DBRecordWithDerivings+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -32,7 +33,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -32,7 +33,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithCppRecordWithDerivings:(const RecordWithDerivings &)recordWithDerivings - (id)initWithCppRecordWithDerivings:(const RecordWithDerivings &)recordWithDerivings
{ {
if (self = [super init]) { if (self = [super init]) {
_key1 = recordWithDerivings.key1; _key1 = ::djinni::I32::fromCpp(recordWithDerivings.key1);
_key2 = [[NSString alloc] initWithBytes:recordWithDerivings.key2.data() _key2 = [[NSString alloc] initWithBytes:recordWithDerivings.key2.data()
length:recordWithDerivings.key2.length() length:recordWithDerivings.key2.length()
encoding:NSUTF8StringEncoding]; encoding:NSUTF8StringEncoding];
...@@ -42,7 +43,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -42,7 +43,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (RecordWithDerivings)cppRecordWithDerivings - (RecordWithDerivings)cppRecordWithDerivings
{ {
int32_t key1 = _key1; int32_t key1 = ::djinni::I32::toCpp(_key1);
std::string key2([_key2 UTF8String], [_key2 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); std::string key2([_key2 UTF8String], [_key2 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
return RecordWithDerivings( return RecordWithDerivings(
std::move(key1), std::move(key1),
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
@property (nonatomic, readonly) int32_t key; @property (nonatomic, readonly) int32_t key;
@property (nonatomic, readonly) DBRecordWithDerivings *rec; @property (nonatomic, readonly) DBRecordWithDerivings * rec;
- (NSComparisonResult)compare:(DBRecordWithNestedDerivings *)other; - (NSComparisonResult)compare:(DBRecordWithNestedDerivings *)other;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#import "DBRecordWithNestedDerivings+Private.h" #import "DBRecordWithNestedDerivings+Private.h"
#import "DBRecordWithDerivings+Private.h" #import "DBRecordWithDerivings+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -33,7 +34,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -33,7 +34,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithCppRecordWithNestedDerivings:(const RecordWithNestedDerivings &)recordWithNestedDerivings - (id)initWithCppRecordWithNestedDerivings:(const RecordWithNestedDerivings &)recordWithNestedDerivings
{ {
if (self = [super init]) { if (self = [super init]) {
_key = recordWithNestedDerivings.key; _key = ::djinni::I32::fromCpp(recordWithNestedDerivings.key);
_rec = [[DBRecordWithDerivings alloc] initWithCppRecordWithDerivings:recordWithNestedDerivings.rec]; _rec = [[DBRecordWithDerivings alloc] initWithCppRecordWithDerivings:recordWithNestedDerivings.rec];
} }
return self; return self;
...@@ -41,7 +42,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -41,7 +42,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (RecordWithNestedDerivings)cppRecordWithNestedDerivings - (RecordWithNestedDerivings)cppRecordWithNestedDerivings
{ {
int32_t key = _key; int32_t key = ::djinni::I32::toCpp(_key);
RecordWithDerivings rec = std::move([_rec cppRecordWithDerivings]); RecordWithDerivings rec = std::move([_rec cppRecordWithDerivings]);
return RecordWithNestedDerivings( return RecordWithNestedDerivings(
std::move(key), std::move(key),
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
- (id)initWithSetRecord:(DBSetRecord *)setRecord; - (id)initWithSetRecord:(DBSetRecord *)setRecord;
- (id)initWithSet:(NSSet *)set; - (id)initWithSet:(NSSet *)set;
@property (nonatomic, readonly) NSSet *set; @property (nonatomic, readonly) NSSet * set;
@end @end
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#import "DBSetRecord+Private.h" #import "DBSetRecord+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#import "DJICppWrapperCache+Private.h" #import "DJICppWrapperCache+Private.h"
#import "DJIDate.h" #import "DJIDate.h"
#import "DJIError.h" #import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception> #include <exception>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -59,7 +60,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -59,7 +60,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
try { try {
SetRecord cppRec = std::move([rec cppSetRecord]); SetRecord cppRec = std::move([rec cppSetRecord]);
bool cppRet = TestHelpers::check_set_record(std::move(cppRec)); bool cppRet = TestHelpers::check_set_record(std::move(cppRec));
BOOL objcRet = (cppRet) ? YES : NO; BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet; return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS() } DJINNI_TRANSLATE_EXCEPTIONS()
} }
...@@ -76,7 +77,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -76,7 +77,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
try { try {
PrimitiveList cppPl = std::move([pl cppPrimitiveList]); PrimitiveList cppPl = std::move([pl cppPrimitiveList]);
bool cppRet = TestHelpers::check_primitive_list(std::move(cppPl)); bool cppRet = TestHelpers::check_primitive_list(std::move(cppPl));
BOOL objcRet = (cppRet) ? YES : NO; BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet; return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS() } DJINNI_TRANSLATE_EXCEPTIONS()
} }
...@@ -93,7 +94,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -93,7 +94,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
try { try {
NestedCollection cppNc = std::move([nc cppNestedCollection]); NestedCollection cppNc = std::move([nc cppNestedCollection]);
bool cppRet = TestHelpers::check_nested_collection(std::move(cppNc)); bool cppRet = TestHelpers::check_nested_collection(std::move(cppNc));
BOOL objcRet = (cppRet) ? YES : NO; BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet; return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS() } DJINNI_TRANSLATE_EXCEPTIONS()
} }
...@@ -109,7 +110,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -109,7 +110,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
NSString *objcKey_0 = [[NSString alloc] initWithBytes:cppPair_0.first.data() NSString *objcKey_0 = [[NSString alloc] initWithBytes:cppPair_0.first.data()
length:cppPair_0.first.length() length:cppPair_0.first.length()
encoding:NSUTF8StringEncoding]; encoding:NSUTF8StringEncoding];
NSNumber *objcValue_0 = [NSNumber numberWithLongLong:cppPair_0.second]; NSNumber *objcValue_0 = ::djinni::I64::Boxed::fromCpp(cppPair_0.second);
objcRetTempKeyVector.push_back(objcKey_0); objcRetTempKeyVector.push_back(objcKey_0);
objcRetTempValueVector.push_back(objcValue_0); objcRetTempValueVector.push_back(objcValue_0);
} }
...@@ -123,11 +124,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -123,11 +124,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
std::unordered_map<std::string, int64_t> cppM; std::unordered_map<std::string, int64_t> cppM;
for (id objcKey_0 in m) { for (id objcKey_0 in m) {
std::string cppKey_0([objcKey_0 UTF8String], [objcKey_0 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); std::string cppKey_0([objcKey_0 UTF8String], [objcKey_0 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
int64_t cppValue_0 = [[m objectForKey:objcKey_0] longLongValue]; int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp([m objectForKey:objcKey_0]);
cppM.emplace(std::move(cppKey_0), std::move(cppValue_0)); cppM.emplace(std::move(cppKey_0), std::move(cppValue_0));
} }
bool cppRet = TestHelpers::check_map(std::move(cppM)); bool cppRet = TestHelpers::check_map(std::move(cppM));
BOOL objcRet = (cppRet) ? YES : NO; BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet; return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS() } DJINNI_TRANSLATE_EXCEPTIONS()
} }
...@@ -143,7 +144,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -143,7 +144,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
NSString *objcKey_0 = [[NSString alloc] initWithBytes:cppPair_0.first.data() NSString *objcKey_0 = [[NSString alloc] initWithBytes:cppPair_0.first.data()
length:cppPair_0.first.length() length:cppPair_0.first.length()
encoding:NSUTF8StringEncoding]; encoding:NSUTF8StringEncoding];
NSNumber *objcValue_0 = [NSNumber numberWithLongLong:cppPair_0.second]; NSNumber *objcValue_0 = ::djinni::I64::Boxed::fromCpp(cppPair_0.second);
objcRetTempKeyVector.push_back(objcKey_0); objcRetTempKeyVector.push_back(objcKey_0);
objcRetTempValueVector.push_back(objcValue_0); objcRetTempValueVector.push_back(objcValue_0);
} }
...@@ -157,11 +158,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -157,11 +158,11 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
std::unordered_map<std::string, int64_t> cppM; std::unordered_map<std::string, int64_t> cppM;
for (id objcKey_0 in m) { for (id objcKey_0 in m) {
std::string cppKey_0([objcKey_0 UTF8String], [objcKey_0 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); std::string cppKey_0([objcKey_0 UTF8String], [objcKey_0 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
int64_t cppValue_0 = [[m objectForKey:objcKey_0] longLongValue]; int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp([m objectForKey:objcKey_0]);
cppM.emplace(std::move(cppKey_0), std::move(cppValue_0)); cppM.emplace(std::move(cppKey_0), std::move(cppValue_0));
} }
bool cppRet = TestHelpers::check_empty_map(std::move(cppM)); bool cppRet = TestHelpers::check_empty_map(std::move(cppM));
BOOL objcRet = (cppRet) ? YES : NO; BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet; return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS() } DJINNI_TRANSLATE_EXCEPTIONS()
} }
...@@ -178,7 +179,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -178,7 +179,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
try { try {
MapListRecord cppM = std::move([m cppMapListRecord]); MapListRecord cppM = std::move([m cppMapListRecord]);
bool cppRet = TestHelpers::check_map_list_record(std::move(cppM)); bool cppRet = TestHelpers::check_map_list_record(std::move(cppM));
BOOL objcRet = (cppRet) ? YES : NO; BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet; return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS() } DJINNI_TRANSLATE_EXCEPTIONS()
} }
...@@ -237,7 +238,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -237,7 +238,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
try { try {
std::shared_ptr<Token> cppT = t.cppRef; std::shared_ptr<Token> cppT = t.cppRef;
int64_t cppRet = TestHelpers::cpp_token_id(std::move(cppT)); int64_t cppRet = TestHelpers::cpp_token_id(std::move(cppT));
int64_t objcRet = cppRet; int64_t objcRet = ::djinni::I64::fromCpp(cppRet);
return objcRet; return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS() } DJINNI_TRANSLATE_EXCEPTIONS()
} }
...@@ -247,7 +248,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th ...@@ -247,7 +248,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
std::experimental::optional<int32_t> cppRet = TestHelpers::return_none(); std::experimental::optional<int32_t> cppRet = TestHelpers::return_none();
NSNumber *objcRet; NSNumber *objcRet;
if (cppRet) { if (cppRet) {
objcRet = [NSNumber numberWithInt:(*(cppRet))]; objcRet = ::djinni::I32::Boxed::fromCpp((*(cppRet)));
} else { } else {
objcRet = nil; objcRet = nil;
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
65868B5F1989FE4200D60EEE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65868B5E1989FE4200D60EEE /* UIKit.framework */; }; 65868B5F1989FE4200D60EEE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65868B5E1989FE4200D60EEE /* UIKit.framework */; };
65868B621989FE4200D60EEE /* libDjinniObjcTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 65868B4A1989FE4200D60EEE /* libDjinniObjcTest.a */; }; 65868B621989FE4200D60EEE /* libDjinniObjcTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 65868B4A1989FE4200D60EEE /* libDjinniObjcTest.a */; };
6D66A8A91A3B09F000B312E8 /* DBConstantTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6D66A8A81A3B09F000B312E8 /* DBConstantTests.mm */; }; 6D66A8A91A3B09F000B312E8 /* DBConstantTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6D66A8A81A3B09F000B312E8 /* DBConstantTests.mm */; };
A239F37A1AF400C600DF27C8 /* DJIDate.mm in Sources */ = {isa = PBXBuildFile; fileRef = A239F3781AF400C600DF27C8 /* DJIDate.mm */; };
A242494C1AF192E0003BF8F0 /* DBAssortedIntegers.mm in Sources */ = {isa = PBXBuildFile; fileRef = A242491B1AF192E0003BF8F0 /* DBAssortedIntegers.mm */; }; A242494C1AF192E0003BF8F0 /* DBAssortedIntegers.mm in Sources */ = {isa = PBXBuildFile; fileRef = A242491B1AF192E0003BF8F0 /* DBAssortedIntegers.mm */; };
A242494D1AF192E0003BF8F0 /* DBClientInterfaceObjcProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = A242491E1AF192E0003BF8F0 /* DBClientInterfaceObjcProxy.mm */; }; A242494D1AF192E0003BF8F0 /* DBClientInterfaceObjcProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = A242491E1AF192E0003BF8F0 /* DBClientInterfaceObjcProxy.mm */; };
A242494E1AF192E0003BF8F0 /* DBClientReturnedRecord.mm in Sources */ = {isa = PBXBuildFile; fileRef = A24249211AF192E0003BF8F0 /* DBClientReturnedRecord.mm */; }; A242494E1AF192E0003BF8F0 /* DBClientReturnedRecord.mm in Sources */ = {isa = PBXBuildFile; fileRef = A24249211AF192E0003BF8F0 /* DBClientReturnedRecord.mm */; };
...@@ -98,6 +99,9 @@ ...@@ -98,6 +99,9 @@
65868B5B1989FE4200D60EEE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 65868B5B1989FE4200D60EEE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
65868B5E1989FE4200D60EEE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 65868B5E1989FE4200D60EEE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
6D66A8A81A3B09F000B312E8 /* DBConstantTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DBConstantTests.mm; sourceTree = "<group>"; }; 6D66A8A81A3B09F000B312E8 /* DBConstantTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DBConstantTests.mm; sourceTree = "<group>"; };
A239F3771AF400C600DF27C8 /* DJIDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DJIDate.h; sourceTree = "<group>"; };
A239F3781AF400C600DF27C8 /* DJIDate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DJIDate.mm; sourceTree = "<group>"; };
A239F3791AF400C600DF27C8 /* DJIMarshal+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DJIMarshal+Private.h"; sourceTree = "<group>"; };
A24249191AF192E0003BF8F0 /* DBAssortedIntegers+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DBAssortedIntegers+Private.h"; sourceTree = "<group>"; }; A24249191AF192E0003BF8F0 /* DBAssortedIntegers+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DBAssortedIntegers+Private.h"; sourceTree = "<group>"; };
A242491A1AF192E0003BF8F0 /* DBAssortedIntegers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBAssortedIntegers.h; sourceTree = "<group>"; }; A242491A1AF192E0003BF8F0 /* DBAssortedIntegers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBAssortedIntegers.h; sourceTree = "<group>"; };
A242491B1AF192E0003BF8F0 /* DBAssortedIntegers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DBAssortedIntegers.mm; sourceTree = "<group>"; }; A242491B1AF192E0003BF8F0 /* DBAssortedIntegers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DBAssortedIntegers.mm; sourceTree = "<group>"; };
...@@ -202,6 +206,9 @@ ...@@ -202,6 +206,9 @@
6536CD6919A6C82200DD7715 /* objc-support-lib */ = { 6536CD6919A6C82200DD7715 /* objc-support-lib */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A239F3771AF400C600DF27C8 /* DJIDate.h */,
A239F3781AF400C600DF27C8 /* DJIDate.mm */,
A239F3791AF400C600DF27C8 /* DJIMarshal+Private.h */,
A2A162D01AF190D200C0B00A /* DJIDate.h */, A2A162D01AF190D200C0B00A /* DJIDate.h */,
A2A162D11AF190D200C0B00A /* DJIDate.mm */, A2A162D11AF190D200C0B00A /* DJIDate.mm */,
A2CB54B319BA6E6000A9E600 /* DJIError.mm */, A2CB54B319BA6E6000A9E600 /* DJIError.mm */,
...@@ -466,7 +473,6 @@ ...@@ -466,7 +473,6 @@
A278D45319BA3601006FD937 /* test_helpers.cpp in Sources */, A278D45319BA3601006FD937 /* test_helpers.cpp in Sources */,
6536CD7819A6C98800DD7715 /* cpp_exception_impl.cpp in Sources */, 6536CD7819A6C98800DD7715 /* cpp_exception_impl.cpp in Sources */,
6536CD7419A6C96C00DD7715 /* DBClientInterfaceImpl.mm in Sources */, 6536CD7419A6C96C00DD7715 /* DBClientInterfaceImpl.mm in Sources */,
6D66A8AD1A3B0A3200B312E8 /* DBConstants.mm in Sources */,
A242494E1AF192E0003BF8F0 /* DBClientReturnedRecord.mm in Sources */, A242494E1AF192E0003BF8F0 /* DBClientReturnedRecord.mm in Sources */,
A242494C1AF192E0003BF8F0 /* DBAssortedIntegers.mm in Sources */, A242494C1AF192E0003BF8F0 /* DBAssortedIntegers.mm in Sources */,
A2A162D21AF190D200C0B00A /* DJIDate.mm in Sources */, A2A162D21AF190D200C0B00A /* DJIDate.mm in Sources */,
...@@ -481,6 +487,7 @@ ...@@ -481,6 +487,7 @@
A24249591AF192E0003BF8F0 /* DBRecordWithNestedDerivings.mm in Sources */, A24249591AF192E0003BF8F0 /* DBRecordWithNestedDerivings.mm in Sources */,
A24249751AF192FC003BF8F0 /* record_with_derivings.cpp in Sources */, A24249751AF192FC003BF8F0 /* record_with_derivings.cpp in Sources */,
A24249541AF192E0003BF8F0 /* DBMapListRecord.mm in Sources */, A24249541AF192E0003BF8F0 /* DBMapListRecord.mm in Sources */,
A239F37A1AF400C600DF27C8 /* DJIDate.mm in Sources */,
A242494D1AF192E0003BF8F0 /* DBClientInterfaceObjcProxy.mm in Sources */, A242494D1AF192E0003BF8F0 /* DBClientInterfaceObjcProxy.mm in Sources */,
A24249731AF192FC003BF8F0 /* assorted_integers.cpp in Sources */, A24249731AF192FC003BF8F0 /* assorted_integers.cpp in Sources */,
A24249561AF192E0003BF8F0 /* DBNestedCollection.mm in Sources */, A24249561AF192E0003BF8F0 /* DBNestedCollection.mm in Sources */,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment