forked from Polidea/ios-class-guard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Added CDOCClassReference to wrap any of a CDOCClass, CDSymbol, or NS…
…String (class name) and use that to infer the class name and whether or not the class is external -Use that class instead of a weakly typed property for CDOCClass’s superClassRef and CDOCCategory’s classRef
- Loading branch information
Showing
10 changed files
with
114 additions
and
40 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// -*- mode: ObjC -*- | ||
|
||
// This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files. | ||
// Copyright (C) 1997-1998, 2000-2001, 2004-2013 Steve Nygard. | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@class CDOCClass, CDSymbol; | ||
|
||
/*! | ||
* CDOCClassReference acts as a proxy object to a class that may be external. It can thus be repesented | ||
* as one of: a \c CDOCClass object (for internal classes), a \c CDSymbol object (for external classes), | ||
* or an \c NSString of the class name (for ObjC1 compatibility). The class name can then be inferred from | ||
* any of these representations. | ||
*/ | ||
@interface CDOCClassReference : NSObject | ||
|
||
@property (strong) CDOCClass *classObject; | ||
@property (strong) CDSymbol *classSymbol; | ||
@property (nonatomic, copy) NSString *className; // inferred from classObject / classSymbol if not set directly | ||
@property (nonatomic, readonly, getter = isExternalClass) BOOL externalClass; | ||
|
||
- (instancetype)initWithClassObject:(CDOCClass *)classObject; | ||
- (instancetype)initWithClassSymbol:(CDSymbol *)symbol; | ||
- (instancetype)initWithClassName:(NSString *)className; | ||
|
||
@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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// -*- mode: ObjC -*- | ||
|
||
// This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files. | ||
// Copyright (C) 1997-1998, 2000-2001, 2004-2013 Steve Nygard. | ||
|
||
#import "CDOCClassReference.h" | ||
#import "CDOCClass.h" | ||
#import "CDSymbol.h" | ||
|
||
@implementation CDOCClassReference | ||
|
||
- (instancetype)initWithClassSymbol:(CDSymbol *)symbol | ||
{ | ||
if ((self = [super init])) { | ||
_classSymbol = symbol; | ||
} | ||
return self; | ||
} | ||
|
||
- (instancetype)initWithClassObject:(CDOCClass *)classObject | ||
{ | ||
if ((self = [super init])) { | ||
_classObject = classObject; | ||
} | ||
return self; | ||
} | ||
|
||
- (instancetype)initWithClassName:(NSString *)className | ||
{ | ||
if ((self = [super init])) { | ||
_className = [className copy]; | ||
} | ||
return self; | ||
} | ||
|
||
- (NSString *)className | ||
{ | ||
if (_className) | ||
return _className; | ||
else if (_classObject) | ||
return [_classObject name]; | ||
else if (_classSymbol) | ||
return [CDSymbol classNameFromSymbolName:[_classSymbol name]]; | ||
else | ||
return nil; | ||
} | ||
|
||
- (BOOL)isExternalClass | ||
{ | ||
return (!_classObject && (!_classSymbol || [_classSymbol isExternal])); | ||
} | ||
|
||
@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
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
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