VMime
messageSet Class Reference

#include <messageSet.hpp>

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 size_t number)
static messageSet byNumber (const size_t first, const size_t last)
static messageSet byNumber (const std::vector< size_t > &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)
// Designate all messages in the folder, starting from number 42
static messageSet byNumber(const size_t number)
Constructs a new message set and initializes it with a single message represented by its sequence num...
Definition messageSet.cpp:180
messageSet(const messageSet &other)
Definition messageSet.cpp:155
Definition connectionInfos.hpp:38
Definition address.cpp:33

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, "*")
static messageSet byUID(const message::uid &uid)
Constructs a new message set and initializes it with a single message represented by its UID.
Definition messageSet.cpp:253

Constructor & Destructor Documentation

◆ ~messageSet()

~messageSet ( )

◆ messageSet()

messageSet ( const messageSet & other)

Member Function Documentation

◆ addRange()

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().

◆ byNumber() [1/3]

messageSet byNumber ( const size_t first,
const size_t 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

References messageSet().

◆ byNumber() [2/3]

messageSet byNumber ( const size_t 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

References messageSet().

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

◆ byNumber() [3/3]

messageSet byNumber ( const std::vector< size_t > & 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

References messageSet().

◆ byUID() [1/3]

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

References messageSet().

◆ byUID() [2/3]

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

References messageSet().

Referenced by IMAPMessage::setFlags().

◆ byUID() [3/3]

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 messageSet(), and stringUtils::toString().

◆ empty()

messageSet empty ( )
static

Constructs an empty set.

Returns
new empty message set

References messageSet().

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

◆ enumerate()

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().

◆ getRangeAt()

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

◆ getRangeCount()

size_t getRangeCount ( ) const

Returns the number of ranges contained in this set.

Returns
range count

◆ isEmpty()

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(), IMAPFolder::getAndFetchMessages(), maildirFolder::getAndFetchMessages(), POP3Folder::getAndFetchMessages(), IMAPFolder::getMessages(), isNumberSet(), and isUIDSet().

◆ isNumberSet()

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 isEmpty().

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

◆ isUIDSet()

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 isEmpty().

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


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