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

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


@implementation DBSetRecord

- (id)initWithSetRecord:(DBSetRecord *)setRecord
{
    if (self = [super init]) {
        _set = [NSMutableSet setWithCapacity:[setRecord.set count]];
        for (NSString *currentValue_0 in setRecord.set) {
            id copiedValue_0;
            copiedValue_0 = [currentValue_0 copy];
            [_set addObject:copiedValue_0];
        }
    }
    return self;
}

- (id)initWithSet:(NSMutableSet *)set
{
    if (self = [super init]) {
        _set = set;
    }
    return self;
}

- (id)initWithCppSetRecord:(const SetRecord &)setRecord
{
    if (self = [super init]) {
        _set = [NSMutableSet setWithCapacity:setRecord.set.size()];
        for (const auto & cppValue_0 : setRecord.set) {
            NSString *objcValue_0 = [[NSString alloc] initWithBytes:cppValue_0.data()
                    length:cppValue_0.length()
                    encoding:NSUTF8StringEncoding];
            [_set addObject:objcValue_0];
        }
    }
    return self;
}

- (SetRecord)cppSetRecord
{
    std::unordered_set<std::string> set;
    for (NSString *objcValue_0 in _set) {
        std::string cppValue_0([objcValue_0 UTF8String], [objcValue_0 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
        set.insert(std::move(cppValue_0));
    }
    return SetRecord(
            std::move(set));
}

@end
