File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
cldeparser-ios/cldeparser-ios Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 77//
88
99#import < Foundation/Foundation.h>
10- #include < memory>
1110
1211struct Impl;
1312
1413@interface CLDEiOSParser : NSObject {
15- std::unique_ptr< Impl> _uptrImpl ;
14+ struct Impl * _ptrImpl ;
1615}
1716
17+ -(void )printJson : (NSString *)jsonString ;
18+
1819@end
Original file line number Diff line number Diff line change @@ -59,10 +59,24 @@ - (instancetype)init {
5959 self = [super init ];
6060
6161 if (self){
62- _uptrImpl. reset ( new Impl () );
62+ _ptrImpl = new Impl ();
6363 }
6464
6565 return self;
6666}
6767
68+ - (void )printJson : (NSString *)jsonString {
69+ try {
70+ auto sptrJsonEntity = _ptrImpl->Parse (std::string ([jsonString UTF8String ]));
71+ auto json = sptrJsonEntity->CopyToString ();
72+ NSLog (@" %s " , json.c_str());
73+ } catch (CLDEParser::Exceptions::Exception& ex) {
74+ NSLog (@" %s " , ex.what());
75+ }
76+ }
77+
78+ - (void )dealloc {
79+ if (_ptrImpl != nullptr && _ptrImpl != NULL ) delete _ptrImpl;
80+ }
81+
6882@end
You can’t perform that action at this time.
0 commit comments