Created
March 26, 2017 17:39
-
-
Save bartlomiejn/b4a2f810598ac24626964b96ba42869a to your computer and use it in GitHub Desktop.
Objective-C++ C++ class wrapper for swifty-exporations.ghost.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface CppClassWrapper () | |
@property (nonatomic) CppClass* cppClass; | |
@end | |
@implementation CppClassWrapper | |
- (void)setStoredValue:(NSString*) storedValue { | |
self.cppClass->storedValue = [storedValue UTF8String]; | |
} | |
- (NSString*)storedValue { | |
return [NSString stringWithUTF8String:self.cppClass->storedValue]; | |
} | |
- (instancetype)initWithStoredValue:(NSString*)value { | |
if ((self = [super init]) == nil) { | |
return nil; | |
} | |
self.cppClass = new CppClass([value UTF8String]); | |
return self; | |
} | |
- (void)dealloc { | |
delete self.cppClass; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment