react-native-navigation的迁移库

OCMConstraint.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) 2007-2016 Erik Doernenburg and contributors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  5. * not use these files except in compliance with the License. You may obtain
  6. * 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, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations
  14. * under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. @interface OCMConstraint : NSObject
  18. + (instancetype)constraint;
  19. - (BOOL)evaluate:(id)value;
  20. // if you are looking for any, isNil, etc, they have moved to OCMArg
  21. // try to use [OCMArg checkWith...] instead of the constraintWith... methods below
  22. + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject;
  23. + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue;
  24. @end
  25. @interface OCMAnyConstraint : OCMConstraint
  26. @end
  27. @interface OCMIsNilConstraint : OCMConstraint
  28. @end
  29. @interface OCMIsNotNilConstraint : OCMConstraint
  30. @end
  31. @interface OCMIsNotEqualConstraint : OCMConstraint
  32. {
  33. @public
  34. id testValue;
  35. }
  36. @end
  37. @interface OCMInvocationConstraint : OCMConstraint
  38. {
  39. @public
  40. NSInvocation *invocation;
  41. }
  42. @end
  43. @interface OCMBlockConstraint : OCMConstraint
  44. {
  45. BOOL (^block)(id);
  46. }
  47. - (instancetype)initWithConstraintBlock:(BOOL (^)(id))block;
  48. @end
  49. #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self]
  50. #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)]