// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from example.djinni

#import "TXSItemList+Private.h"
#import <Foundation/Foundation.h>
#include <utility>

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]) {
        _items = [NSMutableArray arrayWithCapacity:[itemList.items count]];
        for (NSString *currentValue_0 in itemList.items) {
            id copiedValue_0;
            copiedValue_0 = [currentValue_0 copy];
            [_items addObject:copiedValue_0];
        }
    }
    return self;
}

- (id)initWithItems:(NSMutableArray *)items
{
    if (self = [super init]) {
        _items = items;
    }
    return self;
}

- (id)initWithCppItemList:(const ::textsort::ItemList &)itemList
{
    if (self = [super init]) {
        _items = [NSMutableArray arrayWithCapacity:itemList.items.size()];
        for (const auto & cppValue_0 : itemList.items) {
            NSString *objcValue_0 = [[NSString alloc] initWithBytes:cppValue_0.data()
                    length:cppValue_0.length()
                    encoding:NSUTF8StringEncoding];
            [_items addObject:objcValue_0];
        }
    }
    return self;
}

- (::textsort::ItemList)cppItemList
{
    std::vector<std::string> items;
    items.reserve([_items count]);
    for (NSString *objcValue_0 in _items) {
        std::string cppValue_0([objcValue_0 UTF8String], [objcValue_0 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
        items.push_back(std::move(cppValue_0));
    }
    return ::textsort::ItemList(
            std::move(items));
}

@end
