FLEXBlockDescription.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // FLEXBlockDescription.h
  3. // FLEX
  4. //
  5. // Created by Oliver Letterer on 2012-09-01
  6. // Forked from CTObjectiveCRuntimeAdditions (MIT License)
  7. // https://github.com/ebf/CTObjectiveCRuntimeAdditions
  8. //
  9. // Copyright (c) 2012 EBF-EDV Beratung Föllmer GmbH
  10. // Permission is hereby granted, free of charge, to any person obtaining a copy of this
  11. // software and associated documentation files (the "Software"), to deal in the Software
  12. // without restriction, including without limitation the rights to use, copy, modify, merge,
  13. // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  14. // to whom the Software is furnished to do so, subject to the following conditions:
  15. // The above copyright notice and this permission notice shall be included in all copies or
  16. // substantial portions of the Software.
  17. //
  18. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
  19. // BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  20. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  21. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23. #import <Foundation/Foundation.h>
  24. typedef NS_OPTIONS(NSUInteger, FLEXBlockOptions) {
  25. FLEXBlockOptionHasCopyDispose = (1 << 25),
  26. FLEXBlockOptionHasCtor = (1 << 26), // helpers have C++ code
  27. FLEXBlockOptionIsGlobal = (1 << 28),
  28. FLEXBlockOptionHasStret = (1 << 29), // IFF BLOCK_HAS_SIGNATURE
  29. FLEXBlockOptionHasSignature = (1 << 30),
  30. };
  31. NS_ASSUME_NONNULL_BEGIN
  32. #pragma mark -
  33. @interface FLEXBlockDescription : NSObject
  34. + (instancetype)describing:(id)block;
  35. @property (nonatomic, readonly, nullable) NSMethodSignature *signature;
  36. @property (nonatomic, readonly, nullable) NSString *signatureString;
  37. @property (nonatomic, readonly, nullable) NSString *sourceDeclaration;
  38. @property (nonatomic, readonly) FLEXBlockOptions flags;
  39. @property (nonatomic, readonly) NSUInteger size;
  40. @property (nonatomic, readonly) NSString *summary;
  41. @property (nonatomic, readonly) id block;
  42. - (BOOL)isCompatibleForBlockSwizzlingWithMethodSignature:(NSMethodSignature *)methodSignature;
  43. @end
  44. #pragma mark -
  45. @interface NSBlock : NSObject
  46. - (void)invoke;
  47. @end
  48. NS_ASSUME_NONNULL_END