VMime
messageSet Class Reference
Inheritance diagram for messageSet:
Collaboration diagram for messageSet:

Public Member Functions

 ~messageSet ()
 
 messageSet (const messageSet &other)
 
void addRange (const messageRange &range)
 
void enumerate (messageSetEnumerator &en) const
 
bool isEmpty () const
 
bool isNumberSet () const
 
bool isUIDSet () const
 
size_t getRangeCount () const
 
const messageRangegetRangeAt (const size_t i) const
 

Static Public Member Functions

static messageSet empty ()
 
static messageSet byNumber (const int number)
 
static messageSet byNumber (const int first, const int last)
 
static messageSet byNumber (const std::vector< int > &numbers)
 
static messageSet byUID (const message::uid &uid)
 
static messageSet byUID (const message::uid &first, const message::uid &last)
 
static messageSet byUID (const std::vector< message::uid > &uids)
 

Additional Inherited Members

- Protected Member Functions inherited from object
 object ()
 
 object (const object &)
 
objectoperator= (const object &)
 
virtual ~object ()
 

Detailed Description

Represents a set of messages, designated either by their sequence number, or by their UID (but not both).

Following is example code to designate messages by their number:

// Designate a single message with sequence number 42
// Designate messages from sequence number 5 to sequence number 8 (including)
vmime::net::messageSet::byNumber(5, 8)
// Designate all messages in the folder, starting from number 42
vmime::net::messageSet::byNumber(42, -1)

Or, to designate messages by their UID, use:

// Designate a single message with UID 1042
// Designate messages from UID 1000 to UID 1042 (including)
vmime::net::messageSet::byUID(1000, 1042)
// Designate all messages in the folder, starting from UID 1000
vmime::net::messageSet::byUID(1000, "*")

Constructor & Destructor Documentation

~messageSet ( )
messageSet ( const messageSet other)

Member Function Documentation

void addRange ( const messageRange range)

Adds the specified range to this set.

The type of message range (either number or UID) must match the type of the ranges already contained in this set (ie. it's not possible to have a message set which contains both number ranges and UID ranges).

Parameters
rangerange to add
Exceptions
std::invalid_argumentexception if the range type does not match the type of the ranges in this set

References messageRange::clone().

messageSet byNumber ( const int  number)
static

Constructs a new message set and initializes it with a single message represented by its sequence number.

Parameters
numbermessage number (numbering starts at 1, not 0)
Returns
new message set

Referenced by IMAPFolder::fetchMessages(), maildirMessage::setFlags(), and IMAPMessage::setFlags().

messageSet byNumber ( const int  first,
const int  last 
)
static

Constructs a new message set and initializes it with a range of messages represented by their sequence number.

Parameters
firstnumber of the first message in the range (numbering starts at 1, not 0)
lastnumber of the last message in the range, or use the special value -1 to designate the last message in the folder
Returns
new message set
messageSet byNumber ( const std::vector< int > &  numbers)
static

Constructs a new message set and initializes it with a possibly unsorted list of messages represented by their sequence number.

Please note that numbering starts at 1, not 0.

The function tries to group consecutive message numbers into ranges to reduce the size of the resulting set.

For example, given the list "1,2,3,4,5,7,8,13,15,16,17" it will result in the following ranges: "1:5,7:8,13,15:17".

Parameters
numbersa vector containing numbers of the messages
Returns
new message set
messageSet byUID ( const message::uid uid)
static

Constructs a new message set and initializes it with a single message represented by its UID.

Parameters
uidmessage UID
Returns
new message set

Referenced by IMAPMessage::setFlags().

messageSet byUID ( const message::uid first,
const message::uid last 
)
static

Constructs a new message set and initializes it with a range of messages represented by their sequence number.

Parameters
firstUID of the first message in the range
lastUID of the last message in the range, or use the special value '*' to designate the last message in the folder
Returns
new message set
messageSet byUID ( const std::vector< message::uid > &  uids)
static

Constructs a new message set and initializes it with a possibly unsorted list of messages represented by their UID.

For UIDs that actually are numbers (this is the case for IMAP), the function tries to group consecutive UIDs into ranges to reduce the size of the resulting set.

For example, given the list "1,2,3,4,5,7,8,13,15,16,17" it will result in the following ranges: "1:5,7:8,13,15:17".

Parameters
uidsa vector containing UIDs of the messages
Returns
new message set

References stringUtils::toString().

messageSet empty ( )
static

Constructs an empty set.

Returns
new empty message set

Referenced by maildirFolder::addMessage(), IMAPFolder::addMessage(), maildirFolder::copyMessages(), and IMAPFolder::copyMessages().

void enumerate ( messageSetEnumerator en) const

Enumerates this set with the specified enumerator.

Parameters
enenumerator that will receive the method calls while enumerating the ranges in this set

Referenced by POP3Utils::messageSetToNumberList().

const messageRange & getRangeAt ( const size_t  i) const

Returns the message range at the specified index.

Parameters
irange index (from 0 to getRangeCount())
Returns
a reference to the message range at the specified index
size_t getRangeCount ( ) const

Returns the number of ranges contained in this set.

Returns
range count
bool isEmpty ( ) const

Returns whether this set is empty (contains no range).

Returns
true if this set is empty, or false otherwise

Referenced by IMAPFolder::deleteMessages(), POP3Folder::getAndFetchMessages(), maildirFolder::getAndFetchMessages(), IMAPFolder::getAndFetchMessages(), IMAPFolder::getMessages(), messageSet::isNumberSet(), and messageSet::isUIDSet().

bool isNumberSet ( ) const

Returns whether this set references messages by their sequence number.

Returns
true if this set references messages by their sequence number, or false otherwise

References messageSet::isEmpty().

Referenced by POP3Folder::getMessages(), maildirFolder::getMessages(), IMAPFolder::getMessages(), and maildirFolder::setMessageFlags().

bool isUIDSet ( ) const

Returns whether this set references messages by their UID.

Returns
true if this set references messages by their UID, or false otherwise

References messageSet::isEmpty().

Referenced by IMAPCommand::COPY(), IMAPCommand::FETCH(), IMAPFolder::getMessages(), and IMAPCommand::STORE().


The documentation for this class was generated from the following files: