diff options
author | stuconnolly <stuart02@gmail.com> | 2009-08-26 21:18:28 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-08-26 21:18:28 +0000 |
commit | 63c47d26eeed7e2602e0925cae8e7386963ce695 (patch) | |
tree | 99529d48c972af8348f5478930a4116e0cc608b0 /Frameworks/MCPKit/MCPEntrepriseKit | |
parent | 082332ed69b7cfb2d11d1d45b848cb1fc393b3ca (diff) | |
download | sequelpro-63c47d26eeed7e2602e0925cae8e7386963ce695.tar.gz sequelpro-63c47d26eeed7e2602e0925cae8e7386963ce695.tar.bz2 sequelpro-63c47d26eeed7e2602e0925cae8e7386963ce695.zip |
Make the MCPkit framework truly 64 bit compatible by using the appropriate data types.
Diffstat (limited to 'Frameworks/MCPKit/MCPEntrepriseKit')
15 files changed, 192 insertions, 185 deletions
diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPAttribute.h b/Frameworks/MCPKit/MCPEntrepriseKit/MCPAttribute.h index 834c8e18..469d0808 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPAttribute.h +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPAttribute.h @@ -42,7 +42,7 @@ NSString *internalType; // Name of the class, or type used for the class definition NSString *externalName; // Name of the corresponding column in the DB NSString *externalType; // Type used to store the attribute (in the DB) - unsigned int width; // Width (for storing by the DB) + NSUInteger width; // Width (for storing by the DB) BOOL allowsNull; // Attribute can be null BOOL autoGenerated; // Attribute is auto generated by the DB BOOL isPartOfKey; // Attribute is part of theprimary key of the class description @@ -69,15 +69,15 @@ - (void) setInternalType:(NSString *) iInternalType; - (void) setExternalType:(NSString *) iExternalType; - (void) setExternalName:(NSString *) iExternalName; -- (void) setWidth:(unsigned int) iWidth; +- (void) setWidth:(NSUInteger) iWidth; - (void) setAllowsNull:(BOOL) iAllowsNull; - (void) setAutoGenerated:(BOOL) iAutoGenerated; - (void) setIsPartOfKey:(BOOL) iIsPartOfKey; - (void) setIsPartOfIdentity:(BOOL) iIsPartOfIdentity; - (void) setHasAccessor:(BOOL) iHasAccessor; - (void) setDefaultValue:(id) iDefaultValue; -- (void) insertObject:(MCPJoin *) iJoin inJoinsAtIndex:(unsigned int) index; -- (void) removeObjectFromJoinsAtIndex:(unsigned int) index; +- (void) insertObject:(MCPJoin *) iJoin inJoinsAtIndex:(NSUInteger) index; +- (void) removeObjectFromJoinsAtIndex:(NSUInteger) index; //- (void) addRelation:(MCPRelation *) iRelation; //- (void) removeRelation:(MCPRelation *) iRelation; @@ -89,16 +89,16 @@ - (NSString *) internalType; - (NSString *) externalName; - (NSString *) externalType; -- (unsigned int) width; +- (NSUInteger) width; - (BOOL) allowsNull; - (BOOL) autoGenerated; - (BOOL) isPartOfKey; - (BOOL) isPartOfIdentity; - (BOOL) hasAccessor; - (id) defaultValue; -- (unsigned int) countOfJoins; -- (MCPJoin *) objectInJoinsAtIndex:(unsigned int) index; -- (unsigned int) indexOfJoinIdenticalTo:(id) iJoin; +- (NSUInteger) countOfJoins; +- (MCPJoin *) objectInJoinsAtIndex:(NSUInteger) index; +- (NSUInteger) indexOfJoinIdenticalTo:(id) iJoin; #pragma mark Some general methods: - (BOOL) isEqual:(id) iObject; diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPAttribute.m b/Frameworks/MCPKit/MCPEntrepriseKit/MCPAttribute.m index 8ecfda92..085c1114 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPAttribute.m +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPAttribute.m @@ -35,7 +35,7 @@ #import "MCPRelation.h" #import "MCPJoin.h" -static NSArray *MCPRecognisedInternalType; +static NSArray *MCPRecognisedInternalType; @interface MCPAttribute (Private) @@ -112,7 +112,7 @@ static NSArray *MCPRecognisedInternalType; [self setInternalType:[decoder decodeObjectForKey:@"MCPinternalType"]]; [self setExternalName:[decoder decodeObjectForKey:@"MCPexternalName"]]; [self setExternalType:[decoder decodeObjectForKey:@"MCPexternalType"]]; - [self setWidth:(unsigned int)[decoder decodeInt32ForKey:@"MCPwidth"]]; + [self setWidth:(NSUInteger)[decoder decodeInt32ForKey:@"MCPwidth"]]; [self setAllowsNull:[decoder decodeBoolForKey:@"MCPallowsNull"]]; [self setAutoGenerated:[decoder decodeBoolForKey:@"MCPautoGenerated"]]; [self setIsPartOfKey:[decoder decodeBoolForKey:@"MCPisPartOfKey"]]; @@ -231,7 +231,7 @@ static NSArray *MCPRecognisedInternalType; } } -- (void) setWidth:(unsigned int) iWidth +- (void) setWidth:(NSUInteger) iWidth { if (iWidth != width) { width = iWidth; @@ -302,12 +302,12 @@ static NSArray *MCPRecognisedInternalType; } } -- (void) insertObject:(MCPJoin *) iJoin inJoinsAtIndex:(unsigned int) index +- (void) insertObject:(MCPJoin *) iJoin inJoinsAtIndex:(NSUInteger) index { [joins insertObject:iJoin atIndex:index]; } -- (void) removeObjectFromJoinsAtIndex:(unsigned int) index +- (void) removeObjectFromJoinsAtIndex:(NSUInteger) index { [joins removeObjectAtIndex:index]; } @@ -373,7 +373,7 @@ static NSArray *MCPRecognisedInternalType; return externalType; } -- (unsigned int) width +- (NSUInteger) width { return width; } @@ -408,17 +408,17 @@ static NSArray *MCPRecognisedInternalType; return defaultValue; } -- (unsigned int) countOfJoins +- (NSUInteger) countOfJoins { return [joins count]; } -- (MCPJoin *) objectInJoinsAtIndex:(unsigned int) index +- (MCPJoin *) objectInJoinsAtIndex:(NSUInteger) index { return (MCPJoin *)((NSNotFound != index) ? [joins objectAtIndex:index] : nil); } -- (unsigned int) indexOfJoinIdenticalTo:(id) iJoin +- (NSUInteger) indexOfJoinIdenticalTo:(id) iJoin { return [joins indexOfObjectIdenticalTo:iJoin]; } diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription+MCPEntreprise.m b/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription+MCPEntreprise.m index 604290b8..71a25911 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription+MCPEntreprise.m +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription+MCPEntreprise.m @@ -38,7 +38,7 @@ { NSArray *theRet; NSMutableArray *theKeys =[[NSMutableArray alloc] init]; - unsigned int i; + NSUInteger i; for (i=0; i != [self countOfAttributes]; ++i) { [theKeys insertObject:[(MCPAttribute *)[self objectInAttributesAtIndex:i] name] atIndex:i]; @@ -50,7 +50,7 @@ - (NSString *) inverseRelationshipKey:(NSString *) relationshipKey { - unsigned int index = [self indexOfRelation:relationshipKey]; + NSUInteger index = [self indexOfRelation:relationshipKey]; if (NSNotFound != index) { MCPRelation *theRelation; @@ -65,7 +65,7 @@ { NSArray *theRet; NSMutableArray *theToManyRel = [[NSMutableArray alloc] init]; - unsigned int i, j; + NSUInteger i, j; j=0; for (i=0; i != [self countOfRelations]; ++i) { @@ -85,7 +85,7 @@ { NSArray *theRet; NSMutableArray *theToOneRel = [[NSMutableArray alloc] init]; - unsigned int i, j; + NSUInteger i, j; j=0; for (i=0; i != [self countOfRelations]; ++i) { @@ -105,7 +105,7 @@ - (NSArray *) primaryKeyAttributes { NSMutableArray *theRet = [NSMutableArray array]; - unsigned int i, j; + NSUInteger i, j; j = 0; for (i=0; i != [self countOfAttributes]; ++i) { @@ -122,7 +122,7 @@ - (NSArray *) identityAttributes { NSMutableArray *theRet = [NSMutableArray array]; - unsigned int i, j; + NSUInteger i, j; j = 0; for (i=0; i != [self countOfAttributes]; ++i) { @@ -144,7 +144,7 @@ return (NSNotFound != index) ? (MCPAttribute *)[self objectInAttributesAtIndex:index] : nil ; */ - unsigned int i; + NSUInteger i; for (i = 0; [attributes count] != i; ++i) { if ([[(MCPAttribute *)[attributes objectAtIndex:i] name] isEqualToString:iName]) { @@ -161,7 +161,7 @@ return (NSNotFound != index) ? (MCPRelation *)[relations objectAtIndex:index] : nil; */ - unsigned int i; + NSUInteger i; for (i = 0; [relations count] != i; ++i) { if ([[(MCPRelation *)[relations objectAtIndex:i] name] isEqualToString:iRelationName]) { diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription+Private.h b/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription+Private.h index 760ea4ef..df86b763 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription+Private.h +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription+Private.h @@ -33,13 +33,13 @@ #pragma mark Setters - (void) setAttributes:(NSArray *) iAttributes; - (void) setRelations:(NSArray *) iRelations; -- (void) insertObject:(MCPRelation *) iRelation inIncomingsAtIndex:(unsigned int) index; -- (void) removeObjectFromIncomingsAtIndex:(unsigned int) index; +- (void) insertObject:(MCPRelation *) iRelation inIncomingsAtIndex:(NSUInteger) index; +- (void) removeObjectFromIncomingsAtIndex:(NSUInteger) index; #pragma mark Getters - (NSArray *) incomings; -- (unsigned int) countOfIncomings; -- (MCPRelation *) objectInIncomingsAtIndex:(unsigned int) index; -- (unsigned int) indexOfIncoming:(id) iRelation; +- (NSUInteger) countOfIncomings; +- (MCPRelation *) objectInIncomingsAtIndex:(NSUInteger) index; +- (NSUInteger) indexOfIncoming:(id) iRelation; @end diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription.h b/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription.h index 5a6ae51b..cff3cf17 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription.h +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription.h @@ -59,29 +59,29 @@ - (void) encodeWithCoder:(NSCoder *) encoder; #pragma mark Making new attributes and relations -- (MCPAttribute *) addNewAttributeWithName:(NSString *) iName inPosition:(int) index; -- (MCPRelation *) addNewRelationTo:(MCPClassDescription *) iTo name:(NSString *) iName inPostion:(int) index; +- (MCPAttribute *) addNewAttributeWithName:(NSString *) iName inPosition:(NSInteger) index; +- (MCPRelation *) addNewRelationTo:(MCPClassDescription *) iTo name:(NSString *) iName inPostion:(NSInteger) index; #pragma mark Setters - (void) setName:(NSString *) iName; - (void) setExternalName:(NSString *) iExternalName; -- (void) insertObject:(MCPAttribute *) iAttribute inAttributesAtIndex:(unsigned int) index; -- (void) removeObjectFromAttributesAtIndex:(unsigned int) index; -- (void) insertObject:(MCPRelation *) iRelation inRelationsAtIndex:(unsigned int) index; -- (void) removeObjectFromRelationsAtIndex:(unsigned int) index; +- (void) insertObject:(MCPAttribute *) iAttribute inAttributesAtIndex:(NSUInteger) index; +- (void) removeObjectFromAttributesAtIndex:(NSUInteger) index; +- (void) insertObject:(MCPRelation *) iRelation inRelationsAtIndex:(NSUInteger) index; +- (void) removeObjectFromRelationsAtIndex:(NSUInteger) index; #pragma mark Getters - (MCPModel *) model; - (NSString *) name; - (NSString *) externalName; - (NSArray *) attributes; -- (unsigned int) countOfAttributes; -- (MCPAttribute *) objectInAttributesAtIndex:(unsigned int) index; -- (unsigned int) indexOfAttribute:(id) iAttribute; +- (NSUInteger) countOfAttributes; +- (MCPAttribute *) objectInAttributesAtIndex:(NSUInteger) index; +- (NSUInteger) indexOfAttribute:(id) iAttribute; - (NSArray *) relations; -- (unsigned int) countOfRelations; -- (MCPRelation *) objectInRelationsAtIndex:(unsigned int) index; -- (unsigned int) indexOfRelation:(id) iRelation; +- (NSUInteger) countOfRelations; +- (MCPRelation *) objectInRelationsAtIndex:(NSUInteger) index; +- (NSUInteger) indexOfRelation:(id) iRelation; - (Class) representedClass; #pragma mark Some general methods: diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription.m b/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription.m index 030acf6a..9f2ad18d 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription.m +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPClassDescription.m @@ -121,7 +121,7 @@ } #pragma mark Making new attributes and relations -- (MCPAttribute *) addNewAttributeWithName:(NSString *) iName inPosition:(int) index +- (MCPAttribute *) addNewAttributeWithName:(NSString *) iName inPosition:(NSInteger) index { MCPAttribute *theAttribute = [[MCPAttribute alloc] initForClassDescription:self withName:iName]; @@ -131,7 +131,7 @@ return theAttribute; } -- (MCPRelation *) addNewRelationTo:(MCPClassDescription *) iTo name:(NSString *) iName inPostion:(int) index +- (MCPRelation *) addNewRelationTo:(MCPClassDescription *) iTo name:(NSString *) iName inPostion:(NSInteger) index { MCPRelation *theRelation = [[MCPRelation alloc] initWithName:iName from:self to:iTo]; @@ -161,28 +161,28 @@ } } -- (void) insertObject:(MCPAttribute *) iAttribute inAttributesAtIndex:(unsigned int) index +- (void) insertObject:(MCPAttribute *) iAttribute inAttributesAtIndex:(NSUInteger) index { [attributes insertObject:iAttribute atIndex:index]; [[NSNotificationCenter defaultCenter] postNotificationName:MCPModelChangedNotification object:model]; [[NSNotificationCenter defaultCenter] postNotificationName:MCPClassDescriptionChangedNotification object:self]; } -- (void) removeObjectFromAttributesAtIndex:(unsigned int) index +- (void) removeObjectFromAttributesAtIndex:(NSUInteger) index { [attributes removeObjectAtIndex:index]; [[NSNotificationCenter defaultCenter] postNotificationName:MCPModelChangedNotification object:model]; [[NSNotificationCenter defaultCenter] postNotificationName:MCPClassDescriptionChangedNotification object:self]; } -- (void) insertObject:(MCPRelation *) iRelation inRelationsAtIndex:(unsigned int) index +- (void) insertObject:(MCPRelation *) iRelation inRelationsAtIndex:(NSUInteger) index { [relations insertObject:iRelation atIndex:index]; [[NSNotificationCenter defaultCenter] postNotificationName:MCPModelChangedNotification object:model]; [[NSNotificationCenter defaultCenter] postNotificationName:MCPClassDescriptionChangedNotification object:self]; } -- (void) removeObjectFromRelationsAtIndex:(unsigned int) index +- (void) removeObjectFromRelationsAtIndex:(NSUInteger) index { [relations removeObjectAtIndex:index]; [[NSNotificationCenter defaultCenter] postNotificationName:MCPModelChangedNotification object:model]; @@ -210,17 +210,17 @@ return [NSArray arrayWithArray:attributes]; } -- (unsigned int) countOfAttributes +- (NSUInteger) countOfAttributes { return [attributes count]; } -- (MCPAttribute *) objectInAttributesAtIndex:(unsigned int) index +- (MCPAttribute *) objectInAttributesAtIndex:(NSUInteger) index { return (MCPAttribute *)((NSNotFound != index) ? [attributes objectAtIndex:index] : nil); } -- (unsigned int) indexOfAttribute:(id) iAttribute +- (NSUInteger) indexOfAttribute:(id) iAttribute { return [attributes indexOfObject:iAttribute]; } @@ -230,17 +230,17 @@ return [NSArray arrayWithArray:relations]; } -- (unsigned int) countOfRelations +- (NSUInteger) countOfRelations { return [relations count]; } -- (MCPRelation *) objectInRelationsAtIndex:(unsigned int) index +- (MCPRelation *) objectInRelationsAtIndex:(NSUInteger) index { return (MCPRelation *)((NSNotFound != index) ? [relations objectAtIndex:index] : nil); } -- (unsigned int) indexOfRelation:(id) iRelation +- (NSUInteger) indexOfRelation:(id) iRelation { return [relations indexOfObject:iRelation]; } @@ -281,14 +281,15 @@ */ #pragma mark Output for logging -- (NSString *) descriptionWithLocale:(NSDictionary *) locale + +- (NSString *)descriptionWithLocale:(NSDictionary *) locale { - NSMutableString *theOutput = [NSMutableString string]; - unsigned i; + NSUInteger i; + NSMutableString *theOutput = [NSMutableString string]; [theOutput appendFormat:@"MCPClassDescription for class : %@ (table : %@)\n", [self name], [self externalName]]; for (i=0; [attributes count] != i; ++i) { - MCPAttribute *theAttribute = (MCPAttribute *) [attributes objectAtIndex:i]; + MCPAttribute *theAttribute = (MCPAttribute *) [attributes objectAtIndex:i]; [theOutput appendFormat:@"attribute %u, name = %@, column = %@. Allows null : %c\n", i, [theAttribute name], [theAttribute externalName], ([theAttribute allowsNull] ? 'Y' : 'N')]; } @@ -333,7 +334,7 @@ } } -- (void) insertObject:(MCPRelation *) iRelation inIncomingsAtIndex:(unsigned int) index +- (void) insertObject:(MCPRelation *) iRelation inIncomingsAtIndex:(NSUInteger) index { if ([iRelation destination] == self) { [incomings insertObject:iRelation atIndex:index]; @@ -343,7 +344,7 @@ } } -- (void) removeObjectFromIncomingsAtIndex:(unsigned int) index +- (void) removeObjectFromIncomingsAtIndex:(NSUInteger) index { [incomings removeObjectAtIndex:index]; } @@ -354,17 +355,17 @@ return [NSArray arrayWithArray:incomings]; } -- (unsigned int) countOfIncomings +- (NSUInteger) countOfIncomings { return [incomings count]; } -- (MCPRelation *) objectInIncomingsAtIndex:(unsigned int) index +- (MCPRelation *) objectInIncomingsAtIndex:(NSUInteger) index { return (MCPRelation *)[incomings objectAtIndex:index]; } -- (unsigned int) indexOfIncoming:(id) iRelation +- (NSUInteger) indexOfIncoming:(id) iRelation { return [incomings indexOfObject:iRelation]; } diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPJoin.h b/Frameworks/MCPKit/MCPEntrepriseKit/MCPJoin.h index 79c3c4b4..05e99f8d 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPJoin.h +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPJoin.h @@ -66,7 +66,7 @@ - (MCPRelation *) relation; - (MCPAttribute *) origin; - (MCPAttribute *) destination; -- (unsigned int) index; +- (NSUInteger) index; #pragma mark Some general methods: - (BOOL) isEqual:(id) iObject; diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPJoin.m b/Frameworks/MCPKit/MCPEntrepriseKit/MCPJoin.m index 47d2db97..576b1e10 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPJoin.m +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPJoin.m @@ -60,11 +60,11 @@ - (void) invalidate { [self retain]; - NSLog(@"Enterring -[MCPJoin invalidate], retain count is %u (after retaining : should be 4)", [self retainCount]); + NSLog(@"Enterring -[MCPJoin invalidate], retain count is %ld (after retaining : should be 4)", [self retainCount]); [origin removeObjectFromJoinsAtIndex:[origin indexOfJoinIdenticalTo:self]]; [destination removeObjectFromJoinsAtIndex:[destination indexOfJoinIdenticalTo:self]]; [relation removeObjectFromJoinsAtIndex:[relation indexOfJoinIdenticalTo:self]]; - NSLog(@"Enterring -[MCPJoin invalidate], retain count is %u (before releasing : should be 1)", [self retainCount]); + NSLog(@"Enterring -[MCPJoin invalidate], retain count is %ld (before releasing : should be 1)", [self retainCount]); [self release]; return; } @@ -144,7 +144,7 @@ return destination; } -- (unsigned int) index +- (NSUInteger) index { return [relation indexOfJoinIdenticalTo:self]; } diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel+MCPEntreprise.m b/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel+MCPEntreprise.m index 0d71df8a..2652f0dc 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel+MCPEntreprise.m +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel+MCPEntreprise.m @@ -46,7 +46,7 @@ if ([theClass isSubclassOfClass:[MCPObject class]]) { NSString *theClassName = NSStringFromClass(theClass); - unsigned int index = [self indexOfClassDescription:theClassName]; + NSUInteger index = [self indexOfClassDescription:theClassName]; if (NSNotFound != index) { [NSClassDescription registerClassDescription:(NSClassDescription *)[self objectInClassDescriptionsAtIndex:index] forClass:theClass]; diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel.h b/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel.h index 3ad1f6e1..0a6c6afd 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel.h +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel.h @@ -54,13 +54,13 @@ - (void) encodeWithCoder:(NSCoder *) encoder; #pragma mark Making new class description -- (MCPClassDescription *) addNewClassDescriptionWithName:(NSString *) iName inPosition:(int) index; +- (MCPClassDescription *) addNewClassDescriptionWithName:(NSString *) iName inPosition:(NSInteger) index; #pragma mark Setters - (void) setName:(NSString *) iName; - (void) setClassDescriptions:(NSArray *) iClassDescriptions; -- (void) insertObject:(MCPClassDescription *) iClassDescription inClassDescriptionsAtIndex:(unsigned int) index; -- (void) removeObjectFromClassDescriptionsAtIndex:(unsigned int) index; +- (void) insertObject:(MCPClassDescription *) iClassDescription inClassDescriptionsAtIndex:(NSUInteger) index; +- (void) removeObjectFromClassDescriptionsAtIndex:(NSUInteger) index; - (void) setUsesInnoDBTables:(BOOL) iUsesInnoDB; // Deprecated : non KVC @@ -70,9 +70,9 @@ #pragma mark Getters - (NSString *) name; - (NSArray *) classDescriptions; -- (unsigned int) countOfClassDescriptions; -- (MCPClassDescription *) objectInClassDescriptionsAtIndex:(unsigned int) index; -- (unsigned int) indexOfClassDescription:(id) iClassDescription; +- (NSUInteger) countOfClassDescriptions; +- (MCPClassDescription *) objectInClassDescriptionsAtIndex:(NSUInteger) index; +- (NSUInteger) indexOfClassDescription:(id) iClassDescription; - (BOOL) usesInnoDBTables; // Deprecated : non KVC diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel.m b/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel.m index 782342ba..7c73eff1 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel.m +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPModel.m @@ -96,7 +96,7 @@ } #pragma mark Making new class description -- (MCPClassDescription *) addNewClassDescriptionWithName:(NSString *) iName inPosition:(int) index; +- (MCPClassDescription *) addNewClassDescriptionWithName:(NSString *) iName inPosition:(NSInteger) index; { MCPClassDescription *theClassDescription = [[MCPClassDescription alloc] initInModel:self withName:iName]; @@ -125,13 +125,13 @@ } } -- (void) insertObject:(MCPClassDescription *) iClassDescription inClassDescriptionsAtIndex:(unsigned int) index +- (void) insertObject:(MCPClassDescription *) iClassDescription inClassDescriptionsAtIndex:(NSUInteger) index { [classDescriptions insertObject:iClassDescription atIndex:index]; [[NSNotificationCenter defaultCenter] postNotificationName:MCPModelChangedNotification object:self]; } -- (void) removeObjectFromClassDescriptionsAtIndex:(unsigned int) index +- (void) removeObjectFromClassDescriptionsAtIndex:(NSUInteger) index { [classDescriptions removeObjectAtIndex:index]; [[NSNotificationCenter defaultCenter] postNotificationName:MCPModelChangedNotification object:self]; @@ -171,12 +171,12 @@ return [NSArray arrayWithArray:classDescriptions]; } -- (unsigned int) countOfClassDescriptions +- (NSUInteger) countOfClassDescriptions { return [classDescriptions count]; } -- (MCPClassDescription *) objectInClassDescriptionsAtIndex:(unsigned int) index +- (MCPClassDescription *) objectInClassDescriptionsAtIndex:(NSUInteger) index { return (MCPClassDescription *)((NSNotFound != index) ? [classDescriptions objectAtIndex:index] : nil); } @@ -190,11 +190,11 @@ } return (i == [classDescriptions count]) ? nil : (MCPClassDescription *)[classDescriptions objectAtIndex:i]; */ - unsigned int theIndex = [classDescriptions indexOfObject:iClassDescriptionClassName]; + NSUInteger theIndex = [classDescriptions indexOfObject:iClassDescriptionClassName]; return (NSNotFound == theIndex) ? nil : [classDescriptions objectAtIndex:theIndex]; } -- (unsigned int) indexOfClassDescription:(id) iClassDescription +- (NSUInteger) indexOfClassDescription:(id) iClassDescription { return [classDescriptions indexOfObject:iClassDescription]; } diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.h b/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.h index 2b7b30ea..4f126928 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.h +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.h @@ -29,7 +29,7 @@ #import <Foundation/Foundation.h> /*" Possible return code on some operations of the database interaction. "*/ -typedef enum { +enum { MCPDBReturnUnknown = 0, /*"Unknown state, should not happen."*/ MCPDBReturnDeleted = 1, /*"The entry have been successfuly deleted from DB."*/ MCPDBReturnUsed = 2, /*"The entry can not be removed, because some entries are still connected to it (some delete restrict/inhibit delete)."*/ @@ -46,7 +46,8 @@ typedef enum { MCPDBReturnNoSuchRelation = 13, /*"There is no relation with such a name starting from this class."*/ MCPDBReturnNotTarget = 14, /*"Tried to remove an object from a relation, while the objects does NOT belong to the relation."*/ MCPDBReturnOK = 100 /*"Everything went OK."*/ -} MCPDBReturnCode; +}; +typedef NSUInteger MCPDBReturnCode; @class MCPConnection; @class MCPClassDescription; @@ -91,18 +92,18 @@ typedef enum { - (id) getTargetOfRelationNamed:(NSString *) iRelationName; - (MCPDBReturnCode) setTarget:(id) iTarget forRelation:(MCPRelation *) iRelation; - (MCPDBReturnCode) setTarget:(id) iTarget forRelationNamed:(NSString *) iRelationName; -- (unsigned int) countTargetForRelation:(MCPRelation *) iRelation; -- (unsigned int) countTargetForRelationNamed:(NSString *) iRelationName; -- (MCPObject *) getTargetOfRelation:(MCPRelation *) iRelation atIndex:(unsigned int) iIndex; -- (MCPObject *) getTargetOfRelationNamed:(NSString *) iRelationName atIndex:(unsigned int) iIndex; +- (NSUInteger) countTargetForRelation:(MCPRelation *) iRelation; +- (NSUInteger) countTargetForRelationNamed:(NSString *) iRelationName; +- (MCPObject *) getTargetOfRelation:(MCPRelation *) iRelation atIndex:(NSUInteger) iIndex; +- (MCPObject *) getTargetOfRelationNamed:(NSString *) iRelationName atIndex:(NSUInteger) iIndex; - (MCPDBReturnCode) addTarget:(MCPObject *) iTarget toRelation:(MCPRelation *) iRelation; - (MCPDBReturnCode) addTarget:(MCPObject *) iTarget toRelationNamed:(NSString *) iRelationName; - (MCPDBReturnCode) removeTarget:(MCPObject *) iTarget toRelation:(MCPRelation *) iRelation; - (MCPDBReturnCode) removeTarget:(MCPObject *) iTarget toRelationNamed:(NSString *) iRelationName; -- (MCPDBReturnCode) removeTargetToRelation:(MCPRelation *) iRelation atIndex:(unsigned int) iIndex; -- (MCPDBReturnCode) removeTargetToRelationNamed:(NSString *) iRelationName atIndex:(unsigned int) iIndex; -- (unsigned int) indexOfTarget:(MCPObject *) iTarget inRelation:(MCPRelation *) iRelation; -- (unsigned int) indexOfTarget:(MCPObject *) iTarget inRelationNamed:(NSString *) iRelationName; +- (MCPDBReturnCode) removeTargetToRelation:(MCPRelation *) iRelation atIndex:(NSUInteger) iIndex; +- (MCPDBReturnCode) removeTargetToRelationNamed:(NSString *) iRelationName atIndex:(NSUInteger) iIndex; +- (NSUInteger) indexOfTarget:(MCPObject *) iTarget inRelation:(MCPRelation *) iRelation; +- (NSUInteger) indexOfTarget:(MCPObject *) iTarget inRelationNamed:(NSString *) iRelationName; #pragma mark Utilities /*" Utility methods "*/ diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m b/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m index 8d219400..ae5e2f59 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m @@ -66,7 +66,7 @@ { self = [super init]; if (self) { - unsigned int i; + NSUInteger i; NSArray *attrArray; classDescription = [[NSClassDescription classDescriptionForClass:[self class]] retain]; @@ -113,7 +113,7 @@ { NSArray *theAttributes = [classDescription attributes]; // NSArray *thePrimKeys = [classDescription primaryKeyAttributes]; - unsigned i; + NSUInteger i; for (i=0; [theAttributes count] != i; ++i) { MCPAttribute *theAttribute = (MCPAttribute *) [theAttributes objectAtIndex:i]; @@ -179,7 +179,7 @@ Otherwise, the search will be performed in the following order : iTableName.colu { NSArray *theAttributeKeys = [classDescription attributeKeys]; NSArray *thePrefixArray; - unsigned i; + NSUInteger i; // Depending on the value of iTableName, get the search order. if ((nil == iTableName) || ([@"" isEqualToString:iTableName])) { @@ -191,7 +191,7 @@ Otherwise, the search will be performed in the following order : iTableName.colu for (i=0; [theAttributeKeys count] != i; ++i) { id theValue = nil; MCPAttribute *theAttribute = [classDescription attributeWithName:[theAttributeKeys objectAtIndex:i]]; - unsigned j; + NSUInteger j; for (j=0; [thePrefixArray count] != j; ++j) { if (theValue = [iDictionary objectForKey:[NSString stringWithFormat:@"%@%@", [thePrefixArray objectAtIndex:j], [theAttribute externalName]]]) { @@ -214,7 +214,7 @@ Otherwise, the search will be performed in the following order : iTableName.colu { BOOL missingKey = NO; NSArray *theKeyAttr = [classDescription primaryKeyAttributes]; - unsigned i; + NSUInteger i; NSMutableString *query = [NSMutableString stringWithFormat:@"SELECT * FROM %@ WHERE ", [classDescription externalName]]; MCPResult *result; NSDictionary *row; @@ -287,17 +287,17 @@ If the identityAttributes of the class description is empty, the entry will alwa NSArray *theKeyAttr = [classDescription primaryKeyAttributes]; MCPConnection *theConnection = [self connection]; MCPResult *theResult; - unsigned int i; + NSUInteger i; if (! theConnection) { - return [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:MCPDBReturnNoConnection], @"MCPDBReturnCode"]; + return [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:MCPDBReturnNoConnection], @"MCPDBReturnCode"]; } if (! [theKeyAttr count]) { // There is no primary key for this object. - [theKeys setObject:[NSNumber numberWithInt:MCPDBReturnNoKey] forKey:@"MCPDBReturnCode"]; + [theKeys setObject:[NSNumber numberWithInteger:MCPDBReturnNoKey] forKey:@"MCPDBReturnCode"]; return [NSDictionary dictionaryWithDictionary:theKeys]; } if (! [theIdAttr count]) { // Identity is not defined for this object. - [theKeys setObject:[NSNumber numberWithInt:MCPDBReturnNoIdentity] forKey:@"MCPDBReturnCode"]; + [theKeys setObject:[NSNumber numberWithInteger:MCPDBReturnNoIdentity] forKey:@"MCPDBReturnCode"]; for (i=0; [theKeyAttr count] != i; ++i) { NSString *theKey = [(MCPAttribute*)[theKeyAttr objectAtIndex:i] name]; [theKeys setObject:[self valueForKey:theKey] forKey:theKey]; @@ -329,7 +329,7 @@ If the identityAttributes of the class description is empty, the entry will alwa } */ if (([[(MCPAttribute *)[theIdAttr objectAtIndex:i] valueClass] isSubclassOfClass:[NSString class]]) && ([(MCPAttribute *)[theIdAttr objectAtIndex:i] width] != 0)) { - [theQuery appendFormat:@"(%@ = SUBSTRING(%@ FROM 1 FOR %u))", [(MCPAttribute *)[theIdAttr objectAtIndex:i] externalName], [theConnection quoteObject:[self valueForKey:[(MCPAttribute *)[theIdAttr objectAtIndex:i] name]]], [(MCPAttribute *)[theIdAttr objectAtIndex:i] width]]; + [theQuery appendFormat:@"(%@ = SUBSTRING(%@ FROM 1 FOR %ld))", [(MCPAttribute *)[theIdAttr objectAtIndex:i] externalName], [theConnection quoteObject:[self valueForKey:[(MCPAttribute *)[theIdAttr objectAtIndex:i] name]]], [(MCPAttribute *)[theIdAttr objectAtIndex:i] width]]; } else { [theQuery appendFormat:@"(%@ = %@)", [(MCPAttribute *)[theIdAttr objectAtIndex:i] externalName], [theConnection quoteObject:[self valueForKey:[(MCPAttribute *)[theIdAttr objectAtIndex:i] name]]]]; @@ -346,11 +346,11 @@ If the identityAttributes of the class description is empty, the entry will alwa if ([theResult numOfRows]) { // the object was found. NSDictionary *theFirstRow = [theResult fetchRowAsDictionary]; if ([theResult numOfRows] != 1) { - NSLog(@"in MCPObject -checkDBIdWithConnection: method.... not only one (as expected) but %i results were found, will take the first one."); - [theKeys setObject:[NSNumber numberWithInt:MCPDBReturnMultiple] forKey:@"MCPDBReturnCode"]; + NSLog(@"in MCPObject -checkDBIdWithConnection: method.... not only one (as expected) but %ld results were found, will take the first one."); + [theKeys setObject:[NSNumber numberWithInteger:MCPDBReturnMultiple] forKey:@"MCPDBReturnCode"]; } else { - [theKeys setObject:[NSNumber numberWithInt:MCPDBReturnOK] forKey:@"MCPDBReturnCode"]; + [theKeys setObject:[NSNumber numberWithInteger:MCPDBReturnOK] forKey:@"MCPDBReturnCode"]; } [theKeys addEntriesFromDictionary:theFirstRow]; // Setting the value of self for the primary key to the one just found. @@ -369,7 +369,7 @@ If the identityAttributes of the class description is empty, the entry will alwa } [theKeys setObject:[self valueForKey:[theAttribute name]] forKey:[theAttribute name]]; } - [theKeys setObject:[NSNumber numberWithInt:MCPDBReturnNone] forKey:@"MCPDBReturnCode"]; + [theKeys setObject:[NSNumber numberWithInteger:MCPDBReturnNone] forKey:@"MCPDBReturnCode"]; // Setting the value of self for the primary key to the default values. /* for (i=0; [theKeyAttr count] != i; ++i) { @@ -395,9 +395,9 @@ If the identityAttributes of the class description is empty, the entry will alwa MCPConnection *theConnection = [self connection]; NSDictionary *theCheckReturn = [self checkDBId]; NSMutableDictionary *theRet; - int theCheckCode = [(NSNumber *)[theCheckReturn objectForKey:@"MCPDBReturnCode"] intValue]; - unsigned i; - unsigned j; + NSInteger theCheckCode = [(NSNumber *)[theCheckReturn objectForKey:@"MCPDBReturnCode"] integerValue]; + NSUInteger i; + NSUInteger j; NSMutableString *theQuery = [NSMutableString string]; NSArray *theAttr = [classDescription attributes]; @@ -409,7 +409,7 @@ If the identityAttributes of the class description is empty, the entry will alwa // NSLog(@"in saveUsingConnection: the entry already existed so will update the one with key : %@", theCheckReturn); theCheckCode = [self updateInDB]; theRet = [NSMutableDictionary dictionaryWithDictionary:[self primaryKey]]; - [theRet setObject:[NSNumber numberWithInt:theCheckCode] forKey:@"MCPDBReturnCode"]; + [theRet setObject:[NSNumber numberWithInteger:theCheckCode] forKey:@"MCPDBReturnCode"]; return [NSDictionary dictionaryWithDictionary:theRet]; break; @@ -417,7 +417,7 @@ If the identityAttributes of the class description is empty, the entry will alwa NSLog(@"Multiple entries found with the same identity ... will update the first one."); theCheckCode = [self updateInDB]; theRet = [NSMutableDictionary dictionaryWithDictionary:[self primaryKey]]; - [theRet setObject:[NSNumber numberWithInt:theCheckCode] forKey:@"MCPDBReturnCode"]; + [theRet setObject:[NSNumber numberWithInteger:theCheckCode] forKey:@"MCPDBReturnCode"]; return [NSDictionary dictionaryWithDictionary:theRet]; break; @@ -429,7 +429,7 @@ If the identityAttributes of the class description is empty, the entry will alwa break; default : // We should not arrive here anyway. - NSLog(@"For some resons we got a unexpected result from checkDBId : %i", theCheckCode); + NSLog(@"For some resons we got a unexpected result from checkDBId : %ld", theCheckCode); break; } @@ -462,7 +462,7 @@ If the identityAttributes of the class description is empty, the entry will alwa // Now we perform the query... [theConnection queryString:theQuery]; if (1 != (i = [theConnection affectedRows])) { // More than one row affected ... Should NEVER occure. - NSLog(@"Problem while saving a MCPObject to the database : number of inserted rows is : %i !!!", i); + NSLog(@"Problem while saving a MCPObject to the database : number of inserted rows is : %ld !!!", i); NSLog(@"Maybe there is an error : %@ ", [theConnection getLastErrorMessage]); NSLog(@"The class of the object is : %@, and it's description is :\n%@", [self className], [self descriptionWithLocale:nil]); theCheckCode = (i == 0) ? MCPDBReturnNone : MCPDBReturnMultiple; @@ -479,7 +479,7 @@ If the identityAttributes of the class description is empty, the entry will alwa } [self getAutoGenerated]; theRet = [NSMutableDictionary dictionaryWithDictionary:[self primaryKey]]; - [theRet setObject:[NSNumber numberWithInt:theCheckCode] forKey:@"MCPDBReturnCode"]; + [theRet setObject:[NSNumber numberWithInteger:theCheckCode] forKey:@"MCPDBReturnCode"]; return [NSDictionary dictionaryWithDictionary:theRet]; } @@ -501,9 +501,9 @@ some auto-generated attributes. NSMutableArray *theAutoAttr = [NSMutableArray array]; NSArray *theAttr = [classDescription attributes]; NSArray *theKeyAttr = [classDescription primaryKeyAttributes]; - unsigned i,j; + NSUInteger i,j; NSMutableString *theQuery; - int theCheckCode; + NSInteger theCheckCode; MCPResult *theResult; NSDictionary *theRow; MCPConnection *theConnection = [self connection]; @@ -513,7 +513,7 @@ some auto-generated attributes. } if (0 != [[classDescription identityAttributes] count]) { - theCheckCode = [(NSNumber *)[[self checkDBId] objectForKey:@"MCPDBReturnCode"] intValue]; + theCheckCode = [(NSNumber *)[[self checkDBId] objectForKey:@"MCPDBReturnCode"] integerValue]; if ((MCPDBReturnOK != theCheckCode) && (MCPDBReturnMultiple != theCheckCode)) { NSLog(@"Unable to get the primary key for the object, will abort now the fetch of autoGenerated attributes (left unchanged)!"); return theCheckCode; @@ -586,8 +586,8 @@ some auto-generated attributes. NSArray *theAttributes = [classDescription attributes]; NSArray *thePrimKeyAttributes = [classDescription primaryKeyAttributes]; NSMutableString *theQuery = [NSMutableString string]; - int theCheckCode; - unsigned i, j; + NSInteger theCheckCode; + NSUInteger i, j; MCPConnection *theConnection = [self connection]; if (! theConnection) { @@ -644,7 +644,7 @@ some auto-generated attributes. } else { NSDictionary *theKeyCheck = [self checkDBId]; - int theIdCheckCode = [(NSNumber *) [theKeyCheck objectForKey:@"MCPDBReturnCode"] intValue]; + NSInteger theIdCheckCode = [(NSNumber *) [theKeyCheck objectForKey:@"MCPDBReturnCode"] integerValue]; if (MCPDBReturnOK == theIdCheckCode) { theCheckCode = [self updateInDB]; @@ -665,9 +665,9 @@ some auto-generated attributes. { NSArray *theKeyAttributes = [classDescription primaryKeyAttributes]; NSArray *theAttributes = [classDescription attributes]; - unsigned i; + NSUInteger i; // NSMutableDictionary *theKeyValue = [NSMutableDictionary dictionary]; - int theCheckCode = MCPDBReturnOK; + NSInteger theCheckCode = MCPDBReturnOK; MCPConnection *theConnection = [self connection]; if (! theConnection) { @@ -676,14 +676,14 @@ some auto-generated attributes. // Get the value of the primary key: for (i=0; [theKeyAttributes count] != i; ++i) { id theValue = [self valueForKey:[(MCPAttribute*) [theKeyAttributes objectAtIndex:i] name]]; - if ((! theValue) || ([theValue isKindOfClass:[NSNumber class]] && (0 == [theValue intValue]))) { + if ((! theValue) || ([theValue isKindOfClass:[NSNumber class]] && (0 == [theValue integerValue]))) { theCheckCode = MCPDBReturnIncompleteKey; break; } } // If incomplete, try to find the rest, and perform again: if (MCPDBReturnIncompleteKey == theCheckCode) { - if (MCPDBReturnOK == [(NSNumber *)[[self checkDBId] objectForKey:@"MCPDBReturnCode"] intValue]) { + if (MCPDBReturnOK == [(NSNumber *)[[self checkDBId] objectForKey:@"MCPDBReturnCode"] integerValue]) { return [self deleteInDB]; } else { @@ -715,7 +715,7 @@ some auto-generated attributes. NSMutableString *theQuery = [NSMutableString string]; MCPClassDescription *theClassDescription = (MCPClassDescription *) [NSClassDescription classDescriptionForClass:[self class]]; NSArray *theKeyAttributes = [theClassDescription primaryKeyAttributes]; - unsigned i; + NSUInteger i; if (! [iConnection checkConnection]) { return MCPDBReturnNoConnection; @@ -762,7 +762,7 @@ Also the returned object is ALWAYS autoreleased before being returned. NSArray *keys; NSArray *ids; MCPResult *result; - unsigned int i; + NSUInteger i; NSDictionary *theRow; id theRet; @@ -851,7 +851,7 @@ Also the returned object is ALWAYS autoreleased before being returned. Obviuosly this method is taking care of only to-one relation. It will hence check that iRelation is a to-one relation starting from self. Finally, you can use setTarget:nil forRelation:... to 'delete' a previously establlished relation (if the model and DB permit it)."*/ { - unsigned int i; + NSUInteger i; MCPObject *oldTarget; if (! [connection isConnected]) { @@ -891,10 +891,10 @@ Finally, you can use setTarget:nil forRelation:... to 'delete' a previously esta return (theRelation) ? [self setTarget:iTarget forRelation:theRelation] : MCPDBReturnNoSuchRelation; } -- (unsigned int) countTargetForRelation:(MCPRelation *) iRelation +- (NSUInteger) countTargetForRelation:(MCPRelation *) iRelation { NSMutableString *theQuery; - unsigned int i; + NSUInteger i; NSArray *theJoinArray; MCPResult *theResult; NSDictionary *theRow; @@ -914,30 +914,30 @@ Finally, you can use setTarget:nil forRelation:... to 'delete' a previously esta theResult = [connection queryString:theQuery]; [theQuery release]; theRow = [theResult fetchRowAsDictionary]; - return [(NSNumber *)[theRow objectForKey:@"COUNT(*)"] unsignedIntValue]; + return [(NSNumber *)[theRow objectForKey:@"COUNT(*)"] unsignedIntegerValue]; } -- (unsigned int) countTargetForRelationNamed:(NSString *) iRelationName +- (NSUInteger) countTargetForRelationNamed:(NSString *) iRelationName { MCPRelation *theRelation = [classDescription relationWithName:iRelationName]; return (theRelation) ? [self countTargetForRelation:theRelation] : 0; } -- (MCPObject *) getTargetOfRelation:(MCPRelation *) iRelation atIndex:(unsigned int) iIndex +- (MCPObject *) getTargetOfRelation:(MCPRelation *) iRelation atIndex:(NSUInteger) iIndex /*" This method will return the specific object which is the iIndex'th object of th relation (after ordering the object using the destination identity). This method (like other assuming order in the relation targets) will be doubtfull if the class does NOT have a single identity attribute."*/ { NSMutableString *query; MCPClassDescription *destinationDesc; - NSArray *joins; - NSArray *keys; - NSArray *ids; - MCPResult *result; - unsigned int i; - NSDictionary *theRow; - MCPObject *theRet; + NSArray *joins; + NSArray *keys; + NSArray *ids; + MCPResult *result; + NSUInteger i; + NSDictionary *theRow; + MCPObject *theRet; if (! iRelation) { NSLog(@"Tried to get the target of a relation... but the relation object is nil"); @@ -983,7 +983,7 @@ This method (like other assuming order in the relation targets) will be doubtful [query appendString:[(MCPAttribute *)[ids objectAtIndex:i] externalName]]; } */ - [query appendFormat:@" LIMIT 1 OFFSET %u", iIndex]; + [query appendFormat:@" LIMIT 1 OFFSET %ld", iIndex]; result = [connection queryString:query]; [query release]; @@ -1000,7 +1000,7 @@ This method (like other assuming order in the relation targets) will be doubtful return theRet; } -- (MCPObject *) getTargetOfRelationNamed:(NSString *) iRelationName atIndex:(unsigned int) iIndex +- (MCPObject *) getTargetOfRelationNamed:(NSString *) iRelationName atIndex:(NSUInteger) iIndex /*"This is the equivalent of the getTargetOfRelation:atIndex:, but giving a relation name instead of the MCPRelation object itself."*/ { MCPRelation *theRelation = [classDescription relationWithName:iRelationName]; @@ -1014,7 +1014,7 @@ If any value corresping to an attribute of self i modified in the DB, then it wi Obviuosly this method is taking care of only to-many relation. It will hence check that iRelation is a to-many relation starting from self."*/ { NSArray *joins; - unsigned int i; + NSUInteger i; NSDictionary *saveReturn; if (! [connection isConnected]) { @@ -1036,7 +1036,7 @@ Obviuosly this method is taking care of only to-many relation. It will hence che [iTarget setConnection:connection]; } saveReturn = [iTarget saveInDB]; - return (MCPDBReturnCode)[(NSNumber *)[saveReturn objectForKey:@"MCPDBReturnCode"] unsignedIntValue]; + return (MCPDBReturnCode)[(NSNumber *)[saveReturn objectForKey:@"MCPDBReturnCode"] unsignedIntegerValue]; } - (MCPDBReturnCode) addTarget:(MCPObject *) iTarget toRelationNamed:(NSString *) iRelationName @@ -1052,7 +1052,7 @@ If any value corresping to an attribute of self i modified in the DB, then it wi Obviuosly this method is taking care of only to-many relation. It will hence check that iRelation is a to-many relation starting from self."*/ { NSArray *joins; - unsigned int i; + NSUInteger i; // NSDictionary *saveReturn; BOOL targetIsTarget = YES; MCPDBReturnCode returnCode; @@ -1083,7 +1083,7 @@ Obviuosly this method is taking care of only to-many relation. It will hence che [iTarget setValue:[[join destination] defaultValue] forKey:[[join destination] name]]; } if (! [iRelation ownsDestination]) { - returnCode = [(NSNumber *)[[iTarget saveInDB] objectForKey:@"MCPDBReturnCode"] unsignedIntValue]; + returnCode = [(NSNumber *)[[iTarget saveInDB] objectForKey:@"MCPDBReturnCode"] unsignedIntegerValue]; } return returnCode; } @@ -1094,7 +1094,7 @@ Obviuosly this method is taking care of only to-many relation. It will hence che return (theRelation) ? [self removeTarget:iTarget toRelation:theRelation] : MCPDBReturnNoSuchRelation; } -- (MCPDBReturnCode) removeTargetToRelation:(MCPRelation *) iRelation atIndex:(unsigned int) iIndex +- (MCPDBReturnCode) removeTargetToRelation:(MCPRelation *) iRelation atIndex:(NSUInteger) iIndex /*" This method will use an index t first query the object that it should remove from the relation, then uses the -[MCPObject removeTarget:toRelation:] method to remove the object from the relation. If the index is out of bound (the returned object is nil), it will return MCPDBReturnNone, to signal there was no object with this index in the relation."*/ @@ -1119,20 +1119,20 @@ Obviuosly this method is taking care of only to-many relation. It will hence che } } -- (MCPDBReturnCode) removeTargetToRelationNamed:(NSString *) iRelationName atIndex:(unsigned int) iIndex +- (MCPDBReturnCode) removeTargetToRelationNamed:(NSString *) iRelationName atIndex:(NSUInteger) iIndex { MCPRelation *theRelation = [classDescription relationWithName:iRelationName]; return (theRelation) ? [self removeTargetToRelation:theRelation atIndex:iIndex] : MCPDBReturnNoSuchRelation; } -- (unsigned int) indexOfTarget:(MCPObject *) iTarget inRelation:(MCPRelation *) iRelation +- (NSUInteger) indexOfTarget:(MCPObject *) iTarget inRelation:(MCPRelation *) iRelation /*" Returns the index of the target object within the relation. Return NSNotFound if the objkect is NOT in the relation!!"*/ { NSMutableString *query; NSArray *joins; NSArray *keys; NSArray *ids; - unsigned int i; + NSUInteger i; MCPResult *result; NSDictionary *row; NSMutableDictionary *targetKey; @@ -1195,7 +1195,7 @@ Obviuosly this method is taking care of only to-many relation. It will hence che return NSNotFound; } -- (unsigned int) indexOfTarget:(MCPObject *) iTarget inRelationNamed:(NSString *) iRelationName +- (NSUInteger) indexOfTarget:(MCPObject *) iTarget inRelationNamed:(NSString *) iRelationName /*" The equivalent of -[MCPObject indexOfTarget:inRelation:] but using relation name instead of a MCPRelation object. Indeed after getting the MCPRelation object corresponding to the name, this method will only return the result of the corresponding call to -[MCPObject indexOfTarget:inRelation:]."*/ @@ -1219,7 +1219,7 @@ the result of the corresponding call to -[MCPObject indexOfTarget:inRelation:]." id theRet; if ([theAttrClass isSubclassOfClass:[NSNumber class]]) { - return [NSNumber numberWithInt:0]; + return [NSNumber numberWithInteger:0]; } theRet = [[[theAttrClass alloc] init] autorelease]; if (nil == theRet) { @@ -1235,7 +1235,7 @@ the result of the corresponding call to -[MCPObject indexOfTarget:inRelation:]." { NSMutableDictionary *theRet = [NSMutableDictionary dictionary]; NSArray *theIdAttr = [classDescription primaryKeyAttributes]; - unsigned i; + NSUInteger i; for (i=0; [theIdAttr count] != i; ++i) { NSString *theKey = [(MCPAttribute *)[theIdAttr objectAtIndex:i] name]; @@ -1254,7 +1254,7 @@ the result of the corresponding call to -[MCPObject indexOfTarget:inRelation:]." - (BOOL) isEqual:(id) iObject { NSArray *theIdAttr; - unsigned int i; + NSUInteger i; BOOL theRet; if (self == iObject) { @@ -1281,15 +1281,17 @@ the result of the corresponding call to -[MCPObject indexOfTarget:inRelation:]." - (NSString *) descriptionWithLocale:(NSDictionary *) locale { - NSMutableString *theOutput = [NSMutableString string]; - unsigned int i; - NSArray *theAttributes = [classDescription attributes]; - BOOL trunc = [MCPConnection truncateLongField]; + NSMutableString *theOutput = [NSMutableString string]; + NSUInteger i; + NSArray *theAttributes = [classDescription attributes]; + BOOL trunc = [MCPConnection truncateLongField]; - [theOutput appendFormat:@"MCPObject subclass : %@\n", [self className]]; - for (i=0; [theAttributes count] != i; ++i) { - MCPAttribute *theAttribute = (MCPAttribute *) [theAttributes objectAtIndex:i]; - id theValue = [self valueForKey:[theAttribute name]]; + [theOutput appendFormat:@"MCPObject subclass : %@\n", [self className]]; + + for (i = 0; [theAttributes count] != i; ++i) + { + MCPAttribute *theAttribute = (MCPAttribute *) [theAttributes objectAtIndex:i]; + id theValue = [self valueForKey:[theAttribute name]]; if (trunc) { if (([theValue isKindOfClass:[NSString class]]) && (kLengthOfTruncationForLog < [(NSString *)theValue length])) { @@ -1299,10 +1301,13 @@ the result of the corresponding call to -[MCPObject indexOfTarget:inRelation:]." theValue = [NSData dataWithBytes:[theValue bytes] length:kLengthOfTruncationForLog]; } } - [theOutput appendFormat:@"\tAttribute %u : name = %@, value = %@\n", i, [theAttribute name], theValue]; - } - [theOutput appendString:@"\n"]; - return theOutput; + + [theOutput appendFormat:@"\tAttribute %ld : name = %@, value = %@\n", i, [theAttribute name], theValue]; + } + + [theOutput appendString:@"\n"]; + + return theOutput; } #pragma mark Ordering the array for relations @@ -1310,7 +1315,7 @@ the result of the corresponding call to -[MCPObject indexOfTarget:inRelation:]." { NSMutableArray *theAttributes = [[NSMutableArray alloc] initWithArray:[iClassDescription identityAttributes]]; NSMutableString *theReturn = [NSMutableString string]; - unsigned int i; + NSUInteger i; for (i = 0; [[iClassDescription primaryKeyAttributes] count] != i; ++i) { [theAttributes insertObject:[[iClassDescription primaryKeyAttributes] objectAtIndex:i] atIndex:[theAttributes count]]; @@ -1331,7 +1336,7 @@ the result of the corresponding call to -[MCPObject indexOfTarget:inRelation:]." - (void) setNilValueForKey:(NSString *) iKey { NSLog(@"Try to set %@ to nil .... not possible, will set it to zero instead...", iKey); - [self setValue:[NSNumber numberWithInt:0] forKey:iKey]; + [self setValue:[NSNumber numberWithInteger:0] forKey:iKey]; } @end diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPRelation.h b/Frameworks/MCPKit/MCPEntrepriseKit/MCPRelation.h index 5cf2437a..118734eb 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPRelation.h +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPRelation.h @@ -81,8 +81,8 @@ typedef enum { - (void) setName:(NSString *) iName; - (void) setDeleteRule:(MCPRelationDeleteRule) iDeleteRule; - (void) setInverseRelation:(MCPRelation *) iInverseRelation; -- (void) insertObject:(MCPJoin *) iJoin inJoinsAtIndex:(unsigned int) index; -- (void) removeObjectFromJoinsAtIndex:(unsigned int) index; +- (void) insertObject:(MCPJoin *) iJoin inJoinsAtIndex:(NSUInteger) index; +- (void) removeObjectFromJoinsAtIndex:(NSUInteger) index; - (void) setIsToMany:(BOOL) iIsToMany; - (void) setIsMandatory:(BOOL) iIsMandatory; - (void) setOwnsDestintation:(BOOL) iOwnsDestination; @@ -94,9 +94,9 @@ typedef enum { - (MCPClassDescription *) origin; - (MCPClassDescription *) destination; - (NSArray *) joins; -- (unsigned int) countOfJoins; -- (MCPJoin *) objectInJoinsAtIndex:(unsigned int) index; -- (unsigned int) indexOfJoinIdenticalTo:(id) iJoin; +- (NSUInteger) countOfJoins; +- (MCPJoin *) objectInJoinsAtIndex:(NSUInteger) index; +- (NSUInteger) indexOfJoinIdenticalTo:(id) iJoin; - (BOOL) isToMany; - (BOOL) isMandatory; - (BOOL) ownsDestination; diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPRelation.m b/Frameworks/MCPKit/MCPEntrepriseKit/MCPRelation.m index 9aa94fb1..6d1e58f4 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPRelation.m +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPRelation.m @@ -50,11 +50,11 @@ static NSArray *MCPexistingDeleteRules; [self setVersion:010101]; // Ma.Mi.Re -> MaMiRe - [theExistingDeleteRules addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:OnDeleteNullify], @"tag", @"Nullify", @"name", nil]]; - [theExistingDeleteRules addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:OnDeleteDeny], @"tag", @"Deny", @"name", nil]]; - [theExistingDeleteRules addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:OnDeleteCascade], @"tag", @"Cascade", @"name", nil]]; - [theExistingDeleteRules addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:OnDeleteDefault], @"tag", @"Default", @"name", nil]]; - [theExistingDeleteRules addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:OnDeleteNoAction], @"tag", @"No Action", @"name", nil]]; + [theExistingDeleteRules addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:OnDeleteNullify], @"tag", @"Nullify", @"name", nil]]; + [theExistingDeleteRules addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:OnDeleteDeny], @"tag", @"Deny", @"name", nil]]; + [theExistingDeleteRules addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:OnDeleteCascade], @"tag", @"Cascade", @"name", nil]]; + [theExistingDeleteRules addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:OnDeleteDefault], @"tag", @"Default", @"name", nil]]; + [theExistingDeleteRules addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInteger:OnDeleteNoAction], @"tag", @"No Action", @"name", nil]]; MCPexistingDeleteRules = [[NSArray alloc] initWithArray:theExistingDeleteRules]; [theExistingDeleteRules release]; } @@ -188,7 +188,7 @@ static NSArray *MCPexistingDeleteRules; - (void) removeJoinFrom:(MCPAttribute *) iFrom to:(MCPAttribute *) iTo { NSDictionary *theJoinDict = [[NSDictionary alloc] initWithObjectsAndKeys:self, @"relation", iFrom, @"origin", iTo, @"destination", nil]; - unsigned int i = [joins indexOfObject:theJoinDict]; + NSUInteger i = [joins indexOfObject:theJoinDict]; if (NSNotFound != i) { [[self objectInJoinsAtIndex:i] invalidate]; @@ -263,12 +263,12 @@ static NSArray *MCPexistingDeleteRules; } } -- (void) insertObject:(MCPJoin *) iJoin inJoinsAtIndex:(unsigned int) index +- (void) insertObject:(MCPJoin *) iJoin inJoinsAtIndex:(NSUInteger) index { [joins insertObject:iJoin atIndex:index]; } -- (void) removeObjectFromJoinsAtIndex:(unsigned int) index +- (void) removeObjectFromJoinsAtIndex:(NSUInteger) index { [joins removeObjectAtIndex:index]; } @@ -334,17 +334,17 @@ static NSArray *MCPexistingDeleteRules; return [NSArray arrayWithArray:joins]; } -- (unsigned int) countOfJoins +- (NSUInteger) countOfJoins { return [joins count]; } -- (MCPJoin *) objectInJoinsAtIndex:(unsigned int) index +- (MCPJoin *) objectInJoinsAtIndex:(NSUInteger) index { return (MCPJoin *)((NSNotFound != index) ? [joins objectAtIndex:index] : nil); } -- (unsigned int) indexOfJoinIdenticalTo:(id) iJoin +- (NSUInteger) indexOfJoinIdenticalTo:(id) iJoin { return [joins indexOfObjectIdenticalTo:iJoin]; } @@ -368,7 +368,7 @@ static NSArray *MCPexistingDeleteRules; - (MCPAttribute *) destinationAttributeForOrigin:(MCPAttribute *) iFrom { - unsigned int i; + NSUInteger i; for (i=0; ([joins count] != i) && ([[(MCPJoin *)[joins objectAtIndex:i] origin] isEqual:iFrom]); ++i) { } @@ -377,7 +377,7 @@ static NSArray *MCPexistingDeleteRules; - (MCPAttribute *) originAttributeForDestination:(MCPAttribute *) iTo { - unsigned int i; + NSUInteger i; for (i=0; ([joins count] != i) && ([[(MCPJoin *)[joins objectAtIndex:i] destination] isEqual:iTo]); ++i) { } @@ -404,7 +404,7 @@ static NSArray *MCPexistingDeleteRules; - (NSString *) descriptionWithLocale:(NSDictionary *) locale { NSMutableString *theRet = [NSMutableString stringWithFormat:@"MCPRelation named %@, going from %@ to %@. Joins :\n", name, [origin name], [destination name]]; - unsigned int i; + NSUInteger i; for (i = 0; [joins count] != i; ++i) { MCPJoin *tmpJoin = (MCPJoin *)[joins objectAtIndex:i]; |