|
VMime
|
#include <text.hpp>


Public Types | |
| enum | EncodeAndFoldFlags { FORCE_NO_ENCODING = (1 << 0) , FORCE_ENCODING = (1 << 1) , NO_NEW_LINE_SEQUENCE = (1 << 2) , QUOTE_IF_POSSIBLE = (1 << 3) , QUOTE_IF_NEEDED = (1 << 4) } |
Static Public Member Functions | |
| static shared_ptr< text > | newFromString (const string &in, const charset &ch) |
| static shared_ptr< text > | decodeAndUnfold (const string &in) |
| static shared_ptr< text > | decodeAndUnfold (const parsingContext &ctx, const string &in) |
| static text * | decodeAndUnfold (const string &in, text *generateInExisting) |
| static text * | decodeAndUnfold (const parsingContext &ctx, const string &in, text *generateInExisting) |
Protected Member Functions | |
| void | parseImpl (const parsingContext &ctx, const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL) |
| void | generateImpl (const generationContext &ctx, utility::outputStream &os, const size_t curLinePos=0, size_t *newLinePos=NULL) const |
Protected Member Functions inherited from component | |
| void | setParsedBounds (const size_t start, const size_t end) |
| virtual void | parseImpl (const parsingContext &ctx, shared_ptr< utility::parserInputStreamAdapter > parser, const size_t position, const size_t end, size_t *newPosition=NULL) |
Protected Member Functions inherited from object | |
| object () | |
| object (const object &) | |
| object & | operator= (const object &) |
| virtual | ~object () |
Static Protected Member Functions | |
| static void | fixBrokenWords (std::vector< shared_ptr< word > > &words) |
List of encoded-words, as defined in RFC-2047 (basic type).
Flags used by "encodeAndFold" function.
| text | ( | ) |
Referenced by text::decodeAndUnfold().
References text::copyFrom(), and vmime::dynamicCast().
References text::createFromString(), and vmime::dynamicCast().
References text::createFromString(), vmime::dynamicCast(), and charset::getLocalCharset().
References text::appendWord(), and vmime::dynamicCast().
| ~text | ( | ) |
References text::removeAllWords().
| void appendWord | ( | shared_ptr< word > | w | ) |
Add a word at the end of the list.
| w | word to append |
References vmime::dynamicCast().
Referenced by text::createFromString(), text::text(), and emailAddress::toText().
|
virtual |
Clone this component.
Implements component.
References vmime::dynamicCast().
Referenced by htmlTextPart::setText().
Replace data in this component by data in other component.
Both components must be of the same type.
| std::bad_cast_exception | if the components are not of the same (dynamic) type |
| other | other component to copy data from |
Implements component.
References vmime::dynamicCast(), and text::removeAllWords().
Referenced by text::operator=(), text::operator=(), and text::text().
This function can be used to make several encoded words from a text.
All the characters in the text must be in the same specified charset.
Eg: giving:
<iso-8859-1> "Linux dans un t'el'ephone mobile"
("=?iso-8859-1?Q?Linux_dans_un_t=E9l=E9phone_mobile?=")
it will return:
<us-ascii> "Linux dans un "
<iso-8859-1> "t'el'ephone "
<us-ascii> "mobile"
("Linux dans un =?iso-8859-1?Q?t=E9l=E9phone_?= mobile")
| in | input string |
| ch | input charset |
References text::appendWord(), vmime::count(), stringUtils::countASCIIchars(), vmime::dynamicCast(), vmime::end(), text::getWordAt(), text::getWordCount(), parserHelpers::isAscii(), parserHelpers::isSpace(), text::removeAllWords(), and vmime::charsets::US_ASCII.
Referenced by text::text(), and text::text().
|
static |
Decode and unfold text (RFC-2047).
| ctx | parsingContext |
| in | input string |
References text::decodeAndUnfold(), and vmime::dynamicCast().
|
static |
Decode and unfold text (RFC-2047).
| ctx | parsing context |
| in | input string |
| generateInExisting | if not NULL, the resulting text will be generated in the specified object instead of a new created object (in this case, the function returns the same pointer). Can be used to avoid copying the resulting object into an existing object. |
References vmime::copy_vector(), vmime::dynamicCast(), text::fixBrokenWords(), and text::text().
|
static |
Decode and unfold text (RFC-2047), using the default parsing context.
| in | input string |
References text::decodeAndUnfold(), vmime::dynamicCast(), and parsingContext::getDefaultContext().
Referenced by text::decodeAndUnfold(), text::decodeAndUnfold(), text::decodeAndUnfold(), mailbox::parseImpl(), and mailboxGroup::parseImpl().
Decode and unfold text (RFC-2047), using the default parsing context.
| in | input string |
| generateInExisting | if not NULL, the resulting text will be generated in the specified object instead of a new created object (in this case, the function returns the same pointer). Can be used to avoid copying the resulting object into an existing object. |
References text::decodeAndUnfold(), vmime::dynamicCast(), and parsingContext::getDefaultContext().
| void encodeAndFold | ( | const generationContext & | ctx, |
| utility::outputStream & | os, | ||
| const size_t | firstLineOffset, | ||
| size_t * | lastLineLength, | ||
| const int | flags | ||
| ) | const |
Encode and fold text in respect to RFC-2047.
| ctx | generation context |
| os | output stream |
| firstLineOffset | the first line length (may be useful if the current output line is not empty) |
| lastLineLength | will receive the length of the last line written |
| flags | encoding flags (see EncodeAndFoldFlags) |
References vmime::dynamicCast(), text::getWordAt(), and text::getWordCount().
Referenced by mailbox::generateImpl(), mailboxGroup::generateImpl(), relay::generateImpl(), and text::generateImpl().
|
staticprotected |
References vmime::dynamicCast().
Referenced by text::decodeAndUnfold().
|
protectedvirtual |
Implements component.
References vmime::dynamicCast(), and text::encodeAndFold().
|
virtual |
Return the list of children of this component.
Implements component.
References vmime::copy_vector().
| const string getConvertedText | ( | const charset & | dest, |
| const charsetConverterOptions & | opts = charsetConverterOptions() |
||
| ) | const |
Return the text converted into the specified charset.
The encoded-words are decoded and then converted in the specified destination charset.
| dest | output charset |
| opts | options for charset conversion |
References vmime::dynamicCast().
Referenced by courierMaildirFormat::toModifiedUTF7().
Return the unconverted (raw) data of all words.
This is the concatenation of the results returned by getBuffer() on the contained words.
References vmime::dynamicCast().
Referenced by importanceHelper::getImportanceHeader(), htmlTextPart::parse(), and body::parseImpl().
| const shared_ptr< word > getWordAt | ( | const size_t | pos | ) |
Return the word at the specified position.
| pos | position |
References vmime::dynamicCast().
Referenced by text::createFromString(), text::encodeAndFold(), mailbox::generateImpl(), and mailboxGroup::generateImpl().
Return the word at the specified position.
| pos | position |
References vmime::dynamicCast().
| size_t getWordCount | ( | ) | const |
Return the number of words in the list.
Referenced by text::createFromString(), text::encodeAndFold(), mailbox::generateImpl(), mailboxGroup::generateImpl(), and text::operator==().
| const std::vector< shared_ptr< word > > getWordList | ( | ) |
Return the word list.
| const std::vector< shared_ptr< const word > > getWordList | ( | ) | const |
| void insertWordAfter | ( | const size_t | pos, |
| shared_ptr< word > | w | ||
| ) |
Insert a new word after the specified position.
| pos | position of the word before the new word |
| w | word to insert |
References vmime::dynamicCast().
| void insertWordBefore | ( | const size_t | pos, |
| shared_ptr< word > | w | ||
| ) |
Insert a new word before the specified position.
| pos | position at which to insert the new word (0 to insert at the beginning of the list) |
| w | word to insert |
References vmime::dynamicCast().
| bool isEmpty | ( | ) | const |
Tests whether the list of words is empty.
Referenced by mailbox::generateImpl(), and defaultAttachment::generatePart().
This function can be used to make several encoded words from a text.
All the characters in the text must be in the same specified charset.
Eg: giving:
<iso-8859-1> "Linux dans un t'el'ephone mobile"
("=?iso-8859-1?Q?Linux_dans_un_t=E9l=E9phone_mobile?=")
it will return:
<us-ascii> "Linux dans un "
<iso-8859-1> "t'el'ephone "
<us-ascii> "mobile"
("Linux dans un =?iso-8859-1?Q?t=E9l=E9phone_?= mobile")
| in | input string |
| ch | input charset |
References vmime::dynamicCast().
References vmime::dynamicCast().
References text::copyFrom().
References text::copyFrom().
References vmime::dynamicCast(), and text::getWordCount().
|
protectedvirtual |
Reimplemented from component.
References vmime::copy_vector(), vmime::dynamicCast(), vmime::end(), text::removeAllWords(), and component::setParsedBounds().
| void removeAllWords | ( | ) |
Remove all words from the list.
Referenced by mailbox::clear(), text::copyFrom(), text::createFromString(), mailbox::parseImpl(), text::parseImpl(), and text::~text().
Remove the word at the specified position.
| pos | position of the word to remove |
References vmime::dynamicCast().