OLD | NEW |
1 //------------------------------------------------------------------------------
--------- | 1 /* |
2 // $Id$ | 2 * Copyright (c) 2009-2015 Erik Doernenburg and contributors |
3 // Copyright (c) 2009-2010 by Mulle Kybernetik. See License file for details. | 3 * |
4 //------------------------------------------------------------------------------
--------- | 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 */ |
5 | 16 |
6 #import <Foundation/Foundation.h> | 17 #import <Foundation/Foundation.h> |
7 | 18 |
8 @interface OCMArg : NSObject | 19 @interface OCMArg : NSObject |
9 | 20 |
10 // constraining arguments | 21 // constraining arguments |
11 | 22 |
12 + (id)any; | 23 + (id)any; |
| 24 + (SEL)anySelector; |
13 + (void *)anyPointer; | 25 + (void *)anyPointer; |
| 26 + (id __autoreleasing *)anyObjectRef; |
14 + (id)isNil; | 27 + (id)isNil; |
15 + (id)isNotNil; | 28 + (id)isNotNil; |
| 29 + (id)isEqual:(id)value; |
16 + (id)isNotEqual:(id)value; | 30 + (id)isNotEqual:(id)value; |
| 31 + (id)isKindOfClass:(Class)cls; |
17 + (id)checkWithSelector:(SEL)selector onObject:(id)anObject; | 32 + (id)checkWithSelector:(SEL)selector onObject:(id)anObject; |
18 #if NS_BLOCKS_AVAILABLE | 33 + (id)checkWithBlock:(BOOL (^)(id obj))block; |
19 + (id)checkWithBlock:(BOOL (^)(id))block; | |
20 #endif | |
21 | 34 |
22 // manipulating arguments | 35 // manipulating arguments |
23 | 36 |
24 + (id *)setTo:(id)value; | 37 + (id *)setTo:(id)value; |
| 38 + (void *)setToValue:(NSValue *)value; |
25 | 39 |
26 // internal use only | 40 // internal use only |
27 | 41 |
28 + (id)resolveSpecialValues:(NSValue *)value; | 42 + (id)resolveSpecialValues:(NSValue *)value; |
29 | 43 |
30 @end | 44 @end |
31 | 45 |
32 #define OCMOCK_ANY [OCMArg any] | 46 #define OCMOCK_ANY [OCMArg any] |
33 #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__t
ypeof__(variable))] | 47 |
| 48 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) |
| 49 #define OCMOCK_VALUE(variable) \ |
| 50 ({ __typeof__(variable) __v = (variable); [NSValue value:&__v withObjCType:@
encode(__typeof__(__v))]; }) |
| 51 #else |
| 52 #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(_
_typeof__(variable))] |
| 53 #endif |
OLD | NEW |