Remove private API support code
authorWincent Colaiuta <win@wincent.com>
Thu, 27 Sep 2007 19:07:13 +0000 (21:07 +0200)
committerWincent Colaiuta <win@wincent.com>
Thu, 27 Sep 2007 19:07:13 +0000 (21:07 +0200)
The signatureWithObjCTypes: method in NSMethodSignature is at last exposed
in Leopard, so remove the all the support code that was previously used to
(carefully) work with (or around) it and just use the now-official API.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
NSMethodSignature+WOTest.h [deleted file]
NSMethodSignature+WOTest.m [deleted file]
WOMock.m
WOProtocolMock.m
WOStub.m
WOTest.h
WOTest.xcodeproj/project.pbxproj

diff --git a/NSMethodSignature+WOTest.h b/NSMethodSignature+WOTest.h
deleted file mode 100644 (file)
index 780ed54..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-//  NSMethodSignature+WOTest.h
-//  WOTest
-//
-//  Created by Wincent Colaiuta on 30 January 2006.
-//
-//  Copyright 2006-2007 Wincent Colaiuta.
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface NSMethodSignature (WOTest)
-
-+ (id)WOTest_signatureBasedOnObjCTypes:(const char *)types;
-
-@end
diff --git a/NSMethodSignature+WOTest.m b/NSMethodSignature+WOTest.m
deleted file mode 100644 (file)
index c136779..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-//
-//  NSMethodSignature+WOTest.m
-//  WOTest
-//
-//  Created by Wincent Colaiuta on 30 January 2006.
-//
-//  Copyright 2006-2007 Wincent Colaiuta.
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "NSMethodSignature+WOTest.h"
-#import <objc/objc-class.h>
-
-/*
-
- The real 10.4 NSMethodSignature API (obtained using class-dump; TODO: run class-dump to get 10.5 API):
-
-@interface NSMethodSignature : NSObject
-{
-    char *_types;
-    int _nargs;
-    unsigned int _sizeofParams;
-    unsigned int _returnValueLength;
-    void *_parmInfoP;
-    int *_fixup;
-    void *_reserved;
-}
-
-+ (id)signatureWithObjCTypes:(const char *)fp8;
-- (BOOL)_isReturnStructInRegisters;
-- (id)retain;
-- (void)release;
-- (unsigned int)retainCount;
-- (const char *)methodReturnType;  // PUBLIC
-- (unsigned int)methodReturnLength; // PUBLIC
-- (BOOL)isOneway; // PUBLIC
-- (const char *)getArgumentTypeAtIndex:(unsigned int)fp8; // PUBLIC
-- (struct _arginfo)_argumentInfoAtIndex:(unsigned int)fp8;
-- (unsigned int)frameLength; // PUBLIC
-- (unsigned int)numberOfArguments; // PUBLIC
-- (id)description;
-- (id)debugDescription;
-
-@end
-
-The public API:
-
-@interface NSMethodSignature : NSObject {
-    @private
-    const char  *_types;
-    int         _nargs;
-    unsigned    _sizeofParams;
-    unsigned    _returnValueLength;
-    void        *_parmInfoP;
-    int         *_fixup;
-    void        *_reserved;
-}
-
-- (unsigned)numberOfArguments;
-- (const char *)getArgumentTypeAtIndex:(unsigned)index;
-- (unsigned)frameLength;
-- (BOOL)isOneway;
-- (const char *)methodReturnType;
-- (unsigned)methodReturnLength;
-
-@end
-
-Many public implementations of that use NSProxy subclasses to implement trampolines make use of the signatureWithObjCTypes: private API.
-
-Examples: OCMock
-http://www.cocoadev.com/index.pl?LSTrampoline
-http://www.cocoadev.com/index.pl?BSTrampoline
-
-See also http://www.stuffonfire.com/2005/12/signaturewithobjctypes_is_stil.html
-
- */
-
-@interface NSMethodSignature (WOApplePrivate)
-
-/*! Private Apple API. */
-+ (id)signatureWithObjCTypes:(const char *)fp8;
-
-@end
-
-@interface NSMethodSignature ()
-
-- (id)initWithObjCTypes:(const char *)types;
-
-@end
-
-@implementation NSMethodSignature (WOTest)
-
-+ (id)WOTest_signatureBasedOnObjCTypes:(const char *)types
-{
-    NSParameterAssert(types != NULL);
-
-#ifdef WO_USE_OWN_METHOD_SIGNATURE_IMPLEMENTATION
-
-    return [[self alloc] initWithObjCTypes:types];
-
-#else /* use private Apple API */
-
-    NSAssert([self respondsToSelector:@selector(signatureWithObjCTypes:)], @"signatureWithObjCTypes: selector not recognized");
-    return [self signatureWithObjCTypes:types];
-
-#endif
-
-}
-
-- (id)initWithObjCTypes:(const char *)types
-{
-    NSParameterAssert(types != NULL);
-    if ((self = [super init]))
-    {
-        // TODO: finish implementation
-        // loop through args
-/*        unsigned method_getNumberOfArguments(Method);
-        unsigned method_getSizeOfArguments(Method); */
-
-        // I hate using private Apple APIs, even ones that appear stable, but
-        // not sure that meddling with these instance variables is a good idea
-    }
-    return self;
-}
-
-@end
index 2d7dbff3b552d5d4ddbeb0881038c75a1890cbb4..9129270bf6560aca6a9790ad952914f782443f66 100644 (file)
--- a/WOMock.m
+++ b/WOMock.m
@@ -27,7 +27,6 @@
 
 // framework headers
 #import "NSInvocation+WOTest.h"
-#import "NSMethodSignature+WOTest.h"
 #import "NSObject+WOTest.h"
 #import "NSProxy+WOTest.h"
 #import "NSValue+WOTest.h"
 
 - (void)setObjCTypes:(NSString *)types forSelector:(SEL)aSelector
 {
-    [methodSignatures setObject:[NSMethodSignature WOTest_signatureBasedOnObjCTypes:[types UTF8String]]
+    [methodSignatures setObject:[NSMethodSignature signatureWithObjCTypes:[types UTF8String]]
                          forKey:NSStringFromSelector(aSelector)];
 }
 
index c7429254203a959434c137e23abebf5a82b8ef3e..78ca9914858fc38734e8d7e07bf9ae8ceb47e568 100644 (file)
@@ -28,7 +28,6 @@
 // framework headers
 
 #import "NSInvocation+WOTest.h"
-#import "NSMethodSignature+WOTest.h"
 #import "WOProtocolStub.h"
 
 #pragma mark -
@@ -200,7 +199,7 @@ NSString *WOStringFromProtocol(Protocol *aProtocol)
 
     BOOL isRequiredMethod = YES;    // no idea what to pass here
     struct objc_method_description description = protocol_getMethodDescription([self mockedProtocol], aSelector, isRequiredMethod, YES);
-    return [NSMethodSignature WOTest_signatureBasedOnObjCTypes:description.types];
+    return [NSMethodSignature signatureWithObjCTypes:description.types];
 }
 
 #pragma mark -
index 197342d725b9090709c637d7de271acb3cc55c27..0cc4703034d275a99df278e4ec6f145a0e3c8329 100644 (file)
--- a/WOStub.m
+++ b/WOStub.m
@@ -27,7 +27,6 @@
 
 // framework headers
 #import "NSInvocation+WOTest.h"
-#import "NSMethodSignature+WOTest.h"
 #import "NSObject+WOTest.h"
 #import "NSProxy+WOTest.h"
 #import "NSValue+WOTest.h"
index 2353aad7679ecbc4e500371602e39e82c07371ef..fd84741ac091829fdaf6335c06dc8b4c3f4605c8 100644 (file)
--- a/WOTest.h
+++ b/WOTest.h
@@ -53,7 +53,6 @@
 
 #import "NSException+WOTest.h"
 #import "NSInvocation+WOTest.h"
-#import "NSMethodSignature+WOTest.h"
 #import "NSObject+WOTest.h"
 #import "NSProxy+WOTest.h"
 #import "NSScanner+WOTest.h"
index 905a643263c2eca7e5200a69081656bdce33e87d..0007577ca0cba5b80e6b758944788797901c20db 100644 (file)
@@ -3,7 +3,7 @@
        archiveVersion = 1;
        classes = {
        };
-       objectVersion = 43;
+       objectVersion = 44;
        objects = {
 
 /* Begin PBXAggregateTarget section */
                BCD155AF0A961949005B1950 /* WOProtocolMock.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = BCFA3172098BFD9300EEEE22 /* WOProtocolMock.h */; };
                BCD155B00A961949005B1950 /* WOEnumerate.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = BCFA31DB098C030300EEEE22 /* WOEnumerate.h */; };
                BCD155B10A961949005B1950 /* NSInvocation+WOTest.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = BCFA342A098DB87300EEEE22 /* NSInvocation+WOTest.h */; };
-               BCD155B20A961949005B1950 /* NSMethodSignature+WOTest.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = BCFA35CA098E6A0D00EEEE22 /* NSMethodSignature+WOTest.h */; };
                BCD155B30A961949005B1950 /* WOLightweightRoot.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = BCFA3CE0098F9B4800EEEE22 /* WOLightweightRoot.h */; };
                BCD155B40A961949005B1950 /* WOObjectMock.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = BCBB58EC099D311B0065D0C5 /* WOObjectMock.h */; };
                BCD155B50A961949005B1950 /* WOProtocolStub.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = BCBB59A0099D38BE0065D0C5 /* WOProtocolStub.h */; };
                BCFA326D098C71D300EEEE22 /* WOObjectMockTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFA326C098C71D300EEEE22 /* WOObjectMockTests.m */; };
                BCFA342D098DB87300EEEE22 /* NSInvocation+WOTest.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFA342B098DB87300EEEE22 /* NSInvocation+WOTest.m */; };
                BCFA3446098E25FA00EEEE22 /* NSInvocationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFA3445098E25FA00EEEE22 /* NSInvocationTests.m */; };
-               BCFA35CF098E6A0D00EEEE22 /* NSMethodSignature+WOTest.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFA35CB098E6A0D00EEEE22 /* NSMethodSignature+WOTest.m */; };
                BCFA3CE3098F9B4800EEEE22 /* WOLightweightRoot.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFA3CE1098F9B4800EEEE22 /* WOLightweightRoot.m */; };
                BCFA3EA8098FCF9800EEEE22 /* NSValueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFA3EA7098FCF9700EEEE22 /* NSValueTests.m */; };
 /* End PBXBuildFile section */
                                BCD155AF0A961949005B1950 /* WOProtocolMock.h in CopyFiles */,
                                BCD155B00A961949005B1950 /* WOEnumerate.h in CopyFiles */,
                                BCD155B10A961949005B1950 /* NSInvocation+WOTest.h in CopyFiles */,
-                               BCD155B20A961949005B1950 /* NSMethodSignature+WOTest.h in CopyFiles */,
                                BCD155B30A961949005B1950 /* WOLightweightRoot.h in CopyFiles */,
                                BCD155B40A961949005B1950 /* WOObjectMock.h in CopyFiles */,
                                BCD155B50A961949005B1950 /* WOProtocolStub.h in CopyFiles */,
                BCFA342B098DB87300EEEE22 /* NSInvocation+WOTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSInvocation+WOTest.m"; sourceTree = "<group>"; };
                BCFA3444098E25FA00EEEE22 /* NSInvocationTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSInvocationTests.h; path = Tests/NSInvocationTests.h; sourceTree = "<group>"; };
                BCFA3445098E25FA00EEEE22 /* NSInvocationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSInvocationTests.m; path = Tests/NSInvocationTests.m; sourceTree = "<group>"; };
-               BCFA35CA098E6A0D00EEEE22 /* NSMethodSignature+WOTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMethodSignature+WOTest.h"; sourceTree = "<group>"; };
-               BCFA35CB098E6A0D00EEEE22 /* NSMethodSignature+WOTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMethodSignature+WOTest.m"; sourceTree = "<group>"; };
                BCFA3CE0098F9B4800EEEE22 /* WOLightweightRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WOLightweightRoot.h; sourceTree = "<group>"; };
                BCFA3CE1098F9B4800EEEE22 /* WOLightweightRoot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WOLightweightRoot.m; sourceTree = "<group>"; };
                BCFA3EA6098FCF9700EEEE22 /* NSValueTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSValueTests.h; path = Tests/NSValueTests.h; sourceTree = "<group>"; };
                                BC5B1161072483FC000A7198 /* NSException+WOTest.m */,
                                BCFA342A098DB87300EEEE22 /* NSInvocation+WOTest.h */,
                                BCFA342B098DB87300EEEE22 /* NSInvocation+WOTest.m */,
-                               BCFA35CA098E6A0D00EEEE22 /* NSMethodSignature+WOTest.h */,
-                               BCFA35CB098E6A0D00EEEE22 /* NSMethodSignature+WOTest.m */,
                                BC1A6961085C5002004E0E61 /* NSObject+WOTest.h */,
                                BC1A6962085C5002004E0E61 /* NSObject+WOTest.m */,
                                BC7CC40D0A8E0A5D00B83673 /* NSProxy+WOTest.h */,
                                BCFA316D098BFD8900EEEE22 /* WOClassMock.m in Sources */,
                                BCFA3175098BFD9300EEEE22 /* WOProtocolMock.m in Sources */,
                                BCFA342D098DB87300EEEE22 /* NSInvocation+WOTest.m in Sources */,
-                               BCFA35CF098E6A0D00EEEE22 /* NSMethodSignature+WOTest.m in Sources */,
                                BCFA3CE3098F9B4800EEEE22 /* WOLightweightRoot.m in Sources */,
                                BCBB58EF099D31280065D0C5 /* WOObjectMock.m in Sources */,
                                BCBB59A5099D38BE0065D0C5 /* WOProtocolStub.m in Sources */,