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;
|
||||
|
||||
- (CardElement *) elementWithClass: (Class) elementClass;
|
||||
- (id) elementWithClass: (Class) elementClass;
|
||||
|
||||
- (void) setValuesAsCopy: (NSMutableArray *) someValues;
|
||||
- (void) setAttributesAsCopy: (NSMutableDictionary *) someAttributes;
|
||||
|
||||
- (NSMutableArray *) deepCopyOfArray: (NSArray *) oldArray
|
||||
withZone: (NSZone *) aZone;
|
||||
- (NSMutableDictionary *) deepCopyOfDictionary: (NSDictionary *) oldDictionary
|
||||
withZone: (NSZone *) aZone;
|
||||
|
||||
@end
|
||||
|
||||
#define IS_EQUAL(a,b,sel) \
|
||||
|
|
|
@ -464,7 +464,7 @@
|
|||
return string;
|
||||
}
|
||||
|
||||
- (CardElement *) elementWithClass: (Class) elementClass
|
||||
- (id) elementWithClass: (Class) elementClass
|
||||
{
|
||||
CardElement *newElement;
|
||||
|
||||
|
@ -522,6 +522,41 @@
|
|||
|
||||
/* 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
|
||||
{
|
||||
CardElement *new;
|
||||
|
@ -529,9 +564,10 @@
|
|||
new = [[self class] new];
|
||||
[new setTag: [tag copyWithZone: aZone]];
|
||||
[new setGroup: [group copyWithZone: aZone]];
|
||||
[new setParent: parent];
|
||||
[new setValuesAsCopy: [values copyWithZone: aZone]];
|
||||
[new setAttributesAsCopy: [attributes copyWithZone: aZone]];
|
||||
[new setParent: nil];
|
||||
[new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]];
|
||||
[new setAttributesAsCopy: [self deepCopyOfDictionary: attributes
|
||||
withZone: aZone]];
|
||||
|
||||
return new;
|
||||
}
|
||||
|
@ -544,9 +580,10 @@
|
|||
new = [[self class] new];
|
||||
[new setTag: [tag mutableCopyWithZone: aZone]];
|
||||
[new setGroup: [group mutableCopyWithZone: aZone]];
|
||||
[new setParent: parent];
|
||||
[new setValuesAsCopy: [values mutableCopyWithZone: aZone]];
|
||||
[new setAttributesAsCopy: [attributes mutableCopyWithZone: aZone]];
|
||||
[new setParent: nil];
|
||||
[new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]];
|
||||
[new setAttributesAsCopy: [self deepCopyOfDictionary: attributes
|
||||
withZone: aZone]];
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
types: (NSArray *) someTypes
|
||||
singleValue: (NSString *) aValue;
|
||||
|
||||
- (CardGroup *) groupWithClass: (Class) groupClass;
|
||||
- (void) setChildrenAsCopy: (NSMutableArray *) someChildren;
|
||||
|
||||
- (void) replaceThisElement: (CardElement *) oldElement
|
||||
|
|
|
@ -160,9 +160,6 @@ static NGCardsSaxHandler *sax = nil;
|
|||
{
|
||||
NSLog (@"warning: new child to entity '%@': '%@' converted to '%@'",
|
||||
tag, childTag, NSStringFromClass(mappedClass));
|
||||
if ([aChild isKindOfClass: [CardGroup class]])
|
||||
newChild = [(CardGroup *) aChild groupWithClass: mappedClass];
|
||||
else
|
||||
newChild = [aChild elementWithClass: mappedClass];
|
||||
}
|
||||
}
|
||||
|
@ -235,12 +232,7 @@ static NGCardsSaxHandler *sax = nil;
|
|||
child = [existing objectAtIndex: 0];
|
||||
mappedClass = [self classForTag: [aTag uppercaseString]];
|
||||
if (mappedClass)
|
||||
{
|
||||
if ([child isKindOfClass: [CardGroup class]])
|
||||
mappedChild = [(CardGroup *) child groupWithClass: mappedClass];
|
||||
else
|
||||
mappedChild = [child elementWithClass: mappedClass];
|
||||
}
|
||||
else
|
||||
mappedChild = child;
|
||||
}
|
||||
|
@ -298,8 +290,7 @@ static NGCardsSaxHandler *sax = nil;
|
|||
CardGroup *element;
|
||||
NSString *value;
|
||||
|
||||
elements = [NSMutableArray new];
|
||||
[elements autorelease];
|
||||
elements = [NSMutableArray array];
|
||||
|
||||
allElements = [[self childrenWithTag: aTag] objectEnumerator];
|
||||
element = [allElements nextObject];
|
||||
|
@ -317,8 +308,7 @@ static NGCardsSaxHandler *sax = nil;
|
|||
return elements;
|
||||
}
|
||||
|
||||
#warning should be renamed to elementWithClass...
|
||||
- (CardGroup *) groupWithClass: (Class) groupClass
|
||||
- (id) elementWithClass: (Class) groupClass
|
||||
{
|
||||
CardGroup *newGroup;
|
||||
|
||||
|
@ -326,7 +316,7 @@ static NGCardsSaxHandler *sax = nil;
|
|||
newGroup = self;
|
||||
else
|
||||
{
|
||||
newGroup = (CardGroup *) [self elementWithClass: groupClass];
|
||||
newGroup = [super elementWithClass: groupClass];
|
||||
[newGroup setChildrenAsCopy: children];
|
||||
}
|
||||
|
||||
|
@ -335,14 +325,13 @@ static NGCardsSaxHandler *sax = nil;
|
|||
|
||||
- (void) setChildrenAsCopy: (NSMutableArray *) someChildren
|
||||
{
|
||||
NSEnumerator *list;
|
||||
CardElement *currentChild;
|
||||
unsigned int count, max;
|
||||
|
||||
ASSIGN (children, someChildren);
|
||||
|
||||
list = [children objectEnumerator];
|
||||
while ((currentChild = [list nextObject]))
|
||||
[currentChild setParent: self];
|
||||
max = [children count];
|
||||
for (count = 0; count < max; count++)
|
||||
[[children objectAtIndex: count] setParent: self];
|
||||
}
|
||||
|
||||
- (void) addChildWithTag: (NSString *) aTag
|
||||
|
@ -398,20 +387,10 @@ static NGCardsSaxHandler *sax = nil;
|
|||
- (id) copyWithZone: (NSZone *) aZone
|
||||
{
|
||||
CardGroup *new;
|
||||
CardElement *newChild;
|
||||
NSMutableArray *newChildren;
|
||||
unsigned int count, max;
|
||||
|
||||
new = [super copyWithZone: aZone];
|
||||
newChildren = [NSMutableArray new];
|
||||
max = [children count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
newChild = [[children objectAtIndex: count] copyWithZone: aZone];
|
||||
[newChildren addObject: newChild];
|
||||
}
|
||||
[new setChildrenAsCopy: newChildren];
|
||||
[newChildren release];
|
||||
[new setChildrenAsCopy: [self deepCopyOfArray: children
|
||||
withZone: aZone]];
|
||||
|
||||
return new;
|
||||
}
|
||||
|
@ -421,21 +400,10 @@ static NGCardsSaxHandler *sax = nil;
|
|||
- (id) mutableCopyWithZone: (NSZone *) aZone
|
||||
{
|
||||
CardGroup *new;
|
||||
CardElement *newChild;
|
||||
NSMutableArray *newChildren;
|
||||
unsigned int count, max;
|
||||
|
||||
new = [super mutableCopyWithZone: aZone];
|
||||
newChildren = [NSMutableArray new];
|
||||
max = [children count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
newChild
|
||||
= [[children objectAtIndex: count] mutableCopyWithZone: aZone];
|
||||
[newChildren addObject: newChild];
|
||||
}
|
||||
[new setChildrenAsCopy: newChildren];
|
||||
[newChildren release];
|
||||
[new setChildrenAsCopy: [self deepCopyOfArray: children
|
||||
withZone: aZone]];
|
||||
|
||||
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>
|
||||
|
||||
* iCalRepeatableEntityObject.m ([iCalRepeatableEntityObject
|
||||
|
|
Loading…
Reference in New Issue