FLEXIvar.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // FLEXIvar.h
  3. // FLEX
  4. //
  5. // Derived from MirrorKit.
  6. // Created by Tanner on 6/30/15.
  7. // Copyright (c) 2015 Tanner Bennett. All rights reserved.
  8. //
  9. #import <Foundation/Foundation.h>
  10. #import "FLEXRuntimeUtility.h"
  11. #import <objc/runtime.h>
  12. @interface FLEXIvar : NSObject
  13. + (instancetype)ivar:(Ivar)ivar;
  14. + (instancetype)named:(NSString *)name onClass:(Class)cls;
  15. /// The underlying \c Ivar data structure.
  16. @property (nonatomic, readonly) Ivar objc_ivar;
  17. /// The name of the instance variable.
  18. @property (nonatomic, readonly) NSString *name;
  19. /// The type of the instance variable.
  20. @property (nonatomic, readonly) FLEXTypeEncoding type;
  21. /// The type encoding string of the instance variable.
  22. @property (nonatomic, readonly) NSString *typeEncoding;
  23. /// The offset of the instance variable.
  24. @property (nonatomic, readonly) NSInteger offset;
  25. /// The size of the instance variable. 0 if unknown.
  26. @property (nonatomic, readonly) NSUInteger size;
  27. /// Describes the type encoding, size, offset, and objc_ivar
  28. @property (nonatomic, readonly) NSString *details;
  29. /// For internal use
  30. @property (nonatomic) id tag;
  31. - (id)getValue:(id)target;
  32. - (void)setValue:(id)value onObject:(id)target;
  33. /// Calls into -getValue: and passes that value into
  34. /// -[FLEXRuntimeUtility potentiallyUnwrapBoxedPointer:type:]
  35. /// and returns the result
  36. - (id)getPotentiallyUnboxedValue:(id)target;
  37. @end