mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
Added setContentType:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17790 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a50ec2ab0f
commit
9e3af86051
2 changed files with 30 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2003-10-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/Additions/GSMime.m: ([GSMimeDocument-setContentType:])
|
||||||
|
New convenience method.
|
||||||
|
|
||||||
2003-10-05 Adam Fedor <fedor@gnu.org>
|
2003-10-05 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Documentation/GNUmakefile: Make manual
|
* Documentation/GNUmakefile: Make manual
|
||||||
|
|
|
@ -4412,6 +4412,31 @@ static NSCharacterSet *tokenSet = nil;
|
||||||
RELEASE(arp);
|
RELEASE(arp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Convenience method to set the content type of the document without
|
||||||
|
* altering any content.
|
||||||
|
* The supplied newType may be full type information including subtype
|
||||||
|
* and parameters as found after the colon in a mime Content-Type header.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
- (void) setContentType: (id)newType
|
||||||
|
{
|
||||||
|
CREATE_AUTORELEASE_POOL(arp);
|
||||||
|
GSMimeHeader *hdr = nil;
|
||||||
|
GSMimeParser *p = AUTORELEASE([GSMimeParser new]);
|
||||||
|
NSScanner *scanner = [NSScanner scannerWithString: newType];
|
||||||
|
|
||||||
|
hdr = AUTORELEASE([GSMimeHeader new]);
|
||||||
|
[hdr setName: @"content-type"];
|
||||||
|
if ([p scanHeaderBody: scanner into: hdr] == NO)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
format: @"Unable to parse type information"];
|
||||||
|
}
|
||||||
|
[self setHeader: hdr];
|
||||||
|
RELEASE(arp);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method may be called to set a header in the document.
|
* This method may be called to set a header in the document.
|
||||||
* Any other headers with the same name will be removed from
|
* Any other headers with the same name will be removed from
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue