KMime::Headers::Generics::AddressList

Search for usage in LXR

KMime::Headers::Generics::AddressList Class Reference

#include <headers.h>

Inheritance diagram for KMime::Headers::Generics::AddressList:

Public Member Functions

void addAddress (const QByteArray &address, const QString &displayName=QString())
 
void addAddress (const Types::Mailbox &mbox)
 
QList< QByteArrayaddresses () const
 
QByteArray as7BitString (bool withHeaderType=true) const override
 
QString asUnicodeString () const override
 
QStringList displayNames () const
 
QString displayString () const
 
void fromUnicodeString (const QString &s) override
 
void fromUnicodeString (const QString &s, const QByteArray &b)
 
bool isEmpty () const override
 
Types::Mailbox::List mailboxes () const
 
void setAddressList (const Types::AddressList &addresses)
 
- Public Member Functions inherited from KMime::Headers::Generics::Structured
QString asUnicodeString () const override
 
void from7BitString (QByteArrayView s) override
 
void fromUnicodeString (const QString &s) override
 
void fromUnicodeString (const QString &s, const QByteArray &b)
 
- Public Member Functions inherited from KMime::Headers::Base
 Base ()
 
virtual ~Base ()
 
void fromUnicodeString (const QString &s, const QByteArray &b)
 
bool is (QByteArrayView t) const
 
QByteArray rfc2047Charset () const
 
void setRFC2047Charset (const QByteArray &cs)
 
virtual const char * type () const
 

Protected Member Functions

bool parse (const char *&scursor, const char *const send, bool isCRLF=false) override
 
- Protected Member Functions inherited from KMime::Headers::Generics::Structured
- Protected Member Functions inherited from KMime::Headers::Base
QByteArray typeIntro () const
 

Additional Inherited Members

- Public Types inherited from KMime::Headers::Base
typedef QList< KMime::Headers::Base * > List
 

Detailed Description

Base class for headers that deal with (possibly multiple) addresses, allowing groups.

Note: Groups are parsed but not represented in the API yet. All addresses in groups are listed as if they would not be part of a group.

Todo
Add API for groups?
See also
RFC 2822, section 3.4

Definition at line 423 of file headers.h.

Member Function Documentation

◆ addAddress() [1/2]

void KMime::Headers::Generics::AddressList::addAddress ( const QByteArray & address,
const QString & displayName = QString() )

Adds an address to this header.

Parameters
addressThe actual email address, with or without angle brackets.
displayNameAn optional name associated with the address.

Definition at line 517 of file headers.cpp.

◆ addAddress() [2/2]

void KMime::Headers::Generics::AddressList::addAddress ( const Types::Mailbox & mbox)

Adds an address to this header.

Parameters
mboxA Mailbox object specifying the address.

Definition at line 509 of file headers.cpp.

◆ addresses()

QList< QByteArray > KMime::Headers::Generics::AddressList::addresses ( ) const
nodiscard

Returns a list of all addresses in this header, regardless of groups.

Definition at line 529 of file headers.cpp.

◆ as7BitString()

QByteArray KMime::Headers::Generics::AddressList::as7BitString ( bool withHeaderType = true) const
nodiscardoverridevirtual

Returns the encoded header.

Parameters
withHeaderTypeSpecifies whether the header-type should be included.

Implements KMime::Headers::Base.

Reimplemented in KMime::Headers::MailCopiesTo.

Definition at line 462 of file headers.cpp.

◆ asUnicodeString()

QString KMime::Headers::Generics::AddressList::asUnicodeString ( ) const
nodiscardoverridevirtual

Returns the decoded content of the header without the header-type.

Note
The return value of this method should only be used when showing an address to the user. It is not guaranteed that fromUnicodeString( asUnicodeString(), ... ) will return the original string.

Implements KMime::Headers::Base.

Reimplemented in KMime::Headers::MailCopiesTo.

Definition at line 490 of file headers.cpp.

◆ displayNames()

QStringList KMime::Headers::Generics::AddressList::displayNames ( ) const
nodiscard

Returns a list of all display names associated with the addresses in this header.

The address is added for addresses that don't have a display name.

Definition at line 541 of file headers.cpp.

◆ displayString()

QString KMime::Headers::Generics::AddressList::displayString ( ) const
nodiscard

Returns a single string for user-facing display of this address list.

This is equivalent to displayNames().join(", ").

Since
5.14

Definition at line 558 of file headers.cpp.

◆ fromUnicodeString() [1/2]

void KMime::Headers::Generics::AddressList::fromUnicodeString ( const QString & s)
overridevirtual

Parses the given Unicode representation of the header content.

Parameters
sThe header data as Unicode string.

Implements KMime::Headers::Base.

Definition at line 484 of file headers.cpp.

◆ fromUnicodeString() [2/2]

void KMime::Headers::Base::fromUnicodeString ( const QString & s,
const QByteArray & b )
inline

Definition at line 144 of file headers.h.

◆ isEmpty()

bool KMime::Headers::Generics::AddressList::isEmpty ( ) const
nodiscardoverridevirtual

Checks if this header contains any data.

Implements KMime::Headers::Base.

Reimplemented in KMime::Headers::MailCopiesTo.

Definition at line 504 of file headers.cpp.

◆ mailboxes()

Types::Mailbox::List KMime::Headers::Generics::AddressList::mailboxes ( ) const
nodiscard

Returns a list of mailboxes listed in this header.

Definition at line 564 of file headers.cpp.

◆ parse()

bool KMime::Headers::Generics::AddressList::parse ( const char *& scursor,
const char *const send,
bool isCRLF = false )
overrideprotectedvirtual

This method parses the raw header and needs to be implemented in every sub-class.

Parameters
scursorPointer to the start of the data still to parse.
sendPointer to the end of the data.
isCRLFtrue if input string is terminated with a CRLF.

Implements KMime::Headers::Generics::Structured.

Reimplemented in KMime::Headers::MailCopiesTo.

Definition at line 583 of file headers.cpp.

◆ setAddressList()

void KMime::Headers::Generics::AddressList::setAddressList ( const Types::AddressList & addresses)

Sets the list of addresses listed in this header, replacing the existing content.

Since
24.12

Definition at line 577 of file headers.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:47:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.