Monotone-Parent: 28ce727aaf05b14f23fbcec914f8b827755f3483

Monotone-Revision: ec02ae62fee05e50774a4da52cc17e4811526340

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-12-30T19:45:58
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2011-12-30 19:45:58 +00:00
parent 540237248c
commit 843be30a45
3 changed files with 40 additions and 1 deletions

View File

@ -46,12 +46,15 @@
- (CardElement *) uniqueChildWithTag: (NSString *) aTag;
- (void) setUniqueChild: (CardElement *) aChild;
- (NSMutableArray *) children;
- (void) addChild: (CardElement *) aChild;
- (void) addChildren: (NSArray *) someChildren;
- (void) removeChild: (CardElement *) aChild;
- (void) removeChildren: (NSArray *) someChildren;
- (NSMutableArray *) children;
- (void) cleanupEmptyChildren;
- (CardElement *) firstChildWithTag: (NSString *) aTag;
- (NSArray *) childrenWithTag: (NSString *) aTag;
- (NSArray *) childrenWithAttribute: (NSString *) anAttribute

View File

@ -142,6 +142,19 @@ static NGCardsSaxHandler *sax = nil;
return nil;
}
- (BOOL) isVoid
{
BOOL isVoid = YES;
NSUInteger count, max;
max = [children count];
for (count = 0; isVoid && count < max; count++)
if (![[children objectAtIndex: count] isVoid])
isVoid = NO;
return isVoid;
}
- (void) addChild: (CardElement *) aChild
{
Class mappedClass;
@ -366,6 +379,23 @@ static NGCardsSaxHandler *sax = nil;
[self addChild: newChild];
}
- (void) cleanupEmptyChildren
{
NSUInteger max;
NSInteger count;
CardElement *child;
max = [children count];
for (count = max - 1; count > -1; count--)
{
child = [children objectAtIndex: count];
if ([child isKindOfClass: [CardGroup class]])
[(CardGroup *) child cleanupEmptyChildren];
if ([child isVoid])
[children removeObjectAtIndex: count];
}
}
- (NSString *) description
{
NSMutableString *str;

View File

@ -1,3 +1,9 @@
2011-12-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* CardGroup.m (-isVoid): overriden method.
(-cleanupEmptyChildren): make use of "isVoid" to detect and remove
empty children.
2011-11-21 Francis Lachapelle <flachapelle@inverse.ca>
* iCalTimeZone.m (+knownTimeZoneNames): ignore files that don't