Class ImapParser.

Inherits AbnfParser. Inherited by ImapUrlParser.

IMAP-specific ABNF parsing functions.

This subclass of AbnfParser provides functions like nil(), string(), and literal() for use by IMAP and individual IMAP Commands.

ImapParser::ImapParser( const EString & s )

Creates a new ImapParser for the string s.

In typical use, the parser object is created by IMAP::addCommand() for a complete (possibly multi-line, in the presence of literals) command received from the client.

Reimplements AbnfParser::AbnfParser().

EString ImapParser::astring()

Parses and returns an IMAP astring at the cursor, and advances the cursor past its end. It is an error if no astring is found at the cursor.

EString ImapParser::atom()

Extracts and returns a single atom at the cursor, advancing the cursor past its end. It is an error if no atom is found at the cursor.

EString ImapParser::command()

Extracts and returns an IMAP command name (a single atom, optionally prefixed by "UID "), advancing the cursor past the end of the name. It is an error if no syntactically valid command name is found at the cursor.

EString ImapParser::dotLetters( uint min, uint max )

Returns a string of between min and max letters ([A-Za-z]), digits ([0-9]) and dots at the cursor, advancing the cursor past them. It is an error if fewer than min letters/digits/dots are found at the cursor. Consecutive dots are accepted.

EString ImapParser::firstLine()

Returns the first line of this IMAP command, meant for logging.

This function assumes that the object was constructed for the entire text of an IMAP command, and that multiline commands are constructed with CRLF, as IMAP::parse() does.

EString ImapParser::flag()

Parses a returns flag name, advancing the cursor past its end. It is an error if no valid flag name was present at the cursor.

EString ImapParser::listChars()

Extracts and returns one or more consecutive list-chars (ATOM-CHAR or list-wildcards or resp-specials) at the cursor, and advances the cursor to point past the last one. It is an error if no list-chars are found at the cursor.

EString ImapParser::listMailbox()

Parses and returns an IMAP list-mailbox (which is the same as an atom(), except that the three additional characters %, *, and ] are allowed), advancing the cursor past its end. It is an error if no list-mailbox is found at the cursor.

EString ImapParser::literal()

Parses and returns an IMAP literal at the cursor, and advances the cursor past its contents. It is an error if a valid literal is not found at the cursor.

This function depends on the IMAP parser to insert the CRLF before the literal's contents, and to ensure that the literal's contents are the right size.

void ImapParser::nil()

Requires that the atom "NIL" be present, and advances the cursor past its end. It is an error if NIL is not present at the cursor.

EString ImapParser::nstring()

Parses and returns an IMAP nstring at the cursor, and advances the cursor past its end. It is an error if no nstring is found at the cursor.

uint ImapParser::nzNumber()

Extracts and returns a non-zero number at the cursor, advancing the cursor past its end. It is an error if there is no non-zero number() at the cursor.

EString ImapParser::quoted()

Parses and returns an IMAP quoted-string at the cursor, and advances the cursor past the ending '"' character. It is an error if a valid quoted-string does not occur at the cursor.

EString ImapParser::string()

Parses and returns an IMAP string at the cursor, and advances the cursor past its end. It is an error if no string is found at the cursor.

EString ImapParser::tag()

Extracts and returns an IMAP command tag (a non-empty sequence of any ASTRING-CHAR except '+'), advancing the cursor past the end of the tag. It is an error if no valid tag is found at the cursor.

This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.