Monotone-Parent: 42bfc0613859467f595a2bdb349908a8f8d602f2
Monotone-Revision: 8a9b77b9c41a41491783c3507d9b85c3555500a3 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-08-05T01:46:41 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
ce6c8b3627
commit
46bd0d063a
|
@ -100,10 +100,16 @@
|
||||||
|
|
||||||
- (CardGroup *) searchParentOfClass: (Class) parentClass;
|
- (CardGroup *) searchParentOfClass: (Class) parentClass;
|
||||||
|
|
||||||
- (CardElement *) elementWithClass: (Class) elementClass;
|
- (id) elementWithClass: (Class) elementClass;
|
||||||
|
|
||||||
- (void) setValuesAsCopy: (NSMutableArray *) someValues;
|
- (void) setValuesAsCopy: (NSMutableArray *) someValues;
|
||||||
- (void) setAttributesAsCopy: (NSMutableDictionary *) someAttributes;
|
- (void) setAttributesAsCopy: (NSMutableDictionary *) someAttributes;
|
||||||
|
|
||||||
|
- (NSMutableArray *) deepCopyOfArray: (NSArray *) oldArray
|
||||||
|
withZone: (NSZone *) aZone;
|
||||||
|
- (NSMutableDictionary *) deepCopyOfDictionary: (NSDictionary *) oldDictionary
|
||||||
|
withZone: (NSZone *) aZone;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#define IS_EQUAL(a,b,sel) \
|
#define IS_EQUAL(a,b,sel) \
|
||||||
|
|
|
@ -464,7 +464,7 @@
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CardElement *) elementWithClass: (Class) elementClass
|
- (id) elementWithClass: (Class) elementClass
|
||||||
{
|
{
|
||||||
CardElement *newElement;
|
CardElement *newElement;
|
||||||
|
|
||||||
|
@ -522,6 +522,41 @@
|
||||||
|
|
||||||
/* NSCopying */
|
/* NSCopying */
|
||||||
|
|
||||||
|
- (NSMutableArray *) deepCopyOfArray: (NSArray *) oldArray
|
||||||
|
withZone: (NSZone *) aZone
|
||||||
|
{
|
||||||
|
NSMutableArray *newArray;
|
||||||
|
unsigned int count, max;
|
||||||
|
id newChild;
|
||||||
|
|
||||||
|
newArray = [NSMutableArray array];
|
||||||
|
|
||||||
|
max = [oldArray count];
|
||||||
|
for (count = 0; count < max; count++)
|
||||||
|
{
|
||||||
|
newChild = [[oldArray objectAtIndex: count] mutableCopyWithZone: aZone];
|
||||||
|
[newArray addObject: newChild];
|
||||||
|
}
|
||||||
|
|
||||||
|
return newArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSMutableDictionary *) deepCopyOfDictionary: (NSDictionary *) oldDictionary
|
||||||
|
withZone: (NSZone *) aZone
|
||||||
|
{
|
||||||
|
NSMutableDictionary *newDict;
|
||||||
|
NSArray *newKeys, *newValues;
|
||||||
|
|
||||||
|
newKeys = [self deepCopyOfArray: [oldDictionary allKeys]
|
||||||
|
withZone: aZone];
|
||||||
|
newValues = [self deepCopyOfArray: [oldDictionary allValues]
|
||||||
|
withZone: aZone];
|
||||||
|
newDict = [NSMutableDictionary dictionaryWithObjects: newValues
|
||||||
|
forKeys: newKeys];
|
||||||
|
|
||||||
|
return newDict;
|
||||||
|
}
|
||||||
|
|
||||||
- (id) copyWithZone: (NSZone *) aZone
|
- (id) copyWithZone: (NSZone *) aZone
|
||||||
{
|
{
|
||||||
CardElement *new;
|
CardElement *new;
|
||||||
|
@ -529,9 +564,10 @@
|
||||||
new = [[self class] new];
|
new = [[self class] new];
|
||||||
[new setTag: [tag copyWithZone: aZone]];
|
[new setTag: [tag copyWithZone: aZone]];
|
||||||
[new setGroup: [group copyWithZone: aZone]];
|
[new setGroup: [group copyWithZone: aZone]];
|
||||||
[new setParent: parent];
|
[new setParent: nil];
|
||||||
[new setValuesAsCopy: [values copyWithZone: aZone]];
|
[new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]];
|
||||||
[new setAttributesAsCopy: [attributes copyWithZone: aZone]];
|
[new setAttributesAsCopy: [self deepCopyOfDictionary: attributes
|
||||||
|
withZone: aZone]];
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
@ -544,9 +580,10 @@
|
||||||
new = [[self class] new];
|
new = [[self class] new];
|
||||||
[new setTag: [tag mutableCopyWithZone: aZone]];
|
[new setTag: [tag mutableCopyWithZone: aZone]];
|
||||||
[new setGroup: [group mutableCopyWithZone: aZone]];
|
[new setGroup: [group mutableCopyWithZone: aZone]];
|
||||||
[new setParent: parent];
|
[new setParent: nil];
|
||||||
[new setValuesAsCopy: [values mutableCopyWithZone: aZone]];
|
[new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]];
|
||||||
[new setAttributesAsCopy: [attributes mutableCopyWithZone: aZone]];
|
[new setAttributesAsCopy: [self deepCopyOfDictionary: attributes
|
||||||
|
withZone: aZone]];
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
types: (NSArray *) someTypes
|
types: (NSArray *) someTypes
|
||||||
singleValue: (NSString *) aValue;
|
singleValue: (NSString *) aValue;
|
||||||
|
|
||||||
- (CardGroup *) groupWithClass: (Class) groupClass;
|
|
||||||
- (void) setChildrenAsCopy: (NSMutableArray *) someChildren;
|
- (void) setChildrenAsCopy: (NSMutableArray *) someChildren;
|
||||||
|
|
||||||
- (void) replaceThisElement: (CardElement *) oldElement
|
- (void) replaceThisElement: (CardElement *) oldElement
|
||||||
|
|
|
@ -160,10 +160,7 @@ static NGCardsSaxHandler *sax = nil;
|
||||||
{
|
{
|
||||||
NSLog (@"warning: new child to entity '%@': '%@' converted to '%@'",
|
NSLog (@"warning: new child to entity '%@': '%@' converted to '%@'",
|
||||||
tag, childTag, NSStringFromClass(mappedClass));
|
tag, childTag, NSStringFromClass(mappedClass));
|
||||||
if ([aChild isKindOfClass: [CardGroup class]])
|
newChild = [aChild elementWithClass: mappedClass];
|
||||||
newChild = [(CardGroup *) aChild groupWithClass: mappedClass];
|
|
||||||
else
|
|
||||||
newChild = [aChild elementWithClass: mappedClass];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
|
@ -235,12 +232,7 @@ static NGCardsSaxHandler *sax = nil;
|
||||||
child = [existing objectAtIndex: 0];
|
child = [existing objectAtIndex: 0];
|
||||||
mappedClass = [self classForTag: [aTag uppercaseString]];
|
mappedClass = [self classForTag: [aTag uppercaseString]];
|
||||||
if (mappedClass)
|
if (mappedClass)
|
||||||
{
|
mappedChild = [child elementWithClass: mappedClass];
|
||||||
if ([child isKindOfClass: [CardGroup class]])
|
|
||||||
mappedChild = [(CardGroup *) child groupWithClass: mappedClass];
|
|
||||||
else
|
|
||||||
mappedChild = [child elementWithClass: mappedClass];
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
mappedChild = child;
|
mappedChild = child;
|
||||||
}
|
}
|
||||||
|
@ -298,8 +290,7 @@ static NGCardsSaxHandler *sax = nil;
|
||||||
CardGroup *element;
|
CardGroup *element;
|
||||||
NSString *value;
|
NSString *value;
|
||||||
|
|
||||||
elements = [NSMutableArray new];
|
elements = [NSMutableArray array];
|
||||||
[elements autorelease];
|
|
||||||
|
|
||||||
allElements = [[self childrenWithTag: aTag] objectEnumerator];
|
allElements = [[self childrenWithTag: aTag] objectEnumerator];
|
||||||
element = [allElements nextObject];
|
element = [allElements nextObject];
|
||||||
|
@ -317,8 +308,7 @@ static NGCardsSaxHandler *sax = nil;
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning should be renamed to elementWithClass...
|
- (id) elementWithClass: (Class) groupClass
|
||||||
- (CardGroup *) groupWithClass: (Class) groupClass
|
|
||||||
{
|
{
|
||||||
CardGroup *newGroup;
|
CardGroup *newGroup;
|
||||||
|
|
||||||
|
@ -326,7 +316,7 @@ static NGCardsSaxHandler *sax = nil;
|
||||||
newGroup = self;
|
newGroup = self;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newGroup = (CardGroup *) [self elementWithClass: groupClass];
|
newGroup = [super elementWithClass: groupClass];
|
||||||
[newGroup setChildrenAsCopy: children];
|
[newGroup setChildrenAsCopy: children];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,14 +325,13 @@ static NGCardsSaxHandler *sax = nil;
|
||||||
|
|
||||||
- (void) setChildrenAsCopy: (NSMutableArray *) someChildren
|
- (void) setChildrenAsCopy: (NSMutableArray *) someChildren
|
||||||
{
|
{
|
||||||
NSEnumerator *list;
|
unsigned int count, max;
|
||||||
CardElement *currentChild;
|
|
||||||
|
|
||||||
ASSIGN (children, someChildren);
|
ASSIGN (children, someChildren);
|
||||||
|
|
||||||
list = [children objectEnumerator];
|
max = [children count];
|
||||||
while ((currentChild = [list nextObject]))
|
for (count = 0; count < max; count++)
|
||||||
[currentChild setParent: self];
|
[[children objectAtIndex: count] setParent: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) addChildWithTag: (NSString *) aTag
|
- (void) addChildWithTag: (NSString *) aTag
|
||||||
|
@ -398,20 +387,10 @@ static NGCardsSaxHandler *sax = nil;
|
||||||
- (id) copyWithZone: (NSZone *) aZone
|
- (id) copyWithZone: (NSZone *) aZone
|
||||||
{
|
{
|
||||||
CardGroup *new;
|
CardGroup *new;
|
||||||
CardElement *newChild;
|
|
||||||
NSMutableArray *newChildren;
|
|
||||||
unsigned int count, max;
|
|
||||||
|
|
||||||
new = [super copyWithZone: aZone];
|
new = [super copyWithZone: aZone];
|
||||||
newChildren = [NSMutableArray new];
|
[new setChildrenAsCopy: [self deepCopyOfArray: children
|
||||||
max = [children count];
|
withZone: aZone]];
|
||||||
for (count = 0; count < max; count++)
|
|
||||||
{
|
|
||||||
newChild = [[children objectAtIndex: count] copyWithZone: aZone];
|
|
||||||
[newChildren addObject: newChild];
|
|
||||||
}
|
|
||||||
[new setChildrenAsCopy: newChildren];
|
|
||||||
[newChildren release];
|
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
@ -421,21 +400,10 @@ static NGCardsSaxHandler *sax = nil;
|
||||||
- (id) mutableCopyWithZone: (NSZone *) aZone
|
- (id) mutableCopyWithZone: (NSZone *) aZone
|
||||||
{
|
{
|
||||||
CardGroup *new;
|
CardGroup *new;
|
||||||
CardElement *newChild;
|
|
||||||
NSMutableArray *newChildren;
|
|
||||||
unsigned int count, max;
|
|
||||||
|
|
||||||
new = [super mutableCopyWithZone: aZone];
|
new = [super mutableCopyWithZone: aZone];
|
||||||
newChildren = [NSMutableArray new];
|
[new setChildrenAsCopy: [self deepCopyOfArray: children
|
||||||
max = [children count];
|
withZone: aZone]];
|
||||||
for (count = 0; count < max; count++)
|
|
||||||
{
|
|
||||||
newChild
|
|
||||||
= [[children objectAtIndex: count] mutableCopyWithZone: aZone];
|
|
||||||
[newChildren addObject: newChild];
|
|
||||||
}
|
|
||||||
[new setChildrenAsCopy: newChildren];
|
|
||||||
[newChildren release];
|
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
|
2008-08-04 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* CardGroup.m ([CardGroup -elementWithClass:groupClass]): replaces
|
||||||
|
"groupWithClass:".
|
||||||
|
|
||||||
|
* CardElement.m ([CardElement
|
||||||
|
-deepCopyOfArray:oldArraywithZone:aZone]): new self-explaining
|
||||||
|
method.
|
||||||
|
([CardElement -deepCopyOfDictionary:oldDictionarywithZone:aZone]):
|
||||||
|
new self-explaining method.
|
||||||
|
([CardElement -copyWithZone:aZone])
|
||||||
|
([CardElement -mutableCopyWithZone:aZone]): make a deep copy of
|
||||||
|
the children elements.
|
||||||
|
|
||||||
2008-07-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2008-07-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* iCalRepeatableEntityObject.m ([iCalRepeatableEntityObject
|
* iCalRepeatableEntityObject.m ([iCalRepeatableEntityObject
|
||||||
|
|
Loading…
Reference in New Issue