TImMessageField Class Reference

class TImMessageField

Parses email message header fields for valid Internet email addresses, comments and aliases.

A comment is a string surrounded by parentheses, as defined in RFC822, 3.1.4.

An alias is defined as any substring which appears to the left of a legal email address: for example, the string "this is an alias" in "this is an alias <an.email@address.com>".

For email addresses, the string being parsed: 1) must contain an @ character, surrounded by valid address characters; 2) may not contain more than one address or @ character; 3) may contain aliases and comments.

Note the following about the implementation of this class:

1. Functions that test subject lines, ValidSubjectLine() , and alias names, ValidAliasName() , were initially written to test that the strings did not contain characters outside a limited ASCII range. Unicode characters are now allowed, so these functions now always return true.

2. Of the four overloads of GetValidInternetEmailAddressFromString() , only the first has a meaningful implementation.

Public Member Functions
IMPORT_C TPtrC16 GetValidAlias (const TDesC16 &)
IMPORT_C TPtrC16 GetValidAlias (const TDesC16 &, TInt &)
IMPORT_C TPtrC16 GetValidComment (const TDesC16 &)
IMPORT_C TPtrC16 GetValidComment (const TDesC16 &, TInt &)
IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString (const TDesC16 &)
IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString (const TDesC16 &, TInt &)
IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString (const TDesC16 &, TInt &, TInt &)
IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString (const TDesC16 &, TInt &, TInt &, TInt &)
TBool TruncateAddressString (const TDesC16 &, TInt , TInt &)
IMPORT_C TBool ValidAliasName (const TDesC16 &)
IMPORT_C TBool ValidAliasName (const TDesC16 &, TInt &)
IMPORT_C TBool ValidInternetEmailAddress (const TDesC16 &)
IMPORT_C TBool ValidInternetEmailAddress (const TDesC16 &, TInt &)
IMPORT_C TBool ValidInternetEmailAddress (const TDesC16 &, TInt &, TInt &)
IMPORT_C TBool ValidInternetEmailAddress (const TDesC16 &, TInt &, TInt &, TInt &)
IMPORT_C TBool ValidInternetEmailAddressChar (const TChar &)
IMPORT_C TBool ValidSubjectLine (const TDesC16 &)
IMPORT_C TBool ValidSubjectLine (const TDesC16 &, TInt &)
IMPORT_C TBool ValidSubjectLineChar (const TChar &)
Private Member Functions
TBool LocateSubString (const TDesC16 &, const TInt , TInt &, TInt &)
TBool hasAngledBrackets (const TDesC16 &)
TBool isDotChar (const TChar &)
TBool isEnclosedSubString (const TDesC16 &, const TChar &, const TChar &, TInt &, TInt &)
TBool isLegalEmailAddress (const TDesC16 &, TInt &, TInt &)
TBool isSurroundedByAngledBrackets (const TDesC16 &, TInt &, TInt &, TInt )
TBool isSurroundedByRoundBrackets (const TDesC16 &, TInt &, TInt &)
TBool isValidChar (const TChar &)
TBool isValidDomainNameChar (const TChar &)
TBool isValidEmailAddress (const TDesC16 &, TInt &, TInt &)
TBool isValidEmailChar (const TChar &)
TBool isValidEmailString (const TDesC16 &, TInt &)
TBool isValidMailboxChar (const TChar &)
TBool isValidRoutedEmailAddress (const TDesC16 &)
TBool isValidString (const TDesC16 &, TInt &)
TBool isValid_ISO88591String (const TDesC16 &, TInt &)

Member Functions Documentation

GetValidAlias(const TDesC16 &)

IMPORT_C TPtrC16 GetValidAlias ( const TDesC16 & aAddress )

Parameters

const TDesC16 & aAddress

GetValidAlias(const TDesC16 &, TInt &)

IMPORT_C TPtrC16 GetValidAlias ( const TDesC16 & aAddress,
TInt & rError
)

Parameters

const TDesC16 & aAddress
TInt & rError

GetValidComment(const TDesC16 &)

IMPORT_C TPtrC16 GetValidComment ( const TDesC16 & aAddress )

Parameters

const TDesC16 & aAddress

GetValidComment(const TDesC16 &, TInt &)

IMPORT_C TPtrC16 GetValidComment ( const TDesC16 & aAddress,
TInt & rError
)

Parameters

const TDesC16 & aAddress
TInt & rError

GetValidInternetEmailAddressFromString(const TDesC16 &)

IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString ( const TDesC16 & aAddress )

Parameters

const TDesC16 & aAddress

GetValidInternetEmailAddressFromString(const TDesC16 &, TInt &)

IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString ( const TDesC16 & aAddress,
TInt & rError
)

Parameters

const TDesC16 & aAddress
TInt & rError

GetValidInternetEmailAddressFromString(const TDesC16 &, TInt &, TInt &)

IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString ( const TDesC16 & aAddress,
TInt & rFirstChar,
TInt & rLastChar
)

Parameters

const TDesC16 & aAddress
TInt & rFirstChar
TInt & rLastChar

GetValidInternetEmailAddressFromString(const TDesC16 &, TInt &, TInt &, TInt &)

IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString ( const TDesC16 & aAddress,
TInt & rFirstChar,
TInt & rLastChar,
TInt & rError
)

Parameters

const TDesC16 & aAddress
TInt & rFirstChar
TInt & rLastChar
TInt & rError

LocateSubString(const TDesC16 &, const TInt, TInt &, TInt &)

TBool LocateSubString ( const TDesC16 & anAddress,
const TInt atPos,
TInt & rFirstChar,
TInt & rLastChar
) [private]

Parameters

const TDesC16 & anAddress
const TInt atPos
TInt & rFirstChar
TInt & rLastChar

TruncateAddressString(const TDesC16 &, TInt, TInt &)

TBool TruncateAddressString ( const TDesC16 & aDesc,
TInt aLimit,
TInt & aLastChar
)

Parameters

const TDesC16 & aDesc
TInt aLimit
TInt & aLastChar

ValidAliasName(const TDesC16 &)

IMPORT_C TBool ValidAliasName ( const TDesC16 & aAliasName )

Parameters

const TDesC16 & aAliasName

ValidAliasName(const TDesC16 &, TInt &)

IMPORT_C TBool ValidAliasName ( const TDesC16 & aAliasName,
TInt & rFirstBadCharPos
)

Parameters

const TDesC16 & aAliasName
TInt & rFirstBadCharPos

ValidInternetEmailAddress(const TDesC16 &)

IMPORT_C TBool ValidInternetEmailAddress ( const TDesC16 & aAddress )

Parameters

const TDesC16 & aAddress

ValidInternetEmailAddress(const TDesC16 &, TInt &)

IMPORT_C TBool ValidInternetEmailAddress ( const TDesC16 & aAddress,
TInt & rFirstBadCharPos
)

Parameters

const TDesC16 & aAddress
TInt & rFirstBadCharPos

ValidInternetEmailAddress(const TDesC16 &, TInt &, TInt &)

IMPORT_C TBool ValidInternetEmailAddress ( const TDesC16 & aAddress,
TInt & rFirstChar,
TInt & rLastChar
)

Parameters

const TDesC16 & aAddress
TInt & rFirstChar
TInt & rLastChar

ValidInternetEmailAddress(const TDesC16 &, TInt &, TInt &, TInt &)

IMPORT_C TBool ValidInternetEmailAddress ( const TDesC16 & aAddress,
TInt & rFirstChar,
TInt & rLastChar,
TInt & rFirstBadCharPos
)

Parameters

const TDesC16 & aAddress
TInt & rFirstChar
TInt & rLastChar
TInt & rFirstBadCharPos

ValidInternetEmailAddressChar(const TChar &)

IMPORT_C TBool ValidInternetEmailAddressChar ( const TChar & aChar )

Parameters

const TChar & aChar

ValidSubjectLine(const TDesC16 &)

IMPORT_C TBool ValidSubjectLine ( const TDesC16 & aSubjectLine )

Parameters

const TDesC16 & aSubjectLine

ValidSubjectLine(const TDesC16 &, TInt &)

IMPORT_C TBool ValidSubjectLine ( const TDesC16 & aSubjectLine,
TInt & rFirstBadCharPos
)

Parameters

const TDesC16 & aSubjectLine
TInt & rFirstBadCharPos

ValidSubjectLineChar(const TChar &)

IMPORT_C TBool ValidSubjectLineChar ( const TChar & aChar )

Parameters

const TChar & aChar

hasAngledBrackets(const TDesC16 &)

TBool hasAngledBrackets ( const TDesC16 & anAddress ) [private]

Parameters

const TDesC16 & anAddress

isDotChar(const TChar &)

TBool isDotChar ( const TChar & aChar ) [private]

Parameters

const TChar & aChar

isEnclosedSubString(const TDesC16 &, const TChar &, const TChar &, TInt &, TInt &)

TBool isEnclosedSubString ( const TDesC16 & anAddress,
const TChar & aLeftBracket,
const TChar & aRightBracket,
TInt & aLeftPos,
TInt & aRightPos
) [private]

Parameters

const TDesC16 & anAddress
const TChar & aLeftBracket
const TChar & aRightBracket
TInt & aLeftPos
TInt & aRightPos

isLegalEmailAddress(const TDesC16 &, TInt &, TInt &)

TBool isLegalEmailAddress ( const TDesC16 & aAddress,
TInt & rFirstChar,
TInt & rLastChar
) [private]

Parameters

const TDesC16 & aAddress
TInt & rFirstChar
TInt & rLastChar

isSurroundedByAngledBrackets(const TDesC16 &, TInt &, TInt &, TInt)

TBool isSurroundedByAngledBrackets ( const TDesC16 & aAddress,
TInt & rFirstChar,
TInt & rLastChar,
TInt aAtPos
) [private]

Parameters

const TDesC16 & aAddress
TInt & rFirstChar
TInt & rLastChar
TInt aAtPos

isSurroundedByRoundBrackets(const TDesC16 &, TInt &, TInt &)

TBool isSurroundedByRoundBrackets ( const TDesC16 & aAddress,
TInt & rFirstChar,
TInt & rLastChar
) [private]

Parameters

const TDesC16 & aAddress
TInt & rFirstChar
TInt & rLastChar

isValidChar(const TChar &)

TBool isValidChar ( const TChar & aChar ) [private]

Parameters

const TChar & aChar

isValidDomainNameChar(const TChar &)

TBool isValidDomainNameChar ( const TChar & aChar ) [private]

Parameters

const TChar & aChar

isValidEmailAddress(const TDesC16 &, TInt &, TInt &)

TBool isValidEmailAddress ( const TDesC16 & aAddress,
TInt & rFirstChar,
TInt & rLastChar
) [private]

Parameters

const TDesC16 & aAddress
TInt & rFirstChar
TInt & rLastChar

isValidEmailChar(const TChar &)

TBool isValidEmailChar ( const TChar & aChar ) [private]

Parameters

const TChar & aChar

isValidEmailString(const TDesC16 &, TInt &)

TBool isValidEmailString ( const TDesC16 & anAddress,
TInt & aFirstBadCharPos
) [private]

Parameters

const TDesC16 & anAddress
TInt & aFirstBadCharPos

isValidMailboxChar(const TChar &)

TBool isValidMailboxChar ( const TChar & aChar ) [private]

Parameters

const TChar & aChar

isValidRoutedEmailAddress(const TDesC16 &)

TBool isValidRoutedEmailAddress ( const TDesC16 & anAddress ) [private]

Parameters

const TDesC16 & anAddress

isValidString(const TDesC16 &, TInt &)

TBool isValidString ( const TDesC16 & anAddress,
TInt & aFirstBadCharPos
) [private]

Parameters

const TDesC16 & anAddress
TInt & aFirstBadCharPos

isValid_ISO88591String(const TDesC16 &, TInt &)

TBool isValid_ISO88591String ( const TDesC16 & aString,
TInt & aPos
) [private]

Parameters

const TDesC16 & aString
TInt & aPos