Add method for consistency

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18320 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-01-05 18:28:18 +00:00
parent 748132fd61
commit c513572553
2 changed files with 30 additions and 0 deletions

View file

@ -120,6 +120,7 @@
- (NSArray*) contentsByName: (NSString*)key;
- (NSData*) convertToData;
- (NSString*) convertToText;
- (void) deleteContent: (GSMimeDocument*)aPart;
- (void) deleteHeader: (GSMimeHeader*)aHeader;
- (void) deleteHeaderNamed: (NSString*)name;
- (GSMimeHeader*) headerNamed: (NSString*)name;

View file

@ -3705,6 +3705,35 @@ static NSCharacterSet *tokenSet = nil;
[super dealloc];
}
/**
* Deletes all ocurrances of parts identical to aPart from the receiver.<br />
* Recursively deletes from enclosed documents as necessary.
*/
- (void) deleteContent: (GSMimeDocument*)aPart
{
if (aPart != nil)
{
if ([content isKindOfClass: [NSMutableArray class]] == YES)
{
unsigned count = [content count];
while (count-- > 0)
{
GSMimeDocument *part = [content objectAtIndex: count];
if (part == aPart)
{
[content removeObjectAtIndex: count];
}
else
{
[part deleteContent: part]; // Recursive.
}
}
}
}
}
/**
* This method removes all occurrances of header objects identical to
* the one supplied as an argument.