Last active
October 9, 2015 11:31
-
-
Save awalter/99c665d74cf0b614b9ae to your computer and use it in GitHub Desktop.
Project for reproduction of shared pointer issue seen in OCMock 3.1 & 3.2 https://github.com/erikdoe/ocmock/issues/254
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
#import <Foundation/Foundation.h> | |
#ifdef __cplusplus | |
#include "someCplusplusfile.hpp" | |
#endif | |
@interface AnMMFile : NSObject | |
@property (readonly) NSString *name; | |
-(id) init; | |
#ifdef __cplusplus | |
@property (readonly) std::shared_ptr<someCplusplusfile> someCplusplusfile; | |
#endif | |
-(NSString*) getInternalString; | |
@end |
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
#import "AnMMFile.h" | |
@implementation AnMMFile { | |
std::shared_ptr<someCplusplusfile> _someCplusplusfile; | |
NSString *_name; | |
} | |
- (id)init { | |
if ((self = [super init])) { | |
_someCplusplusfile = std::make_shared<someCplusplusfile>(); | |
_name = @"someName"; | |
} | |
return self; | |
} | |
-(NSString*) getInternalString { | |
return [NSString stringWithCString:_someCplusplusfile->getId().c_str() encoding:[NSString defaultCStringEncoding]]; | |
} | |
- (std::shared_ptr<someCplusplusfile>)someCplusplusfile { | |
return _someCplusplusfile; | |
} | |
@end |
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
#include "someCplusplusfile.hpp" | |
std::string someCplusplusfile::getId() | |
{ | |
return "someString"; | |
} |
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
#ifndef someCplusplusfile_hpp | |
#define someCplusplusfile_hpp | |
#include <string> | |
class someCplusplusfile | |
{ | |
public: | |
someCplusplusfile(){} | |
~someCplusplusfile(){} | |
std::string getId(); | |
}; | |
#endif /* someCplusplusfile_hpp */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment