You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by to...@apache.org on 2007/12/09 00:22:50 UTC

svn commit: r602575 - in /cayenne/sandbox/CocoaCayenne/CocoaCayenne: CAYArrayController.m CAYObjEntity.m CAYObjectContext.m CAYPersistentObject.m CAYTreeController.m CocoaCayenne.xcodeproj/project.pbxproj

Author: torehalset
Date: Sat Dec  8 15:22:47 2007
New Revision: 602575

URL: http://svn.apache.org/viewvc?rev=602575&view=rev
Log:
 * use objc 2.0 loops
 * fix minor bug - copyWithZone in CAYObjEntity
 * suggested hessianobjc patch for NSDate encoding

Modified:
    cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArrayController.m
    cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjEntity.m
    cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.m
    cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYPersistentObject.m
    cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYTreeController.m
    cayenne/sandbox/CocoaCayenne/CocoaCayenne/CocoaCayenne.xcodeproj/project.pbxproj

Modified: cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArrayController.m
URL: http://svn.apache.org/viewvc/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArrayController.m?rev=602575&r1=602574&r2=602575&view=diff
==============================================================================
--- cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArrayController.m (original)
+++ cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYArrayController.m Sat Dec  8 15:22:47 2007
@@ -65,9 +65,8 @@
     // delete objects if any
     if([self deleteObjectOnRemove])
     {
-        NSEnumerator *enumerator = [objectsToDelete objectEnumerator];
         CAYPersistentObject *element = nil;
-        while(element = [enumerator nextObject])
+        for(element in objectsToDelete)
         {
             [[element objectContext] deleteObject:element];
         }

Modified: cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjEntity.m
URL: http://svn.apache.org/viewvc/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjEntity.m?rev=602575&r1=602574&r2=602575&view=diff
==============================================================================
--- cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjEntity.m (original)
+++ cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjEntity.m Sat Dec  8 15:22:47 2007
@@ -46,6 +46,17 @@
 	[coder encodeObject:[self relationships] forKey:@"relationships"];
 }
 
+- (id)copyWithZone:(NSZone *)zone
+{
+	CAYObjEntity *copy = [[[self class] allocWithZone:zone] init];
+    [copy setServerClassName:[self serverClassName]];
+    [copy setAttributes:[self attributes]];
+	[copy setName:[self name]];
+	[copy setRelationships:[self relationships]];
+    
+	return copy;
+}
+
 -(void)setAttributes:(NSMutableDictionary *)a
 {
 	[a retain];
@@ -100,7 +111,6 @@
     [result autorelease];
     return result;
 }
-
 
 -(void)dealloc
 {

Modified: cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.m
URL: http://svn.apache.org/viewvc/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.m?rev=602575&r1=602574&r2=602575&view=diff
==============================================================================
--- cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.m (original)
+++ cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYObjectContext.m Sat Dec  8 15:22:47 2007
@@ -110,11 +110,8 @@
     NSMutableArray *resultRows = [[NSMutableArray alloc] initWithCapacity:[rows count]];
     
     // connect objects to the context
-    int n = [rows count];
-    int i;
-    for(i = 0; i < n; i++)
+    for(id row in rows)
     {
-        id row = [rows objectAtIndex:i];
         if([row isKindOfClass:[CAYPersistentObject class]])
         {
             // try to look for old with same objectId in the context

Modified: cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYPersistentObject.m
URL: http://svn.apache.org/viewvc/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYPersistentObject.m?rev=602575&r1=602574&r2=602575&view=diff
==============================================================================
--- cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYPersistentObject.m (original)
+++ cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYPersistentObject.m Sat Dec  8 15:22:47 2007
@@ -185,16 +185,13 @@
             }
 			
 			//NSArray *oldValue = [self valueForKey:key];
-            
-            NSEnumerator *enumerator;
             CAYPersistentObject *element;
 
 			// handle new objects for the relationship
 			NSMutableArray *newElements = [[NSMutableArray alloc] init];
 			[newElements addObjectsFromArray:value];
 			[newElements removeObjectsInArray:oldValue];
-			enumerator = [newElements objectEnumerator];
-            while(element = [enumerator nextObject])
+            for(element in newElements)
             {
 				NSLog(@"DEBUG: new element for rel %@: %@", key, element);
 				[self addToManyTarget:element forKey:key setReverse:YES];
@@ -205,8 +202,7 @@
 			NSMutableArray *removedElements = [[NSMutableArray alloc] init];
 			[removedElements addObjectsFromArray:oldValue];
 			[removedElements removeObjectsInArray:value];
-			enumerator = [removedElements objectEnumerator];
-            while(element = [enumerator nextObject])
+            for(element in removedElements)
             {
 				NSLog(@"DEBUG: remove element for rel %@: %@", key, element);
 				[self removeToManyTarget:element forKey:key setReverse:YES];

Modified: cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYTreeController.m
URL: http://svn.apache.org/viewvc/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYTreeController.m?rev=602575&r1=602574&r2=602575&view=diff
==============================================================================
--- cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYTreeController.m (original)
+++ cayenne/sandbox/CocoaCayenne/CocoaCayenne/CAYTreeController.m Sat Dec  8 15:22:47 2007
@@ -61,9 +61,8 @@
     // delete objects if any
     if([self deleteObjectOnRemove])
     {
-        NSEnumerator *enumerator = [objectsToDelete objectEnumerator];
         CAYPersistentObject *element = nil;
-        while(element = [enumerator nextObject])
+        for(element in objectsToDelete)
         {
             [[element objectContext] deleteObject:element];
         }

Modified: cayenne/sandbox/CocoaCayenne/CocoaCayenne/CocoaCayenne.xcodeproj/project.pbxproj
URL: http://svn.apache.org/viewvc/cayenne/sandbox/CocoaCayenne/CocoaCayenne/CocoaCayenne.xcodeproj/project.pbxproj?rev=602575&r1=602574&r2=602575&view=diff
==============================================================================
--- cayenne/sandbox/CocoaCayenne/CocoaCayenne/CocoaCayenne.xcodeproj/project.pbxproj (original)
+++ cayenne/sandbox/CocoaCayenne/CocoaCayenne/CocoaCayenne.xcodeproj/project.pbxproj Sat Dec  8 15:22:47 2007
@@ -3,7 +3,7 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 42;
+	objectVersion = 44;
 	objects = {
 
 /* Begin PBXBuildFile section */
@@ -517,6 +517,7 @@
 		0867D690FE84028FC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CocoaCayenne" */;
+			compatibilityVersion = "Xcode 3.0";
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,
@@ -531,6 +532,7 @@
 			mainGroup = 0867D691FE84028FC02AAC07 /* CocoaCayenne */;
 			productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
 			projectDirPath = "";
+			projectRoot = "";
 			targets = (
 				8DC2EF4F0486A6940098B216 /* CocoaCayenne */,
 			);
@@ -672,7 +674,7 @@
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				PREBINDING = NO;
-				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
 			};
 			name = Debug;
 		};
@@ -682,7 +684,7 @@
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				PREBINDING = NO;
-				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
 			};
 			name = Release;
 		};