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

#import "DBClass2+Private.h"
#import "DBClass2.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <stdexcept>
#include <utility>

static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");

@interface DBClass2 ()

- (id)initWithCpp:(const std::shared_ptr<::package2::Class2>&)cppRef;

@end

@implementation DBClass2 {
    ::djinni::CppProxyCache::Handle<std::shared_ptr<::package2::Class2>> _cppRefHandle;
}

- (id)initWithCpp:(const std::shared_ptr<::package2::Class2>&)cppRef
{
    if (self = [super init]) {
        _cppRefHandle.assign(cppRef);
    }
    return self;
}

- (nonnull NSString *)getName {
    try {
        auto r = _cppRefHandle.get()->get_name();
        return ::djinni::String::fromCpp(r);
    } DJINNI_TRANSLATE_EXCEPTIONS()
}

namespace djinni_generated {

auto Class2::toCpp(ObjcType objc) -> CppType
{
    if (!objc) {
        return nullptr;
    }
    return objc->_cppRefHandle.get();
}

auto Class2::fromCppOpt(const CppOptType& cpp) -> ObjcType
{
    if (!cpp) {
        return nil;
    }
    return ::djinni::get_cpp_proxy<DBClass2>(cpp);
}

}  // namespace djinni_generated

@end
