MailboxList Class Reference

Class that represents a list of RFC 2822 mailboxes More...

Inheritance diagram for MailboxList:

FieldBody Node

List of all members.

Public Member Functions

 MailboxList ()
 Default constructor.
 MailboxList (const MailboxList &other)
 Copy constructor.
 MailboxList (const String &str, Node *parent=0)
 Constructor that takes an initial string and parent node.
virtual ~MailboxList ()
 Destructor.
const MailboxListoperator= (const MailboxList &other)
 Assignment operator.
virtual void parse ()
 Parses the string representation.
virtual void assemble ()
 Assembles the string representation.
virtual Nodeclone () const
 Creates a copy of this object.
int numMailboxes () const
 Gets the number of mailboxes in the list.
void addMailbox (Mailbox *mailbox)
 Adds a mailbox to the end of the list.
void deleteAllMailboxes ()
 Deletes all mailboxes in the list.
MailboxmailboxAt (int index) const
 Gets the mailbox at the specified position in the list.
void insertMailboxAt (int index, Mailbox *mailbox)
 Inserts a mailbox at the specified position in the list.
MailboxremoveMailboxAt (int index)
 Removes the mailbox at the specified position in the list.

Static Public Member Functions

static MailboxListnewMailboxList ()
 Creates a new instance.

Static Public Attributes

static MailboxList *(* sNewMailboxList )()
 Provides a class factory hook.

Protected Member Functions

void _copyMailboxes (const MailboxList &list)
 Copies all mailboxes from another list.
void _addMailbox (Mailbox *mailbox)
 Adds a mailbox to the end of the list.
void _insertMailboxAt (int index, Mailbox *mailbox)
 Inserts a mailbox at the specified position in the list.
Mailbox_removeMailboxAt (int index)
 Removes the mailbox at the specified position in the list.
void _deleteAllMailboxes ()
 Deletes all mailboxes in the list.


Detailed Description

MailboxList represents a list of mailboxes as described in RFC 2822. In Hunny MIME++, MailboxList is a container for objects of type Mailbox, and it contains various member functions to manage its contained objects. MailboxList is also a FieldBody. This reflects the fact that certain RFC 2822 header fields, such as the "From" header field, have a list of mailboxes as their field bodies.

Constructor & Destructor Documentation

MailboxList (  ) 

This constructor sets the MailboxList object's string representation to the empty string and sets its parent node to NULL.

MailboxList ( const MailboxList other  ) 

This constructor performs a deep copy of its argument. The parent node of the new MailboxList object is set to NULL.

Parameters:
other MailboxList instance to copy

MailboxList ( const String str,
Node parent = 0 
)

This constructor sets the MailboxList object's string representation to str and sets its parent node to parent.

Normally, you call the virtual function parse() immediately after this constructor to create the broken-down representation.

Parameters:
str initial value for the string representation
parent parent node for this object

~MailboxList (  )  [virtual]

Destructor


Member Function Documentation

void _addMailbox ( Mailbox mailbox  )  [protected]

Same as addMailbox(), but does not set the is-modified flag.

Parameters:
mailbox Mailbox object to add
See also:
addMailbox()

void _copyMailboxes ( const MailboxList list  )  [protected]

Copies the list of Mailbox objects from list. Assumes the list in this MailboxList object is emtpy. Does not set the is-modified flag.

Parameters:
list MailboxList object to copy Mailbox objects from

void _deleteAllMailboxes (  )  [protected]

Same as deleteAllMailboxes(), but does not set the is-modified flag.

See also:
deleteAllMailboxes()

void _insertMailboxAt ( int  index,
Mailbox mailbox 
) [protected]

Same as insertMailboxAt(), but does not set the is-modified flag.

Parameters:
index position in the list to insert the Mailbox object
mailbox Mailbox object to insert
See also:
insertMailboxAt()

Mailbox * _removeMailboxAt ( int  index  )  [protected]

Same as removeMailboxAt(), but does not set the is-modified flag.

Parameters:
index position of the Mailbox object to remove
Returns:
pointer to the removed Mailbox object
See also:
removeMailboxAt()

void addMailbox ( Mailbox mailbox  ) 

Adds mailbox to the end of the list.

The MailboxList destructor deletes the Mailbox objects in the list.

Parameters:
mailbox Mailbox object to add

void assemble (  )  [virtual]

This virtual function, inherited from Node, executes the assemble operation for MailboxList objects. The assemble operation creates or updates the string representation from the broken-down representation. For MailboxList objects, the assemble operation builds the string representation from the list of contained Mailbox objects. Before it builds the string representation for the MailboxList object, the function first calls the assemble() member function of each Mailbox object in its list.

You should call this member function after you set or modify any of the contained Mailbox objects, and before you retrieve the string representation.

This function clears the is-modified flag.

Reimplemented from FieldBody.

Node * clone (  )  const [virtual]

This virtual function, inherited from Node, creates a new MailboxList object that has the same value as this MailboxList object. The parent node of the new MailboxList object is set to NULL.

Returns:
a copy of this object

Reimplemented from FieldBody.

void deleteAllMailboxes (  ) 

Removes and deletes all Mailbox objects in the list.

void insertMailboxAt ( int  index,
Mailbox mailbox 
)

Inserts mailbox into the list at position index.

If index is zero, then the function inserts mailbox into the first position in the list. If index equals numMailboxes(), then the function inserts mailbox into the last position in the list. If index is less than numMailboxes(), then the function moves the Mailbox objects at position index or greater to a higher position in the list.

The MailboxList destructor deletes the Mailbox objects in the list.

The function's behavior is undefined if index is out of range. Valid values for index are 0 <= index <= numMailboxes().

Parameters:
index position in the list to insert the Mailbox object
mailbox Mailbox object to insert

Mailbox & mailboxAt ( int  index  )  const

Gets the Mailbox object at position index in the list.

The function's behavior is undefined if index is out of range. Valid values for index are 0 <= index < numMailboxes().

Parameters:
index position of the Mailbox object to get
Returns:
reference to the Mailbox object at the specified position

MailboxList * newMailboxList (  )  [static]

Creates a new MailboxList object.

If the static data member sNewMailboxList is NULL, this member function creates a new MailboxList object and returns it. Otherwise, newMailboxList() calls the user-supplied function that sNewMailboxList points to and returns the object created by that function.

Returns:
new MailboxList instance
See also:
sNewMailboxList

int numMailboxes (  )  const

Gets the number of Mailbox objects in the list.

Returns:
number of Mailbox objects in the list

const MailboxList & operator= ( const MailboxList other  ) 

Performs a deep copy of its argument. The parent node of this MailboxList object is not changed.

Parameters:
other MailboxList instance to copy

void parse (  )  [virtual]

This virtual function, inherited from Node, executes the parse operation for MailboxList objects. The parse operation creates or updates the broken-down representation from the string representation. For MailboxList objects, the parse operation parses the string representation to create a list of Mailbox objects. This member function also calls the parse() member function of each Mailbox object in its list.

You should call this member function after you set or modify the string representation, and before you access any of the contained Mailbox objects.

This function clears the is-modified flag.

Reimplemented from FieldBody.

Mailbox * removeMailboxAt ( int  index  ) 

Removes the Mailbox object at position index from the list and returns it.

If index is less than numMailboxes()-1, then the function moves the Mailbox objects at position (index + 1) or greater to a lower position in the list.

The function's behavior is undefined if index is out of range. Valid values for index are 0 <= index < numMailboxes().

Parameters:
index position of the Mailbox object to remove
Returns:
pointer to the removed Mailbox object


Member Data Documentation

MailboxList *(* sNewMailboxList)()=0 (  )  [static]

If sNewMailboxList is not NULL, it must point to a user-supplied function that returns a new instance of a subclass of MailboxList.

See also:
newMailboxList()

Copyright © 2001-2009 Hunny Software, Inc. All rights reserved.