FPRClassInstrumentor.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <Foundation/Foundation.h>
  15. @class FPRSelectorInstrumentor;
  16. NS_ASSUME_NONNULL_BEGIN
  17. /**
  18. * Each instrumented class (even classes within class clusters) needs to have its own instrumentor.
  19. */
  20. @interface FPRClassInstrumentor : NSObject
  21. /** The class being instrumented. */
  22. @property(nonatomic, readonly) Class instrumentedClass;
  23. /** Please use the designated initializer. */
  24. - (instancetype)init NS_UNAVAILABLE;
  25. /** Initializes with a class name and stores a reference to that string. This is the designated
  26. * initializer.
  27. *
  28. * @param aClass The class to be instrumented.
  29. * @return An instance of this class.
  30. */
  31. - (instancetype)initWithClass:(Class)aClass NS_DESIGNATED_INITIALIZER;
  32. /** Creates and adds a class selector instrumentor to this class instrumentor.
  33. *
  34. * @param selector The selector to build and add to this class instrumentor;
  35. * @return An FPRSelectorInstrumentor if the class/selector combination exists, nil otherwise.
  36. */
  37. - (nullable FPRSelectorInstrumentor *)instrumentorForClassSelector:(SEL)selector;
  38. /** Creates and adds an instance selector instrumentor to this class instrumentor.
  39. *
  40. * @param selector The selector to build and add to this class instrumentor;
  41. * @return An FPRSelectorInstrumentor if the class/selector combination exists, nil otherwise.
  42. */
  43. - (nullable FPRSelectorInstrumentor *)instrumentorForInstanceSelector:(SEL)selector;
  44. /** Swizzles the set of selector instrumentors. */
  45. - (void)swizzle;
  46. /** Removes all selector instrumentors and unswizzles their implementations. */
  47. - (BOOL)unswizzle;
  48. @end
  49. NS_ASSUME_NONNULL_END