GINArgument.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. /**
  18. * @class GINArgument
  19. * @abstract Encapsulates an argument that is passed to a method.
  20. */
  21. @interface GINArgument : NSObject
  22. /**
  23. * @method argumentWithObject:
  24. * @abstract Creates an GINArgument with an NSObject.
  25. * @param object The NSObject representing the value of the argument.
  26. * @return An instance of GINArgument.
  27. */
  28. + (instancetype)argumentWithObject:(NSObject *)object;
  29. /**
  30. * @method argumentWithInteger:
  31. * @abstract Creates an GINArgument with an NSObject.
  32. * @param integer The NSInteger representing the value of the argument.
  33. * @return An instance of GINArgument.
  34. */
  35. + (instancetype)argumentWithInteger:(NSInteger)integer;
  36. /**
  37. * @method setNextArgumentInList:inInvocation:
  38. * @abstract Reads the next argument in |argumentList| and sets it in the |invocation| object.
  39. * @param argumentList The list of arguments. Each entry must be of type GINArgument.
  40. * @param index The argument index to set on the |invocation| object.
  41. * @param invocation The invocation object to set the argument to.
  42. * @return YES if the argument was set, NO if there were no arguments left in the list.
  43. */
  44. + (BOOL)setNextArgumentInList:(va_list)argumentList
  45. atIndex:(NSUInteger)index
  46. inInvocation:(NSInvocation *)invocation;
  47. @end