Tuukka Norri avatar Tuukka Norri committed ddd6832

Added conditionals for iOS

Comments (0)

Files changed (12)

Sources/BXArrayFunctions.m

 #import "BXArrayFunctions.h"
 
 
+static CFArrayCallBacks stNonRetainedArrayCallbacks = {
+    0,
+    NULL,
+    NULL,
+    NULL,
+    &CFEqual
+};
+
+
 id
 BXArrayCreateMutableWeakNonretaining ()
 {
+#if defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+	return (id) CFArrayCreateMutable (kCFAllocatorDefault, 0, &stNonRetainedArrayCallbacks);
+#else
 	return [[NSPointerArray pointerArrayWithWeakObjects] retain];
+#endif
 }

Sources/BXConnectionMonitor.h

 @class BXConnectionMonitor;
 @class BXSystemEventNotifier;
 @class BXConnectionMonitorThread;
+@class NSMapTable;
 
 
 

Sources/BXDatabaseContext.h

 #define BXHiddenId id
 
 
+#if defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+#define SecKeychainItemRef void*
+#endif
+
+
 @class NSWindow;
 
 

Sources/BXDatabaseObjectID.m

         }
         else
         {
+#if ! (defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
             //Just use NSData
             valueForURL = [NSString BXURLEncodedData: [NSArchiver archivedDataWithRootObject: currentValue]];            
+#endif
         }
         
         [parts addObject: [NSString stringWithFormat: @"%@,%c=%@", 
 			}
 			case 'd':
 			{
+#if ! (defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
 				NSString* encodedString = nil;
 				[queryScanner scanUpToString: @"&" intoString: &encodedString];
 				NSData* archivedData = [encodedString BXURLDecodedData];
 				value = [NSUnarchiver unarchiveObjectWithData: archivedData];
+#endif
 				break;
 			}
 			default:

Sources/BXDictionaryFunctions.m

 #import "BXDictionaryFunctions.h"
 
 
+static CFDictionaryValueCallBacks stNonRetainedValueCallbacks = {
+	0,
+	NULL,
+	NULL,
+	NULL,
+	&CFEqual
+};
+
+
 id
 BXDictionaryCreateMutableWeakNonretainedObjects ()
 {
+#if defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+	return (id) CFDictionaryCreateMutable (kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &stNonRetainedValueCallbacks);
+#else
 	return [[NSMapTable mapTableWithStrongToWeakObjects] retain];
+#endif
 }
 
 
 
+#if ! (defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
 @interface NSHashTable (BXHOM) <BXSetHOM>
 @end
+#endif
 
 
 
+#if ! (defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
 @interface NSMapTable (BXHOM) <BXDictionaryHOM>
 @end
+#endif
 
 
 
+#if ! (defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
 @implementation NSHashTable (BXHOM)
 - (void) _BX_Collect: (NSInvocation *) invocation userInfo: (Class) retclass
 {
 	return VisitorTrampoline (self, visitor, @selector (_BX_Visit:userInfo:), nil);
 }
 @end
+#endif
 
 
 
 
 
 
+#if ! (defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
 @implementation NSMapTable (BXHOM)
 - (void) _BX_Collect: (NSInvocation *) invocation userInfo: (Class) retclass
 {
 	return SelectFunction2 (self, retval, fptr, arg);
 }
 @end
+#endif

Sources/BXObjectStatusInfo.h

 
 #import <Foundation/Foundation.h>
 #import <BaseTen/BXDatabaseObject.h>
+@class NSProtocolChecker;
 
 
 @interface BXObjectStatusInfo : NSProxy

Sources/BXRegularExpressions.h

 
 #import <BaseTen/pcre.h>
 #import <BaseTen/BXExport.h>
+#import <Foundation/Foundation.h>
 
 
 struct bx_regular_expression_st 

Sources/BXSetFunctions.m

 }
 
 
+static Boolean
+EqualRelationshipSetFn (void const * const value1, void const * const value2)
+{
+	return (EqualRelationship (value1, value2, NULL) ? true : false);
+}
+
+
+
+static CFSetCallBacks stNonRetainedSetCallbacks = {
+	0,
+	NULL,
+	NULL,
+	NULL,
+	&CFEqual,
+	&CFHash
+};
+
+
+static CFSetCallBacks stNSRDSetCallbacks = {
+	0,
+	NULL,
+	NULL,
+	NULL,
+	&EqualRelationshipSetFn,
+	&CFHash
+};
+
+
 id
 BXSetCreateMutableWeakNonretaining ()
 {
+#if defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+	return (id) CFSetCreateMutable (kCFAllocatorDefault, 0, &stNonRetainedSetCallbacks);
+#else
 	return [[NSHashTable hashTableWithWeakObjects] retain];
+#endif
 }
 
 
 id
 BXSetCreateMutableStrongRetainingForNSRD ()
 {
+#if defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+	return (id) CFSetCreateMutable (kCFAllocatorDefault, 0, &stNSRDSetCallbacks);
+#else
 	NSPointerFunctionsOptions options = NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPersonality;
 	NSPointerFunctions *functions = [[NSPointerFunctions alloc] initWithOptions: options];
 	[functions setIsEqualFunction: &EqualRelationship];
 	[functions release];
 	
 	return retval;
+#endif
 }

Sources/NSObject+BaseTenAdditions.h

 #import <Foundation/Foundation.h>
 
 
+#if ! (defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
 @interface NSPointerArray (BaseTenAdditions)
 - (void) addObject: (id) anObject;
 - (NSEnumerator *) objectEnumerator;
 @end
+#endif
 
 
 
+#if ! (defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
 @interface NSMapTable (BaseTenAdditions)
 - (void) makeObjectsPerformSelector: (SEL) selector withObject: (id) object;
 - (NSArray *) objectsForKeys: (NSArray *) keys notFoundMarker: (id) marker;
 @end
+#endif

Sources/NSObject+BaseTenAdditions.m

 //
 
 
+#import "NSObject+BaseTenAdditions.h"
+
+
+#if ! (defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
 @implementation NSPointerArray (BaseTenAdditions)
 - (void) addObject: (id) anObject
 {
 	return [[self allObjects] objectEnumerator];
 }
 @end
+#endif
 
 
 
+#if ! (defined (TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
 @implementation NSMapTable (BaseTenAdditions)
 - (void) makeObjectsPerformSelector: (SEL) selector withObject: (id) object
 {
 	return retval;
 }
 @end
+#endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.