[Csmail-patches] CVS: csmail/src/CSMail.Utils ChangeLog,1.19,1.20 HeaderToken.cs,1.1,1.2 HeaderToken
Status: Pre-Alpha
Brought to you by:
mastergaurav
From: Gaurav V. <mas...@us...> - 2002-10-08 12:26:45
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv16737 Modified Files: ChangeLog HeaderToken.cs HeaderTokenType.cs HeaderTokenizer.cs Log Message: 2002-10-08 * HeaderToken.cs, * HeaderTokenizer.cs, * HeaderTokenType.cs : Documentation. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- ChangeLog 8 Oct 2002 04:48:42 -0000 1.19 +++ ChangeLog 8 Oct 2002 12:26:42 -0000 1.20 @@ -1,6 +1,12 @@ 2002-10-08 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * HeaderToken.cs, + * HeaderTokenizer.cs, + * HeaderTokenType.cs : Documentation. + +2002-10-08 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * HeaderTokenizer.cs : line 184. Fixed typo bug. 2002-10-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> Index: HeaderToken.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderToken.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HeaderToken.cs 4 Oct 2002 11:13:20 -0000 1.1 +++ HeaderToken.cs 8 Oct 2002 12:26:42 -0000 1.2 @@ -13,11 +13,23 @@ namespace CSMail.Utils { + /// <summary> + /// The class represents the tokens returned + /// by <see cref="T:CSMail.Utils.HeaderTokenizer"/> + /// </summary> + /// <seealso cref="T:CSMail.Utils.HeaderToken"/> + /// <seealso cref="T:CSMail.Utils.HeaderTokenType"/> public class HeaderToken { private HeaderTokenType type; private string value; + /// <summary> + /// Creates an instance of <see href="HeaderToken"/>. + /// </summary> + /// <param name="type">The type of the token.</param> + /// <param name="value">The content of the token.</param> + /// <seealso cref="T:CSMail.Utils.HeaderTokenType"/> public HeaderToken(HeaderTokenType type, string value) { if(!Enum.IsDefined(typeof(HeaderTokenType), type)) @@ -26,6 +38,13 @@ this.value = value; } + /// <summary> + /// Returns the token type related to this token. + /// </summary> + /// <value> + /// The value is one of + /// <see cref="T:CSMail.Utils.HeaderTokenType"/>. + /// </value> public HeaderTokenType TokenType { get @@ -34,6 +53,13 @@ } } + /// <summary> + /// Returns the data associated with the token. + /// </summary> + /// <value> + /// Contains the value as parsed by + /// <see cref="T:CSMail.Utils.HeaderTokenizer"/>. + /// </value> public string Value { get Index: HeaderTokenType.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderTokenType.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HeaderTokenType.cs 8 Oct 2002 04:39:33 -0000 1.3 +++ HeaderTokenType.cs 8 Oct 2002 12:26:42 -0000 1.4 @@ -10,13 +10,41 @@ namespace CSMail.Utils { + /// <summary> + /// Enumeration of the various types of tokens available + /// for a <see cref="T:CSMail.Utils.HeaderToken"/> as returned + /// by parsing header by <see cref="T:CSMail.Utils.HeaderTokenizer"/>. + /// </summary> public enum HeaderTokenType { + /// <summary> + /// The token is an atom. + /// </summary> Atom, + /// <summary> + /// The token is a comment. + /// </summary> Comment, + /// <summary> + /// The token is a delimiter. + /// </summary> Delimiter, + /// <summary> + /// The token is end of file. + /// </summary> EOF, + /// <summary> + /// The token is a quoted-string. + /// </summary> QuotedString, + /// <summary> + /// The token type is undefined. + /// </summary> + /// <remarks> + /// <para> + /// This may happen when an illegal token was encountered. + /// </para> + /// </remarks> Undefined } } Index: HeaderTokenizer.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderTokenizer.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- HeaderTokenizer.cs 8 Oct 2002 04:45:29 -0000 1.4 +++ HeaderTokenizer.cs 8 Oct 2002 12:26:42 -0000 1.5 @@ -14,6 +14,19 @@ namespace CSMail.Utils { + /// <summary> + /// It tokenizes the RFC822 and MIME headers into basic + /// symbols specified by RFC822 and MIME. + /// </summary> + /// <remarks> + /// <para> + /// This class handles folded headers, the headers with + /// embedded CRLF SPACE sequences. The folds are removed + /// in the returned tokens. + /// </para> + /// </remarks> + /// <seealso cref="T:CSMail.Utils.HeaderToken"/> + /// <seealso cref="T:CSMail.Utils.HeaderTokenType"/> public class HeaderTokenizer { private string content; @@ -29,6 +42,19 @@ HeaderTokenType.EOF, null); + /// <summary> + /// Creates an instance of the object with the given content, + /// delimiters and option to skip comments. + /// </summary> + /// <param name="content">The content or the value of a + /// header.</param> + /// <param name="delimiters">The characters that may serve + /// as delimiters during parsing. If the value is <c>null</c>, it + /// assumes <see cref="P:CSMail.Utils.Constants.RFC822Delimiters"/>. + /// </param> + /// <param name="skipComments">Whether or not to skip comments, + /// embedded inside braces "()". + /// </param> public HeaderTokenizer(string content, string delimiters, bool skipComments) { @@ -43,11 +69,15 @@ this.maximumPosition = content.Length; } + /// <summary> + /// </summary> public HeaderTokenizer(string content, string delimiters) : this(content, delimiters, true) { } + /// <summary> + /// </summary> public HeaderTokenizer(string content) : this(content, null) { } @@ -175,7 +205,7 @@ throw new ParseException("[HeaderTokenizer] Unbalanced quoted string"); } - if(c < ' ' || c >= (char)0xB1 || delimiters.IndexOf(c) >= 0) + if(c < ' ' || c >= (char)0x7F || delimiters.IndexOf(c) >= 0) { currentPosition ++; char[] rv = new char[1]; @@ -190,7 +220,7 @@ while(currentPosition < maximumPosition) { c = content[currentPosition]; - if(c <= ' ' || c >= (char)0xB1 || c == '(' || c == '"' || delimiters.IndexOf(c) >= 0) + if(c <= ' ' || c >= (char)0x7F || c == '(' || c == '"' || delimiters.IndexOf(c) >= 0) break; currentPosition++; } |