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

Refactored record code generation to utilize translation types like JNI does

parent 30e73aeb
......@@ -3,11 +3,22 @@
#import "TXSItemList.h"
#include "item_list.hpp"
#import <Foundation/Foundation.h>
@interface TXSItemList ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppItemList:(const ::textsort::ItemList &)itemList;
- (::textsort::ItemList)cppItemList;
@class TXSItemList;
@end
namespace djinni_generated {
struct ItemList
{
using CppType = ::textsort::ItemList;
using ObjcType = TXSItemList*;
using Boxed = ItemList;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#import "TXSItemList+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto ItemList::toCpp(ObjcType obj) -> CppType
{
assert(obj);
std::vector<std::string> items;
items.reserve([obj.items count]);
for (NSString *objcValue_0 in obj.items) {
std::string cppValue_0 = ::djinni::String::toCpp(objcValue_0);
items.push_back(std::move(cppValue_0));
}
return ::textsort::ItemList(
items);
}
auto ItemList::fromCpp(const CppType& cpp) -> ObjcType
{
std::vector<NSString *> itemsTempVector;
itemsTempVector.reserve(cpp.items.size());
for (const auto & cppValue_0 : cpp.items) {
NSString *objcValue_0 = ::djinni::String::fromCpp(cppValue_0);
itemsTempVector.push_back(objcValue_0);
}
NSArray *items = [NSArray arrayWithObjects:&itemsTempVector[0] count:itemsTempVector.size()];
return [[TXSItemList alloc]
initWithItems:items];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface TXSItemList : NSObject
- (id)initWithItemList:(TXSItemList *)itemList;
- (id)initWithItems:(NSArray *)items;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#import "TXSItemList.h"
@implementation TXSItemList
- (id)initWithItemList:(TXSItemList *)itemList
{
if (self = [super init]) {
NSMutableArray *_itemsTempArray = [NSMutableArray arrayWithCapacity:[itemList.items count]];
for (NSString *currentValue_0 in itemList.items) {
id copiedValue_0;
copiedValue_0 = [currentValue_0 copy];
[_itemsTempArray addObject:copiedValue_0];
}
_items = _itemsTempArray;
}
return self;
}
- (id)initWithItems:(NSArray *)items
{
if (self = [super init]) {
_items = items;
}
return self;
}
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#import "TXSItemList+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation TXSItemList
- (id)initWithItemList:(TXSItemList *)itemList
{
if (self = [super init]) {
std::vector<NSString *> _itemsTempVector;
_itemsTempVector.reserve([itemList.items count]);
for (NSString *currentValue_0 in itemList.items) {
NSString *copiedValue_0;
copiedValue_0 = [currentValue_0 copy];
_itemsTempVector.push_back(copiedValue_0);
}
_items = [NSArray arrayWithObjects:&_itemsTempVector[0] count:_itemsTempVector.size()];
}
return self;
}
- (id)initWithItems:(NSArray *)items
{
if (self = [super init]) {
_items = items;
}
return self;
}
- (id)initWithCppItemList:(const ::textsort::ItemList &)itemList
{
if (self = [super init]) {
std::vector<NSString *> _itemsTempVector;
_itemsTempVector.reserve(itemList.items.size());
for (const auto & cppValue_0 : itemList.items) {
NSString *objcValue_0 = ::djinni::String::fromCpp(cppValue_0);
_itemsTempVector.push_back(objcValue_0);
}
_items = [NSArray arrayWithObjects:&_itemsTempVector[0] count:_itemsTempVector.size()];
}
return self;
}
- (::textsort::ItemList)cppItemList
{
std::vector<std::string> items;
items.reserve([_items count]);
for (NSString *objcValue_0 in _items) {
std::string cppValue_0 = ::djinni::String::toCpp(objcValue_0);
items.push_back(std::move(cppValue_0));
}
return ::textsort::ItemList(
std::move(items));
}
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#import "TXSItemList.h"
#import "TXSSortOrder.h"
#import <Foundation/Foundation.h>
@class TXSItemList;
@class TXSSortItems;
@protocol TXSTextboxListener;
......
......@@ -54,7 +54,7 @@ auto SortItems::fromCpp(const CppType& cpp) -> ObjcType
- (void)sort:(TXSSortOrder)order items:(TXSItemList *)items {
try {
::textsort::sort_order cppOrder = ::djinni::Enum<::textsort::sort_order, TXSSortOrder>::toCpp(order);
::textsort::ItemList cppItems = std::move([items cppItemList]);
::textsort::ItemList cppItems = ::djinni_generated::ItemList::toCpp(items);
_cppRef.get()->sort(std::move(cppOrder), std::move(cppItems));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni
#import "TXSItemList.h"
#import <Foundation/Foundation.h>
@class TXSItemList;
@protocol TXSTextboxListener
......
......@@ -40,7 +40,7 @@ auto TextboxListener::fromCpp(const CppType& cpp) -> ObjcType
void ObjcProxy::update (const ::textsort::ItemList & items)
{
@autoreleasepool {
TXSItemList *cpp_items = [[TXSItemList alloc] initWithCppItemList:items];
TXSItemList *cpp_items = ::djinni_generated::ItemList::fromCpp(items);
[Handle::get() update:cpp_items];
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -3,11 +3,22 @@
#import "DBAssortedIntegers.h"
#include "assorted_integers.hpp"
#import <Foundation/Foundation.h>
@interface DBAssortedIntegers ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppAssortedIntegers:(const ::AssortedIntegers &)assortedIntegers;
- (::AssortedIntegers)cppAssortedIntegers;
@class DBAssortedIntegers;
@end
namespace djinni_generated {
struct AssortedIntegers
{
using CppType = ::AssortedIntegers;
using ObjcType = DBAssortedIntegers*;
using Boxed = AssortedIntegers;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from inttypes.djinni
#import "DBAssortedIntegers+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto AssortedIntegers::toCpp(ObjcType obj) -> CppType
{
assert(obj);
int8_t eight = ::djinni::I8::toCpp(obj.eight);
int16_t sixteen = ::djinni::I16::toCpp(obj.sixteen);
int32_t thirtytwo = ::djinni::I32::toCpp(obj.thirtytwo);
int64_t sixtyfour = ::djinni::I64::toCpp(obj.sixtyfour);
std::experimental::optional<int8_t> o_eight;
if (obj.oEight != nil) {
int8_t optValue = ::djinni::I8::Boxed::toCpp(obj.oEight);
o_eight = optValue;
}
std::experimental::optional<int16_t> o_sixteen;
if (obj.oSixteen != nil) {
int16_t optValue = ::djinni::I16::Boxed::toCpp(obj.oSixteen);
o_sixteen = optValue;
}
std::experimental::optional<int32_t> o_thirtytwo;
if (obj.oThirtytwo != nil) {
int32_t optValue = ::djinni::I32::Boxed::toCpp(obj.oThirtytwo);
o_thirtytwo = optValue;
}
std::experimental::optional<int64_t> o_sixtyfour;
if (obj.oSixtyfour != nil) {
int64_t optValue = ::djinni::I64::Boxed::toCpp(obj.oSixtyfour);
o_sixtyfour = optValue;
}
return ::AssortedIntegers(
eight,
sixteen,
thirtytwo,
sixtyfour,
o_eight,
o_sixteen,
o_thirtytwo,
o_sixtyfour);
}
auto AssortedIntegers::fromCpp(const CppType& cpp) -> ObjcType
{
int8_t eight = ::djinni::I8::fromCpp(cpp.eight);
int16_t sixteen = ::djinni::I16::fromCpp(cpp.sixteen);
int32_t thirtytwo = ::djinni::I32::fromCpp(cpp.thirtytwo);
int64_t sixtyfour = ::djinni::I64::fromCpp(cpp.sixtyfour);
NSNumber *oEight;
if (cpp.o_eight) {
oEight = ::djinni::I8::Boxed::fromCpp((*(cpp.o_eight)));
} else {
oEight = nil;
}
NSNumber *oSixteen;
if (cpp.o_sixteen) {
oSixteen = ::djinni::I16::Boxed::fromCpp((*(cpp.o_sixteen)));
} else {
oSixteen = nil;
}
NSNumber *oThirtytwo;
if (cpp.o_thirtytwo) {
oThirtytwo = ::djinni::I32::Boxed::fromCpp((*(cpp.o_thirtytwo)));
} else {
oThirtytwo = nil;
}
NSNumber *oSixtyfour;
if (cpp.o_sixtyfour) {
oSixtyfour = ::djinni::I64::Boxed::fromCpp((*(cpp.o_sixtyfour)));
} else {
oSixtyfour = nil;
}
return [[DBAssortedIntegers alloc]
initWithEight:eight
sixteen:sixteen
thirtytwo:thirtytwo
sixtyfour:sixtyfour
oEight:oEight
oSixteen:oSixteen
oThirtytwo:oThirtytwo
oSixtyfour:oSixtyfour];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface DBAssortedIntegers : NSObject
- (id)initWithAssortedIntegers:(DBAssortedIntegers *)assortedIntegers;
- (id)initWithEight:(int8_t)eight sixteen:(int16_t)sixteen thirtytwo:(int32_t)thirtytwo sixtyfour:(int64_t)sixtyfour oEight:(NSNumber *)oEight oSixteen:(NSNumber *)oSixteen oThirtytwo:(NSNumber *)oThirtytwo oSixtyfour:(NSNumber *)oSixtyfour;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from inttypes.djinni
#import "DBAssortedIntegers+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBAssortedIntegers.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBAssortedIntegers
......@@ -58,73 +52,6 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppAssortedIntegers:(const ::AssortedIntegers &)assortedIntegers
{
if (self = [super init]) {
_eight = ::djinni::I8::fromCpp(assortedIntegers.eight);
_sixteen = ::djinni::I16::fromCpp(assortedIntegers.sixteen);
_thirtytwo = ::djinni::I32::fromCpp(assortedIntegers.thirtytwo);
_sixtyfour = ::djinni::I64::fromCpp(assortedIntegers.sixtyfour);
if (assortedIntegers.o_eight) {
_oEight = ::djinni::I8::Boxed::fromCpp((*(assortedIntegers.o_eight)));
} else {
_oEight = nil;
}
if (assortedIntegers.o_sixteen) {
_oSixteen = ::djinni::I16::Boxed::fromCpp((*(assortedIntegers.o_sixteen)));
} else {
_oSixteen = nil;
}
if (assortedIntegers.o_thirtytwo) {
_oThirtytwo = ::djinni::I32::Boxed::fromCpp((*(assortedIntegers.o_thirtytwo)));
} else {
_oThirtytwo = nil;
}
if (assortedIntegers.o_sixtyfour) {
_oSixtyfour = ::djinni::I64::Boxed::fromCpp((*(assortedIntegers.o_sixtyfour)));
} else {
_oSixtyfour = nil;
}
}
return self;
}
- (::AssortedIntegers)cppAssortedIntegers
{
int8_t eight = ::djinni::I8::toCpp(_eight);
int16_t sixteen = ::djinni::I16::toCpp(_sixteen);
int32_t thirtytwo = ::djinni::I32::toCpp(_thirtytwo);
int64_t sixtyfour = ::djinni::I64::toCpp(_sixtyfour);
std::experimental::optional<int8_t> oEight;
if (_oEight != nil) {
int8_t optValue = ::djinni::I8::Boxed::toCpp(_oEight);
oEight = optValue;
}
std::experimental::optional<int16_t> oSixteen;
if (_oSixteen != nil) {
int16_t optValue = ::djinni::I16::Boxed::toCpp(_oSixteen);
oSixteen = optValue;
}
std::experimental::optional<int32_t> oThirtytwo;
if (_oThirtytwo != nil) {
int32_t optValue = ::djinni::I32::Boxed::toCpp(_oThirtytwo);
oThirtytwo = optValue;
}
std::experimental::optional<int64_t> oSixtyfour;
if (_oSixtyfour != nil) {
int64_t optValue = ::djinni::I64::Boxed::toCpp(_oSixtyfour);
oSixtyfour = optValue;
}
return ::AssortedIntegers(
std::move(eight),
std::move(sixteen),
std::move(thirtytwo),
std::move(sixtyfour),
std::move(oEight),
std::move(oSixteen),
std::move(oThirtytwo),
std::move(oSixtyfour));
}
- (BOOL)isEqual:(id)other
{
if (![other isKindOfClass:[DBAssortedIntegers class]]) {
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from client_interface.djinni
#import "DBClientReturnedRecord.h"
#import <Foundation/Foundation.h>
@class DBClientReturnedRecord;
@protocol DBClientInterface
......
......@@ -44,7 +44,7 @@ auto ClientInterface::fromCpp(const CppType& cpp) -> ObjcType
int64_t cpp_record_id = ::djinni::I64::fromCpp(record_id);
NSString *cpp_utf8string = ::djinni::String::fromCpp(utf8string);
DBClientReturnedRecord * objcRet = [Handle::get() getRecord:cpp_record_id utf8string:cpp_utf8string];
::ClientReturnedRecord cppRet = std::move([objcRet cppClientReturnedRecord]);
::ClientReturnedRecord cppRet = ::djinni_generated::ClientReturnedRecord::toCpp(objcRet);
return cppRet;
}
}
......@@ -3,11 +3,22 @@
#import "DBClientReturnedRecord.h"
#include "client_returned_record.hpp"
#import <Foundation/Foundation.h>
@interface DBClientReturnedRecord ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppClientReturnedRecord:(const ::ClientReturnedRecord &)clientReturnedRecord;
- (::ClientReturnedRecord)cppClientReturnedRecord;
@class DBClientReturnedRecord;
@end
namespace djinni_generated {
struct ClientReturnedRecord
{
using CppType = ::ClientReturnedRecord;
using ObjcType = DBClientReturnedRecord*;
using Boxed = ClientReturnedRecord;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from client_interface.djinni
#import "DBClientReturnedRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto ClientReturnedRecord::toCpp(ObjcType obj) -> CppType
{
assert(obj);
int64_t record_id = ::djinni::I64::toCpp(obj.recordId);
std::string content = ::djinni::String::toCpp(obj.content);
return ::ClientReturnedRecord(
record_id,
content);
}
auto ClientReturnedRecord::fromCpp(const CppType& cpp) -> ObjcType
{
int64_t recordId = ::djinni::I64::fromCpp(cpp.record_id);
NSString *content = ::djinni::String::fromCpp(cpp.content);
return [[DBClientReturnedRecord alloc]
initWithRecordId:recordId
content:content];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface DBClientReturnedRecord : NSObject
- (id)initWithClientReturnedRecord:(DBClientReturnedRecord *)clientReturnedRecord;
- (id)initWithRecordId:(int64_t)recordId content:(NSString *)content;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from client_interface.djinni
#import "DBClientReturnedRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBClientReturnedRecord.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBClientReturnedRecord
......@@ -30,22 +24,5 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppClientReturnedRecord:(const ::ClientReturnedRecord &)clientReturnedRecord
{
if (self = [super init]) {
_recordId = ::djinni::I64::fromCpp(clientReturnedRecord.record_id);
_content = ::djinni::String::fromCpp(clientReturnedRecord.content);
}
return self;
}
- (::ClientReturnedRecord)cppClientReturnedRecord
{
int64_t recordId = ::djinni::I64::toCpp(_recordId);
std::string content = ::djinni::String::toCpp(_content);
return ::ClientReturnedRecord(
std::move(recordId),
std::move(content));
}
@end
......@@ -3,11 +3,22 @@
#import "DBConstants.h"
#include "constants.hpp"
#import <Foundation/Foundation.h>
@interface DBConstants ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppConstants:(const ::Constants &)constants;
- (::Constants)cppConstants;
@class DBConstants;
@end
namespace djinni_generated {
struct Constants
{
using CppType = ::Constants;
using ObjcType = DBConstants*;
using Boxed = Constants;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from constants.djinni
#import "DBConstants+Private.h"
#import "DBConstants+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto Constants::toCpp(ObjcType obj) -> CppType
{
assert(obj);
int32_t some_integer = ::djinni::I32::toCpp(obj.someInteger);
std::string some_string = ::djinni::String::toCpp(obj.someString);
return ::Constants(
some_integer,
some_string);
}
auto Constants::fromCpp(const CppType& cpp) -> ObjcType
{
int32_t someInteger = ::djinni::I32::fromCpp(cpp.some_integer);
NSString *someString = ::djinni::String::fromCpp(cpp.some_string);
return [[DBConstants alloc]
initWithSomeInteger:someInteger
someString:someString];
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from constants.djinni
#import "DBConstants.h"
#import <Foundation/Foundation.h>
@class DBConstants;
extern const BOOL DBConstantsBoolConstant;
extern const int8_t DBConstantsI8Constant;
extern const int16_t DBConstantsI16Constant;
extern const int32_t DBConstantsI32Constant;
extern const int64_t DBConstantsI64Constant;
extern const double DBConstantsF64Constant;
extern NSString * const DBConstantsStringConstant;
extern NSNumber * const DBConstantsOptionalIntegerConstant;
extern DBConstants * const DBConstantsObjectConstant;
@interface DBConstants : NSObject
- (id)initWithConstants:(DBConstants *)constants;
......@@ -23,3 +13,13 @@ extern DBConstants * const DBConstantsObjectConstant;
@property (nonatomic, readonly) NSString * someString;
@end
extern const BOOL DBConstantsBoolConstant;
extern const int8_t DBConstantsI8Constant;
extern const int16_t DBConstantsI16Constant;
extern const int32_t DBConstantsI32Constant;
extern const int64_t DBConstantsI64Constant;
extern const double DBConstantsF64Constant;
extern NSString * const DBConstantsStringConstant;
extern NSNumber * const DBConstantsOptionalIntegerConstant;
extern DBConstants * const DBConstantsObjectConstant;
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from constants.djinni
#import "DBConstants+Private.h"
#import "DBConstants+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBConstants.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
......@@ -32,7 +26,6 @@ DBConstants * const DBConstantsObjectConstant = [[DBConstants alloc] initWithSom
someString:DBConstantsStringConstant];
#pragma clang diagnostic pop
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBConstants
......@@ -54,22 +47,5 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppConstants:(const ::Constants &)constants
{
if (self = [super init]) {
_someInteger = ::djinni::I32::fromCpp(constants.some_integer);
_someString = ::djinni::String::fromCpp(constants.some_string);
}
return self;
}
- (::Constants)cppConstants
{
int32_t someInteger = ::djinni::I32::toCpp(_someInteger);
std::string someString = ::djinni::String::toCpp(_someString);
return ::Constants(
std::move(someInteger),
std::move(someString));
}
@end
......@@ -3,11 +3,22 @@
#import "DBDateRecord.h"
#include "date_record.hpp"
#import <Foundation/Foundation.h>
@interface DBDateRecord ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppDateRecord:(const ::DateRecord &)dateRecord;
- (::DateRecord)cppDateRecord;
@class DBDateRecord;
@end
namespace djinni_generated {
struct DateRecord
{
using CppType = ::DateRecord;
using ObjcType = DBDateRecord*;
using Boxed = DateRecord;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from date.djinni
#import "DBDateRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto DateRecord::toCpp(ObjcType obj) -> CppType
{
assert(obj);
std::chrono::system_clock::time_point created_at = ::djinni::convert_date([obj.createdAt timeIntervalSince1970]);
return ::DateRecord(
created_at);
}
auto DateRecord::fromCpp(const CppType& cpp) -> ObjcType
{
NSDate *createdAt = [NSDate dateWithTimeIntervalSince1970:
std::chrono::duration_cast<std::chrono::duration<double>>(cpp.created_at.time_since_epoch()).count()];
return [[DBDateRecord alloc]
initWithCreatedAt:createdAt];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface DBDateRecord : NSObject
- (id)initWithDateRecord:(DBDateRecord *)dateRecord;
- (id)initWithCreatedAt:(NSDate *)createdAt;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from date.djinni
#import "DBDateRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBDateRecord.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBDateRecord
......@@ -28,20 +22,5 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppDateRecord:(const ::DateRecord &)dateRecord
{
if (self = [super init]) {
_createdAt = [NSDate dateWithTimeIntervalSince1970:
std::chrono::duration_cast<std::chrono::duration<double>>(dateRecord.created_at.time_since_epoch()).count()];
}
return self;
}
- (::DateRecord)cppDateRecord
{
std::chrono::system_clock::time_point createdAt = ::djinni::convert_date([_createdAt timeIntervalSince1970]);
return ::DateRecord(
std::move(createdAt));
}
@end
......@@ -3,11 +3,22 @@
#import "DBMapDateRecord.h"
#include "map_date_record.hpp"
#import <Foundation/Foundation.h>
@interface DBMapDateRecord ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppMapDateRecord:(const ::MapDateRecord &)mapDateRecord;
- (::MapDateRecord)cppMapDateRecord;
@class DBMapDateRecord;
@end
namespace djinni_generated {
struct MapDateRecord
{
using CppType = ::MapDateRecord;
using ObjcType = DBMapDateRecord*;
using Boxed = MapDateRecord;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from date.djinni
#import "DBMapDateRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto MapDateRecord::toCpp(ObjcType obj) -> CppType
{
assert(obj);
std::unordered_map<std::string, std::chrono::system_clock::time_point> dates_by_id;
for (id objcKey_0 in obj.datesById) {
std::string cppKey_0 = ::djinni::String::toCpp(objcKey_0);
std::chrono::system_clock::time_point cppValue_0 = ::djinni::convert_date([[obj.datesById objectForKey:objcKey_0] timeIntervalSince1970]);
dates_by_id.emplace(std::move(cppKey_0), std::move(cppValue_0));
}
return ::MapDateRecord(
dates_by_id);
}
auto MapDateRecord::fromCpp(const CppType& cpp) -> ObjcType
{
std::vector<NSString *> datesByIdTempKeyVector;
datesByIdTempKeyVector.reserve(cpp.dates_by_id.size());
std::vector<NSDate *> datesByIdTempValueVector;
datesByIdTempValueVector.reserve(cpp.dates_by_id.size());
for (const auto & cppPair_0 : cpp.dates_by_id) {
NSString *objcKey_0 = ::djinni::String::fromCpp(cppPair_0.first);
NSDate *objcValue_0 = [NSDate dateWithTimeIntervalSince1970:
std::chrono::duration_cast<std::chrono::duration<double>>(cppPair_0.second.time_since_epoch()).count()];
datesByIdTempKeyVector.push_back(objcKey_0);
datesByIdTempValueVector.push_back(objcValue_0);
}
NSDictionary *datesById = [NSDictionary dictionaryWithObjects:&datesByIdTempValueVector[0] forKeys:&datesByIdTempKeyVector[0] count:cpp.dates_by_id.size()];
return [[DBMapDateRecord alloc]
initWithDatesById:datesById];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface DBMapDateRecord : NSObject
- (id)initWithMapDateRecord:(DBMapDateRecord *)mapDateRecord;
- (id)initWithDatesById:(NSDictionary *)datesById;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from date.djinni
#import "DBMapDateRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBMapDateRecord.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBMapDateRecord
- (id)initWithMapDateRecord:(DBMapDateRecord *)mapDateRecord
{
if (self = [super init]) {
std::vector<NSString *> _datesByIdTempKeyVector;
_datesByIdTempKeyVector.reserve([mapDateRecord.datesById count]);
std::vector<NSDate *> _datesByIdTempValueVector;
_datesByIdTempValueVector.reserve([mapDateRecord.datesById count]);
for (NSString *key_0 in mapDateRecord.datesById) {
NSDate *copiedValue_0;
_datesByIdTempKeyVector.push_back(key_0);
NSDate *value_0 = [mapDateRecord.datesById objectForKey:key_0];
NSMutableDictionary *_datesByIdTempDictionary = [NSMutableDictionary dictionaryWithCapacity:[mapDateRecord.datesById count]];
for (id key_0 in mapDateRecord.datesById) {
id copiedKey_0, copiedValue_0;
copiedKey_0 = [key_0 copy];
id value_0 = [mapDateRecord.datesById objectForKey:key_0];
copiedValue_0 = [value_0 copy];
_datesByIdTempValueVector.push_back(copiedValue_0);
[_datesByIdTempDictionary setObject:copiedValue_0 forKey:copiedKey_0];
}
_datesById = [NSDictionary dictionaryWithObjects:&_datesByIdTempValueVector[0] forKeys:&_datesByIdTempKeyVector[0] count:[mapDateRecord.datesById count]];
_datesById = _datesByIdTempDictionary;
}
return self;
}
......@@ -39,35 +30,5 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppMapDateRecord:(const ::MapDateRecord &)mapDateRecord
{
if (self = [super init]) {
std::vector<NSString *> _datesByIdTempKeyVector;
_datesByIdTempKeyVector.reserve(mapDateRecord.dates_by_id.size());
std::vector<NSDate *> _datesByIdTempValueVector;
_datesByIdTempValueVector.reserve(mapDateRecord.dates_by_id.size());
for (const auto & cppPair_0 : mapDateRecord.dates_by_id) {
NSString *objcKey_0 = ::djinni::String::fromCpp(cppPair_0.first);
NSDate *objcValue_0 = [NSDate dateWithTimeIntervalSince1970:
std::chrono::duration_cast<std::chrono::duration<double>>(cppPair_0.second.time_since_epoch()).count()];
_datesByIdTempKeyVector.push_back(objcKey_0);
_datesByIdTempValueVector.push_back(objcValue_0);
}
_datesById = [NSDictionary dictionaryWithObjects:&_datesByIdTempValueVector[0] forKeys:&_datesByIdTempKeyVector[0] count:mapDateRecord.dates_by_id.size()];
}
return self;
}
- (::MapDateRecord)cppMapDateRecord
{
std::unordered_map<std::string, std::chrono::system_clock::time_point> datesById;
for (id objcKey_0 in _datesById) {
std::string cppKey_0 = ::djinni::String::toCpp(objcKey_0);
std::chrono::system_clock::time_point cppValue_0 = ::djinni::convert_date([[_datesById objectForKey:objcKey_0] timeIntervalSince1970]);
datesById.emplace(std::move(cppKey_0), std::move(cppValue_0));
}
return ::MapDateRecord(
std::move(datesById));
}
@end
......@@ -3,11 +3,22 @@
#import "DBMapListRecord.h"
#include "map_list_record.hpp"
#import <Foundation/Foundation.h>
@interface DBMapListRecord ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppMapListRecord:(const ::MapListRecord &)mapListRecord;
- (::MapListRecord)cppMapListRecord;
@class DBMapListRecord;
@end
namespace djinni_generated {
struct MapListRecord
{
using CppType = ::MapListRecord;
using ObjcType = DBMapListRecord*;
using Boxed = MapListRecord;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from map.djinni
#import "DBMapListRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto MapListRecord::toCpp(ObjcType obj) -> CppType
{
assert(obj);
std::vector<std::unordered_map<std::string, int64_t>> map_list;
map_list.reserve([obj.mapList count]);
for (NSDictionary *objcValue_0 in obj.mapList) {
std::unordered_map<std::string, int64_t> cppValue_0;
for (id objcKey_1 in objcValue_0) {
std::string cppKey_1 = ::djinni::String::toCpp(objcKey_1);
int64_t cppValue_1 = ::djinni::I64::Boxed::toCpp([objcValue_0 objectForKey:objcKey_1]);
cppValue_0.emplace(std::move(cppKey_1), std::move(cppValue_1));
}
map_list.push_back(std::move(cppValue_0));
}
return ::MapListRecord(
map_list);
}
auto MapListRecord::fromCpp(const CppType& cpp) -> ObjcType
{
std::vector<NSDictionary *> mapListTempVector;
mapListTempVector.reserve(cpp.map_list.size());
for (const auto & cppValue_0 : cpp.map_list) {
std::vector<NSString *> objcValue_0TempKeyVector;
objcValue_0TempKeyVector.reserve(cppValue_0.size());
std::vector<NSNumber *> objcValue_0TempValueVector;
objcValue_0TempValueVector.reserve(cppValue_0.size());
for (const auto & cppPair_1 : cppValue_0) {
NSString *objcKey_1 = ::djinni::String::fromCpp(cppPair_1.first);
NSNumber *objcValue_1 = ::djinni::I64::Boxed::fromCpp(cppPair_1.second);
objcValue_0TempKeyVector.push_back(objcKey_1);
objcValue_0TempValueVector.push_back(objcValue_1);
}
NSDictionary *objcValue_0 = [NSDictionary dictionaryWithObjects:&objcValue_0TempValueVector[0] forKeys:&objcValue_0TempKeyVector[0] count:cppValue_0.size()];
mapListTempVector.push_back(objcValue_0);
}
NSArray *mapList = [NSArray arrayWithObjects:&mapListTempVector[0] count:mapListTempVector.size()];
return [[DBMapListRecord alloc]
initWithMapList:mapList];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface DBMapListRecord : NSObject
- (id)initWithMapListRecord:(DBMapListRecord *)mapListRecord;
- (id)initWithMapList:(NSArray *)mapList;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from map.djinni
#import "DBMapListRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBMapListRecord.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBMapListRecord
- (id)initWithMapListRecord:(DBMapListRecord *)mapListRecord
{
if (self = [super init]) {
std::vector<NSDictionary *> _mapListTempVector;
_mapListTempVector.reserve([mapListRecord.mapList count]);
NSMutableArray *_mapListTempArray = [NSMutableArray arrayWithCapacity:[mapListRecord.mapList count]];
for (NSDictionary *currentValue_0 in mapListRecord.mapList) {
NSDictionary *copiedValue_0;
std::vector<NSString *> copiedValue_0TempKeyVector;
copiedValue_0TempKeyVector.reserve([currentValue_0 count]);
std::vector<NSNumber *> copiedValue_0TempValueVector;
copiedValue_0TempValueVector.reserve([currentValue_0 count]);
for (NSString *key_1 in currentValue_0) {
NSNumber *copiedValue_1;
copiedValue_0TempKeyVector.push_back(key_1);
NSNumber *value_1 = [currentValue_0 objectForKey:key_1];
id copiedValue_0;
NSMutableDictionary *copiedValue_0TempDictionary = [NSMutableDictionary dictionaryWithCapacity:[currentValue_0 count]];
for (id key_1 in currentValue_0) {
id copiedKey_1, copiedValue_1;
copiedKey_1 = [key_1 copy];
id value_1 = [currentValue_0 objectForKey:key_1];
copiedValue_1 = value_1;
copiedValue_0TempValueVector.push_back(copiedValue_1);
[copiedValue_0TempDictionary setObject:copiedValue_1 forKey:copiedKey_1];
}
copiedValue_0 = [NSDictionary dictionaryWithObjects:&copiedValue_0TempValueVector[0] forKeys:&copiedValue_0TempKeyVector[0] count:[currentValue_0 count]];
_mapListTempVector.push_back(copiedValue_0);
copiedValue_0 = copiedValue_0TempDictionary;
[_mapListTempArray addObject:copiedValue_0];
}
_mapList = [NSArray arrayWithObjects:&_mapListTempVector[0] count:_mapListTempVector.size()];
_mapList = _mapListTempArray;
}
return self;
}
......@@ -46,45 +36,5 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppMapListRecord:(const ::MapListRecord &)mapListRecord
{
if (self = [super init]) {
std::vector<NSDictionary *> _mapListTempVector;
_mapListTempVector.reserve(mapListRecord.map_list.size());
for (const auto & cppValue_0 : mapListRecord.map_list) {
std::vector<NSString *> objcValue_0TempKeyVector;
objcValue_0TempKeyVector.reserve(cppValue_0.size());
std::vector<NSNumber *> objcValue_0TempValueVector;
objcValue_0TempValueVector.reserve(cppValue_0.size());
for (const auto & cppPair_1 : cppValue_0) {
NSString *objcKey_1 = ::djinni::String::fromCpp(cppPair_1.first);
NSNumber *objcValue_1 = ::djinni::I64::Boxed::fromCpp(cppPair_1.second);
objcValue_0TempKeyVector.push_back(objcKey_1);
objcValue_0TempValueVector.push_back(objcValue_1);
}
NSDictionary *objcValue_0 = [NSDictionary dictionaryWithObjects:&objcValue_0TempValueVector[0] forKeys:&objcValue_0TempKeyVector[0] count:cppValue_0.size()];
_mapListTempVector.push_back(objcValue_0);
}
_mapList = [NSArray arrayWithObjects:&_mapListTempVector[0] count:_mapListTempVector.size()];
}
return self;
}
- (::MapListRecord)cppMapListRecord
{
std::vector<std::unordered_map<std::string, int64_t>> mapList;
mapList.reserve([_mapList count]);
for (NSDictionary *objcValue_0 in _mapList) {
std::unordered_map<std::string, int64_t> cppValue_0;
for (id objcKey_1 in objcValue_0) {
std::string cppKey_1 = ::djinni::String::toCpp(objcKey_1);
int64_t cppValue_1 = ::djinni::I64::Boxed::toCpp([objcValue_0 objectForKey:objcKey_1]);
cppValue_0.emplace(std::move(cppKey_1), std::move(cppValue_1));
}
mapList.push_back(std::move(cppValue_0));
}
return ::MapListRecord(
std::move(mapList));
}
@end
......@@ -3,11 +3,22 @@
#import "DBMapRecord.h"
#include "map_record.hpp"
#import <Foundation/Foundation.h>
@interface DBMapRecord ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppMapRecord:(const ::MapRecord &)mapRecord;
- (::MapRecord)cppMapRecord;
@class DBMapRecord;
@end
namespace djinni_generated {
struct MapRecord
{
using CppType = ::MapRecord;
using ObjcType = DBMapRecord*;
using Boxed = MapRecord;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from map.djinni
#import "DBMapRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto MapRecord::toCpp(ObjcType obj) -> CppType
{
assert(obj);
std::unordered_map<std::string, int64_t> map;
for (id objcKey_0 in obj.map) {
std::string cppKey_0 = ::djinni::String::toCpp(objcKey_0);
int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp([obj.map objectForKey:objcKey_0]);
map.emplace(std::move(cppKey_0), std::move(cppValue_0));
}
return ::MapRecord(
map);
}
auto MapRecord::fromCpp(const CppType& cpp) -> ObjcType
{
std::vector<NSString *> mapTempKeyVector;
mapTempKeyVector.reserve(cpp.map.size());
std::vector<NSNumber *> mapTempValueVector;
mapTempValueVector.reserve(cpp.map.size());
for (const auto & cppPair_0 : cpp.map) {
NSString *objcKey_0 = ::djinni::String::fromCpp(cppPair_0.first);
NSNumber *objcValue_0 = ::djinni::I64::Boxed::fromCpp(cppPair_0.second);
mapTempKeyVector.push_back(objcKey_0);
mapTempValueVector.push_back(objcValue_0);
}
NSDictionary *map = [NSDictionary dictionaryWithObjects:&mapTempValueVector[0] forKeys:&mapTempKeyVector[0] count:cpp.map.size()];
return [[DBMapRecord alloc]
initWithMap:map];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface DBMapRecord : NSObject
- (id)initWithMapRecord:(DBMapRecord *)mapRecord;
- (id)initWithMap:(NSDictionary *)map;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from map.djinni
#import "DBMapRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBMapRecord.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBMapRecord
- (id)initWithMapRecord:(DBMapRecord *)mapRecord
{
if (self = [super init]) {
std::vector<NSString *> _mapTempKeyVector;
_mapTempKeyVector.reserve([mapRecord.map count]);
std::vector<NSNumber *> _mapTempValueVector;
_mapTempValueVector.reserve([mapRecord.map count]);
for (NSString *key_0 in mapRecord.map) {
NSNumber *copiedValue_0;
_mapTempKeyVector.push_back(key_0);
NSNumber *value_0 = [mapRecord.map objectForKey:key_0];
NSMutableDictionary *_mapTempDictionary = [NSMutableDictionary dictionaryWithCapacity:[mapRecord.map count]];
for (id key_0 in mapRecord.map) {
id copiedKey_0, copiedValue_0;
copiedKey_0 = [key_0 copy];
id value_0 = [mapRecord.map objectForKey:key_0];
copiedValue_0 = value_0;
_mapTempValueVector.push_back(copiedValue_0);
[_mapTempDictionary setObject:copiedValue_0 forKey:copiedKey_0];
}
_map = [NSDictionary dictionaryWithObjects:&_mapTempValueVector[0] forKeys:&_mapTempKeyVector[0] count:[mapRecord.map count]];
_map = _mapTempDictionary;
}
return self;
}
......@@ -39,34 +30,5 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppMapRecord:(const ::MapRecord &)mapRecord
{
if (self = [super init]) {
std::vector<NSString *> _mapTempKeyVector;
_mapTempKeyVector.reserve(mapRecord.map.size());
std::vector<NSNumber *> _mapTempValueVector;
_mapTempValueVector.reserve(mapRecord.map.size());
for (const auto & cppPair_0 : mapRecord.map) {
NSString *objcKey_0 = ::djinni::String::fromCpp(cppPair_0.first);
NSNumber *objcValue_0 = ::djinni::I64::Boxed::fromCpp(cppPair_0.second);
_mapTempKeyVector.push_back(objcKey_0);
_mapTempValueVector.push_back(objcValue_0);
}
_map = [NSDictionary dictionaryWithObjects:&_mapTempValueVector[0] forKeys:&_mapTempKeyVector[0] count:mapRecord.map.size()];
}
return self;
}
- (::MapRecord)cppMapRecord
{
std::unordered_map<std::string, int64_t> map;
for (id objcKey_0 in _map) {
std::string cppKey_0 = ::djinni::String::toCpp(objcKey_0);
int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp([_map objectForKey:objcKey_0]);
map.emplace(std::move(cppKey_0), std::move(cppValue_0));
}
return ::MapRecord(
std::move(map));
}
@end
......@@ -3,11 +3,22 @@
#import "DBNestedCollection.h"
#include "nested_collection.hpp"
#import <Foundation/Foundation.h>
@interface DBNestedCollection ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppNestedCollection:(const ::NestedCollection &)nestedCollection;
- (::NestedCollection)cppNestedCollection;
@class DBNestedCollection;
@end
namespace djinni_generated {
struct NestedCollection
{
using CppType = ::NestedCollection;
using ObjcType = DBNestedCollection*;
using Boxed = NestedCollection;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from nested_collection.djinni
#import "DBNestedCollection+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto NestedCollection::toCpp(ObjcType obj) -> CppType
{
assert(obj);
std::vector<std::unordered_set<std::string>> set_list;
set_list.reserve([obj.setList count]);
for (NSSet *objcValue_0 in obj.setList) {
std::unordered_set<std::string> cppValue_0;
for (NSString *objcValue_1 in objcValue_0) {
std::string cppValue_1 = ::djinni::String::toCpp(objcValue_1);
cppValue_0.insert(std::move(cppValue_1));
}
set_list.push_back(std::move(cppValue_0));
}
return ::NestedCollection(
set_list);
}
auto NestedCollection::fromCpp(const CppType& cpp) -> ObjcType
{
std::vector<NSSet *> setListTempVector;
setListTempVector.reserve(cpp.set_list.size());
for (const auto & cppValue_0 : cpp.set_list) {
std::vector<NSString *> objcValue_0TempVector;
objcValue_0TempVector.reserve(cppValue_0.size());
for (const auto & cppValue_1 : cppValue_0) {
NSString *objcValue_1 = ::djinni::String::fromCpp(cppValue_1);
objcValue_0TempVector.push_back(objcValue_1);
}
NSSet *objcValue_0 = [NSSet setWithObjects:&objcValue_0TempVector[0] count:objcValue_0TempVector.size()];
setListTempVector.push_back(objcValue_0);
}
NSArray *setList = [NSArray arrayWithObjects:&setListTempVector[0] count:setListTempVector.size()];
return [[DBNestedCollection alloc]
initWithSetList:setList];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface DBNestedCollection : NSObject
- (id)initWithNestedCollection:(DBNestedCollection *)nestedCollection;
- (id)initWithSetList:(NSArray *)setList;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from nested_collection.djinni
#import "DBNestedCollection+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBNestedCollection.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBNestedCollection
- (id)initWithNestedCollection:(DBNestedCollection *)nestedCollection
{
if (self = [super init]) {
std::vector<NSSet *> _setListTempVector;
_setListTempVector.reserve([nestedCollection.setList count]);
NSMutableArray *_setListTempArray = [NSMutableArray arrayWithCapacity:[nestedCollection.setList count]];
for (NSSet *currentValue_0 in nestedCollection.setList) {
NSSet *copiedValue_0;
std::vector<NSString *> copiedValue_0TempVector;
copiedValue_0TempVector.reserve([currentValue_0 count]);
id copiedValue_0;
NSMutableSet *copiedValue_0TempSet = [NSMutableSet setWithCapacity:[currentValue_0 count]];
for (NSString *currentValue_1 in currentValue_0) {
NSString *copiedValue_1;
id copiedValue_1;
copiedValue_1 = [currentValue_1 copy];
copiedValue_0TempVector.push_back(copiedValue_1);
[copiedValue_0TempSet addObject:copiedValue_1];
}
copiedValue_0 = [NSSet setWithObjects:&copiedValue_0TempVector[0] count:copiedValue_0TempVector.size()];
_setListTempVector.push_back(copiedValue_0);
copiedValue_0 = copiedValue_0TempSet;
[_setListTempArray addObject:copiedValue_0];
}
_setList = [NSArray arrayWithObjects:&_setListTempVector[0] count:_setListTempVector.size()];
_setList = _setListTempArray;
}
return self;
}
......@@ -42,40 +34,5 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppNestedCollection:(const ::NestedCollection &)nestedCollection
{
if (self = [super init]) {
std::vector<NSSet *> _setListTempVector;
_setListTempVector.reserve(nestedCollection.set_list.size());
for (const auto & cppValue_0 : nestedCollection.set_list) {
std::vector<NSString *> objcValue_0TempVector;
objcValue_0TempVector.reserve(cppValue_0.size());
for (const auto & cppValue_1 : cppValue_0) {
NSString *objcValue_1 = ::djinni::String::fromCpp(cppValue_1);
objcValue_0TempVector.push_back(objcValue_1);
}
NSSet *objcValue_0 = [NSSet setWithObjects:&objcValue_0TempVector[0] count:objcValue_0TempVector.size()];
_setListTempVector.push_back(objcValue_0);
}
_setList = [NSArray arrayWithObjects:&_setListTempVector[0] count:_setListTempVector.size()];
}
return self;
}
- (::NestedCollection)cppNestedCollection
{
std::vector<std::unordered_set<std::string>> setList;
setList.reserve([_setList count]);
for (NSSet *objcValue_0 in _setList) {
std::unordered_set<std::string> cppValue_0;
for (NSString *objcValue_1 in objcValue_0) {
std::string cppValue_1 = ::djinni::String::toCpp(objcValue_1);
cppValue_0.insert(std::move(cppValue_1));
}
setList.push_back(std::move(cppValue_0));
}
return ::NestedCollection(
std::move(setList));
}
@end
......@@ -3,11 +3,22 @@
#import "DBPrimitiveList.h"
#include "primitive_list.hpp"
#import <Foundation/Foundation.h>
@interface DBPrimitiveList ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppPrimitiveList:(const ::PrimitiveList &)primitiveList;
- (::PrimitiveList)cppPrimitiveList;
@class DBPrimitiveList;
@end
namespace djinni_generated {
struct PrimitiveList
{
using CppType = ::PrimitiveList;
using ObjcType = DBPrimitiveList*;
using Boxed = PrimitiveList;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from primitive_list.djinni
#import "DBPrimitiveList+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto PrimitiveList::toCpp(ObjcType obj) -> CppType
{
assert(obj);
std::vector<int64_t> list;
list.reserve([obj.list count]);
for (NSNumber *objcValue_0 in obj.list) {
int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp(objcValue_0);
list.push_back(std::move(cppValue_0));
}
return ::PrimitiveList(
list);
}
auto PrimitiveList::fromCpp(const CppType& cpp) -> ObjcType
{
std::vector<NSNumber *> listTempVector;
listTempVector.reserve(cpp.list.size());
for (const auto & cppValue_0 : cpp.list) {
NSNumber *objcValue_0 = ::djinni::I64::Boxed::fromCpp(cppValue_0);
listTempVector.push_back(objcValue_0);
}
NSArray *list = [NSArray arrayWithObjects:&listTempVector[0] count:listTempVector.size()];
return [[DBPrimitiveList alloc]
initWithList:list];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface DBPrimitiveList : NSObject
- (id)initWithPrimitiveList:(DBPrimitiveList *)primitiveList;
- (id)initWithList:(NSArray *)list;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from primitive_list.djinni
#import "DBPrimitiveList+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBPrimitiveList.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBPrimitiveList
- (id)initWithPrimitiveList:(DBPrimitiveList *)primitiveList
{
if (self = [super init]) {
std::vector<NSNumber *> _listTempVector;
_listTempVector.reserve([primitiveList.list count]);
NSMutableArray *_listTempArray = [NSMutableArray arrayWithCapacity:[primitiveList.list count]];
for (NSNumber *currentValue_0 in primitiveList.list) {
NSNumber *copiedValue_0;
id copiedValue_0;
copiedValue_0 = currentValue_0;
_listTempVector.push_back(copiedValue_0);
[_listTempArray addObject:copiedValue_0];
}
_list = [NSArray arrayWithObjects:&_listTempVector[0] count:_listTempVector.size()];
_list = _listTempArray;
}
return self;
}
......@@ -35,30 +28,5 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppPrimitiveList:(const ::PrimitiveList &)primitiveList
{
if (self = [super init]) {
std::vector<NSNumber *> _listTempVector;
_listTempVector.reserve(primitiveList.list.size());
for (const auto & cppValue_0 : primitiveList.list) {
NSNumber *objcValue_0 = ::djinni::I64::Boxed::fromCpp(cppValue_0);
_listTempVector.push_back(objcValue_0);
}
_list = [NSArray arrayWithObjects:&_listTempVector[0] count:_listTempVector.size()];
}
return self;
}
- (::PrimitiveList)cppPrimitiveList
{
std::vector<int64_t> list;
list.reserve([_list count]);
for (NSNumber *objcValue_0 in _list) {
int64_t cppValue_0 = ::djinni::I64::Boxed::toCpp(objcValue_0);
list.push_back(std::move(cppValue_0));
}
return ::PrimitiveList(
std::move(list));
}
@end
......@@ -3,11 +3,22 @@
#import "DBRecordWithDerivings.h"
#include "record_with_derivings.hpp"
#import <Foundation/Foundation.h>
@interface DBRecordWithDerivings ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppRecordWithDerivings:(const ::RecordWithDerivings &)recordWithDerivings;
- (::RecordWithDerivings)cppRecordWithDerivings;
@class DBRecordWithDerivings;
@end
namespace djinni_generated {
struct RecordWithDerivings
{
using CppType = ::RecordWithDerivings;
using ObjcType = DBRecordWithDerivings*;
using Boxed = RecordWithDerivings;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from derivings.djinni
#import "DBRecordWithDerivings+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto RecordWithDerivings::toCpp(ObjcType obj) -> CppType
{
assert(obj);
int32_t key1 = ::djinni::I32::toCpp(obj.key1);
std::string key2 = ::djinni::String::toCpp(obj.key2);
return ::RecordWithDerivings(
key1,
key2);
}
auto RecordWithDerivings::fromCpp(const CppType& cpp) -> ObjcType
{
int32_t key1 = ::djinni::I32::fromCpp(cpp.key1);
NSString *key2 = ::djinni::String::fromCpp(cpp.key2);
return [[DBRecordWithDerivings alloc]
initWithKey1:key1
key2:key2];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface DBRecordWithDerivings : NSObject
- (id)initWithRecordWithDerivings:(DBRecordWithDerivings *)recordWithDerivings;
- (id)initWithKey1:(int32_t)key1 key2:(NSString *)key2;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from derivings.djinni
#import "DBRecordWithDerivings+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBRecordWithDerivings.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBRecordWithDerivings
......@@ -30,23 +24,6 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppRecordWithDerivings:(const ::RecordWithDerivings &)recordWithDerivings
{
if (self = [super init]) {
_key1 = ::djinni::I32::fromCpp(recordWithDerivings.key1);
_key2 = ::djinni::String::fromCpp(recordWithDerivings.key2);
}
return self;
}
- (::RecordWithDerivings)cppRecordWithDerivings
{
int32_t key1 = ::djinni::I32::toCpp(_key1);
std::string key2 = ::djinni::String::toCpp(_key2);
return ::RecordWithDerivings(
std::move(key1),
std::move(key2));
}
- (BOOL)isEqual:(id)other
{
if (![other isKindOfClass:[DBRecordWithDerivings class]]) {
......
......@@ -3,11 +3,22 @@
#import "DBRecordWithNestedDerivings.h"
#include "record_with_nested_derivings.hpp"
#import <Foundation/Foundation.h>
@interface DBRecordWithNestedDerivings ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppRecordWithNestedDerivings:(const ::RecordWithNestedDerivings &)recordWithNestedDerivings;
- (::RecordWithNestedDerivings)cppRecordWithNestedDerivings;
@class DBRecordWithNestedDerivings;
@end
namespace djinni_generated {
struct RecordWithNestedDerivings
{
using CppType = ::RecordWithNestedDerivings;
using ObjcType = DBRecordWithNestedDerivings*;
using Boxed = RecordWithNestedDerivings;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from derivings.djinni
#import "DBRecordWithNestedDerivings+Private.h"
#import "DBRecordWithDerivings+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto RecordWithNestedDerivings::toCpp(ObjcType obj) -> CppType
{
assert(obj);
int32_t key = ::djinni::I32::toCpp(obj.key);
::RecordWithDerivings rec = ::djinni_generated::RecordWithDerivings::toCpp(obj.rec);
return ::RecordWithNestedDerivings(
key,
rec);
}
auto RecordWithNestedDerivings::fromCpp(const CppType& cpp) -> ObjcType
{
int32_t key = ::djinni::I32::fromCpp(cpp.key);
DBRecordWithDerivings *rec = ::djinni_generated::RecordWithDerivings::fromCpp(cpp.rec);
return [[DBRecordWithNestedDerivings alloc]
initWithKey:key
rec:rec];
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from derivings.djinni
#import "DBRecordWithDerivings.h"
#import <Foundation/Foundation.h>
@class DBRecordWithDerivings;
@interface DBRecordWithNestedDerivings : NSObject
- (id)initWithRecordWithNestedDerivings:(DBRecordWithNestedDerivings *)recordWithNestedDerivings;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from derivings.djinni
#import "DBRecordWithNestedDerivings+Private.h"
#import "DBRecordWithDerivings+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBRecordWithNestedDerivings.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBRecordWithNestedDerivings
......@@ -31,23 +24,6 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppRecordWithNestedDerivings:(const ::RecordWithNestedDerivings &)recordWithNestedDerivings
{
if (self = [super init]) {
_key = ::djinni::I32::fromCpp(recordWithNestedDerivings.key);
_rec = [[DBRecordWithDerivings alloc] initWithCppRecordWithDerivings:recordWithNestedDerivings.rec];
}
return self;
}
- (::RecordWithNestedDerivings)cppRecordWithNestedDerivings
{
int32_t key = ::djinni::I32::toCpp(_key);
::RecordWithDerivings rec = std::move([_rec cppRecordWithDerivings]);
return ::RecordWithNestedDerivings(
std::move(key),
std::move(rec));
}
- (BOOL)isEqual:(id)other
{
if (![other isKindOfClass:[DBRecordWithNestedDerivings class]]) {
......
......@@ -3,11 +3,22 @@
#import "DBSetRecord.h"
#include "set_record.hpp"
#import <Foundation/Foundation.h>
@interface DBSetRecord ()
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
- (id)initWithCppSetRecord:(const ::SetRecord &)setRecord;
- (::SetRecord)cppSetRecord;
@class DBSetRecord;
@end
namespace djinni_generated {
struct SetRecord
{
using CppType = ::SetRecord;
using ObjcType = DBSetRecord*;
using Boxed = SetRecord;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from set.djinni
#import "DBSetRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <cassert>
#include <utility>
#include <vector>
namespace djinni_generated {
auto SetRecord::toCpp(ObjcType obj) -> CppType
{
assert(obj);
std::unordered_set<std::string> set;
for (NSString *objcValue_0 in obj.set) {
std::string cppValue_0 = ::djinni::String::toCpp(objcValue_0);
set.insert(std::move(cppValue_0));
}
return ::SetRecord(
set);
}
auto SetRecord::fromCpp(const CppType& cpp) -> ObjcType
{
std::vector<NSString *> setTempVector;
setTempVector.reserve(cpp.set.size());
for (const auto & cppValue_0 : cpp.set) {
NSString *objcValue_0 = ::djinni::String::fromCpp(cppValue_0);
setTempVector.push_back(objcValue_0);
}
NSSet *set = [NSSet setWithObjects:&setTempVector[0] count:setTempVector.size()];
return [[DBSetRecord alloc]
initWithSet:set];
}
} // namespace djinni_generated
......@@ -3,7 +3,6 @@
#import <Foundation/Foundation.h>
@interface DBSetRecord : NSObject
- (id)initWithSetRecord:(DBSetRecord *)setRecord;
- (id)initWithSet:(NSSet *)set;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from set.djinni
#import "DBSetRecord+Private.h"
#import "DJIDate.h"
#import "DJIMarshal+Private.h"
#import <Foundation/Foundation.h>
#include <utility>
#include <vector>
#import "DBSetRecord.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@implementation DBSetRecord
- (id)initWithSetRecord:(DBSetRecord *)setRecord
{
if (self = [super init]) {
std::vector<NSString *> _setTempVector;
_setTempVector.reserve([setRecord.set count]);
NSMutableSet *_setTempSet = [NSMutableSet setWithCapacity:[setRecord.set count]];
for (NSString *currentValue_0 in setRecord.set) {
NSString *copiedValue_0;
id copiedValue_0;
copiedValue_0 = [currentValue_0 copy];
_setTempVector.push_back(copiedValue_0);
[_setTempSet addObject:copiedValue_0];
}
_set = [NSSet setWithObjects:&_setTempVector[0] count:_setTempVector.size()];
_set = _setTempSet;
}
return self;
}
......@@ -35,29 +28,5 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
return self;
}
- (id)initWithCppSetRecord:(const ::SetRecord &)setRecord
{
if (self = [super init]) {
std::vector<NSString *> _setTempVector;
_setTempVector.reserve(setRecord.set.size());
for (const auto & cppValue_0 : setRecord.set) {
NSString *objcValue_0 = ::djinni::String::fromCpp(cppValue_0);
_setTempVector.push_back(objcValue_0);
}
_set = [NSSet setWithObjects:&_setTempVector[0] count:_setTempVector.size()];
}
return self;
}
- (::SetRecord)cppSetRecord
{
std::unordered_set<std::string> set;
for (NSString *objcValue_0 in _set) {
std::string cppValue_0 = ::djinni::String::toCpp(objcValue_0);
set.insert(std::move(cppValue_0));
}
return ::SetRecord(
std::move(set));
}
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from test.djinni
#import "DBAssortedIntegers.h"
#import "DBColor.h"
#import "DBMapListRecord.h"
#import "DBNestedCollection.h"
#import "DBPrimitiveList.h"
#import "DBSetRecord.h"
#import <Foundation/Foundation.h>
@class DBAssortedIntegers;
@class DBMapListRecord;
@class DBNestedCollection;
@class DBPrimitiveList;
@class DBSetRecord;
@class DBToken;
@protocol DBClientInterface;
......
......@@ -58,14 +58,14 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBSetRecord *)getSetRecord {
try {
::SetRecord cppRet = ::TestHelpers::get_set_record();
DBSetRecord *objcRet = [[DBSetRecord alloc] initWithCppSetRecord:cppRet];
DBSetRecord *objcRet = ::djinni_generated::SetRecord::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkSetRecord:(DBSetRecord *)rec {
try {
::SetRecord cppRec = std::move([rec cppSetRecord]);
::SetRecord cppRec = ::djinni_generated::SetRecord::toCpp(rec);
bool cppRet = ::TestHelpers::check_set_record(std::move(cppRec));
BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet;
......@@ -75,14 +75,14 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBPrimitiveList *)getPrimitiveList {
try {
::PrimitiveList cppRet = ::TestHelpers::get_primitive_list();
DBPrimitiveList *objcRet = [[DBPrimitiveList alloc] initWithCppPrimitiveList:cppRet];
DBPrimitiveList *objcRet = ::djinni_generated::PrimitiveList::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkPrimitiveList:(DBPrimitiveList *)pl {
try {
::PrimitiveList cppPl = std::move([pl cppPrimitiveList]);
::PrimitiveList cppPl = ::djinni_generated::PrimitiveList::toCpp(pl);
bool cppRet = ::TestHelpers::check_primitive_list(std::move(cppPl));
BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet;
......@@ -92,14 +92,14 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBNestedCollection *)getNestedCollection {
try {
::NestedCollection cppRet = ::TestHelpers::get_nested_collection();
DBNestedCollection *objcRet = [[DBNestedCollection alloc] initWithCppNestedCollection:cppRet];
DBNestedCollection *objcRet = ::djinni_generated::NestedCollection::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkNestedCollection:(DBNestedCollection *)nc {
try {
::NestedCollection cppNc = std::move([nc cppNestedCollection]);
::NestedCollection cppNc = ::djinni_generated::NestedCollection::toCpp(nc);
bool cppRet = ::TestHelpers::check_nested_collection(std::move(cppNc));
BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet;
......@@ -173,14 +173,14 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBMapListRecord *)getMapListRecord {
try {
::MapListRecord cppRet = ::TestHelpers::get_map_list_record();
DBMapListRecord *objcRet = [[DBMapListRecord alloc] initWithCppMapListRecord:cppRet];
DBMapListRecord *objcRet = ::djinni_generated::MapListRecord::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkMapListRecord:(DBMapListRecord *)m {
try {
::MapListRecord cppM = std::move([m cppMapListRecord]);
::MapListRecord cppM = ::djinni_generated::MapListRecord::toCpp(m);
bool cppRet = ::TestHelpers::check_map_list_record(std::move(cppM));
BOOL objcRet = ::djinni::Bool::fromCpp(cppRet);
return objcRet;
......@@ -261,9 +261,9 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
+ (DBAssortedIntegers *)assortedIntegersId:(DBAssortedIntegers *)i {
try {
::AssortedIntegers cppI = std::move([i cppAssortedIntegers]);
::AssortedIntegers cppI = ::djinni_generated::AssortedIntegers::toCpp(i);
::AssortedIntegers cppRet = ::TestHelpers::assorted_integers_id(std::move(cppI));
DBAssortedIntegers *objcRet = [[DBAssortedIntegers alloc] initWithCppAssortedIntegers:cppRet];
DBAssortedIntegers *objcRet = ::djinni_generated::AssortedIntegers::fromCpp(cppRet);
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
}
......
#import "DBMapRecord+Private.h"
#import "DBMapRecord.h"
#import "DBMapListRecord+Private.h"
#import "DBMapListRecord.h"
#import <XCTest/XCTest.h>
#include "map_record.hpp"
......@@ -23,21 +25,21 @@
- (void)testCppToObjc
{
MapRecord cppMapRecord([self getCppMap]);
DBMapRecord *objcMapRecord = [[DBMapRecord alloc] initWithCppMapRecord:cppMapRecord];
DBMapRecord *objcMapRecord = djinni_generated::MapRecord::fromCpp(cppMapRecord);
[self checkObjcMap:objcMapRecord.map];
}
- (void)testObjcToCpp
{
DBMapRecord *objcMapRecord = [[DBMapRecord alloc] initWithMap:[self getObjcMap]];
MapRecord cppMapRecord = [objcMapRecord cppMapRecord];
MapRecord cppMapRecord = djinni_generated::MapRecord::toCpp(objcMapRecord);
[self checkCppMap:cppMapRecord.map];
}
- (void)testCppToObjcEmpty
{
MapRecord cppMapRecord{ {} };
DBMapRecord *objcMapRecord = [[DBMapRecord alloc] initWithCppMapRecord:cppMapRecord];
DBMapRecord *objcMapRecord = djinni_generated::MapRecord::fromCpp(cppMapRecord);
XCTAssertEqual([objcMapRecord.map count], (NSUInteger)0, @"Count 0 expected, actual: %lu", (unsigned long)[objcMapRecord.map count]);
}
......@@ -45,7 +47,7 @@
- (void)testObjcToCppEmpty
{
DBMapRecord *objcMapRecord = [[DBMapRecord alloc] initWithMap:[[NSDictionary alloc] init]];
MapRecord cppMapRecord = [objcMapRecord cppMapRecord];
MapRecord cppMapRecord = djinni_generated::MapRecord::toCpp(objcMapRecord);
auto & cppMap = cppMapRecord.map;
XCTAssertEqual(cppMap.size(), (size_t)0, @"Count 0 expected, actual: %zd", cppMap.size());
}
......@@ -53,7 +55,7 @@
- (void)testCppMapListToObjc
{
MapListRecord cppMapListRecord{ { [self getCppMap] } };
DBMapListRecord *objcMapListRecord = [[DBMapListRecord alloc] initWithCppMapListRecord:cppMapListRecord];
DBMapListRecord *objcMapListRecord = djinni_generated::MapListRecord::fromCpp(cppMapListRecord);
NSArray *objcMapList = objcMapListRecord.mapList;
XCTAssertEqual([objcMapList count], (NSUInteger)1, @"List with 1 map expected, actual no: %lu", (unsigned long)[objcMapList count]);
[self checkObjcMap:[objcMapList objectAtIndex:0]];
......@@ -63,7 +65,7 @@
{
NSArray *objcMapList = [[NSArray alloc] initWithObjects:[self getObjcMap], nil];
DBMapListRecord *objcMapListRecord = [[DBMapListRecord alloc] initWithMapList:objcMapList];
auto cppMapListRecord = [objcMapListRecord cppMapListRecord];
auto cppMapListRecord = djinni_generated::MapListRecord::toCpp(objcMapListRecord);
auto & cppMapList = cppMapListRecord.map_list;
XCTAssertEqual(cppMapList.size(), (size_t)1, @"List with 1 map expected, actual no: %zd", cppMapList.size());
[self checkCppMap:cppMapList[0]];
......
......@@ -27,13 +27,13 @@ static DBNestedCollection *objcNestedCollection = [[DBNestedCollection alloc] in
- (void)testCppNestedCollectionToObjc
{
DBNestedCollection *converted = [[DBNestedCollection alloc] initWithCppNestedCollection:cppNestedCollection];
DBNestedCollection *converted = djinni_generated::NestedCollection::fromCpp(cppNestedCollection);
XCTAssertEqualObjects(objcNestedCollection.setList, converted.setList, @"List expected to be equivalent");
}
- (void)testObjcNestedCollectionToCpp
{
NestedCollection converted = [objcNestedCollection cppNestedCollection];
NestedCollection converted = djinni_generated::NestedCollection::toCpp(objcNestedCollection);
XCTAssertEqual(cppNestedCollection.set_list, converted.set_list, @"List expected to be equivalent");
}
......
......@@ -35,13 +35,13 @@ static DBPrimitiveList *objcPrimitiveList = [[DBPrimitiveList alloc] initWithLis
- (void)testObjcToCppConverter
{
PrimitiveList convert = [objcPrimitiveList cppPrimitiveList];
PrimitiveList convert = djinni_generated::PrimitiveList::toCpp(objcPrimitiveList);
XCTAssertEqual(convert.list, cppPrimitiveList.list, @"C++ converted list should be the same.");
}
- (void)testCppToObjcConverter
{
DBPrimitiveList *convert = [[DBPrimitiveList alloc] initWithCppPrimitiveList:cppPrimitiveList];
DBPrimitiveList *convert = djinni_generated::PrimitiveList::fromCpp(cppPrimitiveList);
XCTAssertEqualObjects(convert.list, objcPrimitiveList.list, @"Objective-C converted list should be the same.");
}
......
......@@ -34,7 +34,7 @@
- (void)testCppToObjc
{
SetRecord cppSetRecord = [self getCppSetRecord];
DBSetRecord *objcSetRecord = [[DBSetRecord alloc] initWithCppSetRecord:cppSetRecord];
DBSetRecord *objcSetRecord = djinni_generated::SetRecord::fromCpp(cppSetRecord);
XCTAssertEqual([objcSetRecord.set count], (NSUInteger)3, @"Set length 3 expected, actual: %lu", (unsigned long)[objcSetRecord.set count]);
XCTAssert([objcSetRecord.set containsObject:@"StringA"], @"\"StringA\" expected but does not exist");
......@@ -45,7 +45,7 @@
-(void)testObjcToCpp
{
DBSetRecord *objcSetRecord = [self getObjcSetRecord];
SetRecord cppSetRecord = [objcSetRecord cppSetRecord];
SetRecord cppSetRecord = djinni_generated::SetRecord::toCpp(objcSetRecord);
auto & cppSet = cppSetRecord.set;
XCTAssertEqual(cppSet.size(), (NSUInteger)3, @"Set length 3 expected, actual: %zd", cppSet.size());
......
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