Delete old ScreenOrientationDelegte
[chromium-blink-merge.git] / third_party / ocmock / OCMock / OCMArg.m
bloba73e3dfaf4d7df6bd37847c6045bf45e0386fe9a
1 //---------------------------------------------------------------------------------------
2 //  $Id$
3 //  Copyright (c) 2009-2010 by Mulle Kybernetik. See License file for details.
4 //---------------------------------------------------------------------------------------
6 #import <objc/runtime.h>
7 #import <OCMock/OCMArg.h>
8 #import <OCMock/OCMConstraint.h>
9 #import "OCMPassByRefSetter.h"
10 #import "OCMConstraint.h"
12 @implementation OCMArg
14 + (id)any
16         return [OCMAnyConstraint constraint];
19 + (void *)anyPointer
21         return (void *)0x01234567;
24 + (id)isNil
26         return [OCMIsNilConstraint constraint];
29 + (id)isNotNil
31         return [OCMIsNotNilConstraint constraint];
34 + (id)isNotEqual:(id)value
36         OCMIsNotEqualConstraint *constraint = [OCMIsNotEqualConstraint constraint];
37         constraint->testValue = value;
38         return constraint;
41 + (id)checkWithSelector:(SEL)selector onObject:(id)anObject
43         return [OCMConstraint constraintWithSelector:selector onObject:anObject];
46 #if NS_BLOCKS_AVAILABLE
48 + (id)checkWithBlock:(BOOL (^)(id))block 
50         return [[[OCMBlockConstraint alloc] initWithConstraintBlock:block] autorelease];
53 #endif
55 + (id *)setTo:(id)value
57         return (id *)[[[OCMPassByRefSetter alloc] initWithValue:value] autorelease];
60 + (id)resolveSpecialValues:(NSValue *)value
62         const char *type = [value objCType];
63         if(type[0] == '^')
64         {
65                 void *pointer = [value pointerValue];
66                 if(pointer == (void *)0x01234567)
67                         return [OCMArg any];
68                 if((pointer != NULL) && (object_getClass((id)pointer) == [OCMPassByRefSetter class]))
69                         return (id)pointer;
70         }
71         return value;
74 @end