2000-10-26 22:43:56 +00:00
|
|
|
<html><head>
|
|
|
|
<title>GSMimeParser</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a href ="GSMimeDocument.html">[Previous]</a>
|
|
|
|
<a href ="GSMime.html">[Up]</a>
|
|
|
|
<h1>GSMimeParser</h1>
|
|
|
|
<h3>Authors </h3>
|
|
|
|
<dl>
|
|
|
|
<dt><a href ="http://www.gnustep.org/developers/whoiswho.html">Richard Frith-Macdonald</a>
|
|
|
|
<dd>
|
|
|
|
</dl>
|
2000-11-16 12:10:37 +00:00
|
|
|
<p>Version: 0.2</p>
|
|
|
|
<p>Date: 16 November, 2000</p>
|
2000-10-26 22:43:56 +00:00
|
|
|
<h2><a name ="cont-0">GSMimeParser</a></h2>
|
|
|
|
<h2><a name ="GSMimeParser">GSMimeParser</a></h2>
|
|
|
|
<p><b>Declared in: </b> Foundation/GSMime.h</p>
|
|
|
|
<p><b>Inherits from: </b> NSObject</p>
|
|
|
|
<p><b>Conforms to: </b> NSObject
|
|
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
This class provides support for parsing MIME messages
|
|
|
|
into GSMimeDocument objects. It is imtimately related
|
|
|
|
to the GSMimeDocument class and relys on that class for
|
|
|
|
aspects of the parsing operation.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
<h2>Instance Variables </h2>
|
|
|
|
<ul>
|
|
|
|
</ul>
|
|
|
|
<h2>Methods </h2>
|
|
|
|
<ul>
|
|
|
|
<li><a href ="GSMimeParser.html#method-0">+mimeParser</a>
|
2000-11-16 16:20:24 +00:00
|
|
|
<li><a href ="GSMimeParser.html#method-1">-decodeData:fromRange:intoData:withContext:</a>
|
|
|
|
<li><a href ="GSMimeParser.html#method-2">-document</a>
|
|
|
|
<li><a href ="GSMimeParser.html#method-3">-parse:</a>
|
|
|
|
<li><a href ="GSMimeParser.html#method-4">-parseHeader:</a>
|
|
|
|
<li><a href ="GSMimeParser.html#method-5">-parsingHeaders</a>
|
|
|
|
<li><a href ="GSMimeParser.html#method-6">-scanHeader:named:inTo:</a>
|
|
|
|
<li><a href ="GSMimeParser.html#method-7">-scanSpecial:</a>
|
|
|
|
<li><a href ="GSMimeParser.html#method-8">-scanToken:</a>
|
2000-10-26 22:43:56 +00:00
|
|
|
</ul>
|
|
|
|
<hr><h2>Class Methods </h2>
|
|
|
|
<h3><a name ="method-0">mimeParser</a></h3>
|
|
|
|
+ (GSMimeParser*) <b>mimeParser</b>;<br>
|
|
|
|
|
|
|
|
Create a parser.
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
<hr><h2>Instances Methods </h2>
|
2000-11-16 16:20:24 +00:00
|
|
|
<h3><a name ="method-1">decodeData:fromRange:intoData:withContext:</a></h3>
|
|
|
|
- (BOOL) <b>decodeData:</b> (NSData*)sourceData <b>fromRange:</b> (NSRange)aRange <b>intoData:</b> (NSMutableData*)destinationData <b>withContext:</b> (GSMimeEncodingContext*)ctxt;<br>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
Decodes the raw data from the specified range in the source
|
|
|
|
data object and appends it to the destination data object.
|
|
|
|
The context object provides information about the content
|
|
|
|
encoding type in use, and the state of the decoding operation.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
This method may be called repeatedly to incrementally decode
|
|
|
|
information as it arrives on some communications channel.
|
|
|
|
It should be called with a nil source data item (or with
|
|
|
|
the atEnd flag of the context set to YES) in order to flush
|
|
|
|
any information held in the context to the output data
|
|
|
|
object.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
You may override this method in order to implement
|
|
|
|
additional coding schemes.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
<h3><a name ="method-2">document</a></h3>
|
2000-11-16 12:10:37 +00:00
|
|
|
- (GSMimeDocument*) <b>document</b>;<br>
|
|
|
|
|
|
|
|
Returns the object into which raw mime data is being parsed.
|
|
|
|
|
|
|
|
<hr>
|
2000-11-16 16:20:24 +00:00
|
|
|
<h3><a name ="method-3">parse:</a></h3>
|
2000-10-26 22:43:56 +00:00
|
|
|
- (BOOL) <b>parse:</b> (NSData*)rawData;<br>
|
|
|
|
|
|
|
|
This method is called repeatedly to pass raw mime data into
|
|
|
|
the parser. It should be called with a nil argument at the
|
|
|
|
end of the data - to inform the parser that it has been given
|
|
|
|
all the available information.
|
|
|
|
|
|
|
|
<hr>
|
2000-11-16 16:20:24 +00:00
|
|
|
<h3><a name ="method-4">parseHeader:</a></h3>
|
2000-11-16 12:10:37 +00:00
|
|
|
- (BOOL) <b>parseHeader:</b> (NSString*)aRawHeader;<br>
|
2000-10-26 22:43:56 +00:00
|
|
|
|
2000-11-16 12:10:37 +00:00
|
|
|
<p>
|
|
|
|
|
|
|
|
This method is called to parse a header line <em>for the
|
|
|
|
current document</em>, split its contents into an info
|
|
|
|
dictionary, and add that information to the document.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
The standard implementation of this method scans basic
|
|
|
|
information and then calls <code>scanHeaders:named:into:</code>
|
|
|
|
to complete the parsing of the header.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
This method also performs consistency checks on headers scanned
|
|
|
|
so it is recommended that it is not overridden, but that
|
|
|
|
subclasses override <code>scanHeaders:named:into:</code> to
|
|
|
|
implement custom scanning.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
2000-10-26 22:43:56 +00:00
|
|
|
<hr>
|
2000-11-16 16:20:24 +00:00
|
|
|
<h3><a name ="method-5">parsingHeaders</a></h3>
|
2000-10-26 22:43:56 +00:00
|
|
|
- (BOOL) <b>parsingHeaders</b>;<br>
|
|
|
|
|
|
|
|
Returns YES if the parser is expecting to read mime headers,
|
|
|
|
Returns NO is the parser has already been passed all the
|
|
|
|
data containing headers, and is now waiting for the body of
|
|
|
|
trhe mime message (or has been passed all data).
|
|
|
|
|
2000-11-16 12:10:37 +00:00
|
|
|
<hr>
|
2000-11-16 16:20:24 +00:00
|
|
|
<h3><a name ="method-6">scanHeader:named:inTo:</a></h3>
|
2000-11-16 12:10:37 +00:00
|
|
|
- (BOOL) <b>scanHeader:</b> (NSScanner*)aScanner <b>named:</b> (NSString*)aName <b>inTo:</b> (NSMutableDictionary*)info;<br>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
This method is called to parse a header line and split its
|
|
|
|
contents into an info dictionary.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
On entry, the dictionary is already partially filled,
|
|
|
|
the name argument is a lowercase representation of the
|
|
|
|
header name, and the scanner is set to a scan location
|
|
|
|
immediately after the colon in the header string.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
If the header is parsed successfully, the method should
|
|
|
|
return YES, otherwise NO.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
You should not call this method directly yourself, but may
|
|
|
|
override it to support parsing of new headers.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
<hr>
|
2000-11-16 16:20:24 +00:00
|
|
|
<h3><a name ="method-7">scanSpecial:</a></h3>
|
2000-11-16 12:10:37 +00:00
|
|
|
- (NSString*) <b>scanSpecial:</b> (NSScanner*)aScanner;<br>
|
|
|
|
|
|
|
|
A convenience method to use a scanner (that is set up to scan a
|
|
|
|
header line) to scan in a special character that terminated a
|
|
|
|
token previously scanned. If the token was terminated by
|
|
|
|
whitespace and no other special character, the string returned
|
|
|
|
will contain a single space character.
|
|
|
|
|
|
|
|
<hr>
|
2000-11-16 16:20:24 +00:00
|
|
|
<h3><a name ="method-8">scanToken:</a></h3>
|
2000-11-16 12:10:37 +00:00
|
|
|
- (NSString*) <b>scanToken:</b> (NSScanner*)aScanner;<br>
|
|
|
|
|
|
|
|
A convenience method to use a scanner (that is set up to scan a
|
|
|
|
header line) to scan a header token - either a quoted string or
|
|
|
|
a simple word.
|
|
|
|
<ul>
|
|
|
|
<li>Leading whitespace is ignored.
|
|
|
|
<li>Backslash escapes in quoted text are converted
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
2000-10-26 22:43:56 +00:00
|
|
|
<hr>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|