|
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) } |
Public Member Functions | |
| text () | |
| text (const text &t) | |
| text (const string &t, const charset &ch) | |
| text (const string &t) | |
| text (const word &w) | |
| ~text () | |
| bool | operator== (const text &t) const |
| bool | operator!= (const text &t) const |
| shared_ptr< component > | clone () const |
| void | copyFrom (const component &other) |
| text & | operator= (const component &other) |
| text & | operator= (const text &other) |
| const std::vector< shared_ptr< component > > | getChildComponents () |
| void | appendWord (shared_ptr< word > w) |
| void | insertWordBefore (const size_t pos, shared_ptr< word > w) |
| void | insertWordAfter (const size_t pos, shared_ptr< word > w) |
| void | removeWord (const size_t pos) |
| void | removeAllWords () |
| size_t | getWordCount () const |
| bool | isEmpty () const |
| const shared_ptr< word > | getWordAt (const size_t pos) |
| const shared_ptr< const word > | getWordAt (const size_t pos) const |
| const std::vector< shared_ptr< const word > > | getWordList () const |
| const std::vector< shared_ptr< word > > | getWordList () |
| const string | getConvertedText (const charset &dest, const charsetConverterOptions &opts=charsetConverterOptions()) const |
| const string | getWholeBuffer () const |
| void | createFromString (const string &in, const charset &ch) |
| void | encodeAndFold (const generationContext &ctx, utility::outputStream &os, const size_t firstLineOffset, size_t *lastLineLength, const int flags) const |
| Public Member Functions inherited from headerFieldValue | |
| size_t | getGeneratedSize (const generationContext &ctx) |
| Public Member Functions inherited from component | |
| component () | |
| virtual | ~component () |
| void | parse (const string &buffer) |
| void | parse (const parsingContext &ctx, const string &buffer) |
| void | parse (shared_ptr< utility::inputStream > inputStream, const size_t length) |
| void | parse (const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL) |
| void | parse (const parsingContext &ctx, const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL) |
| void | parse (shared_ptr< utility::inputStream > inputStream, const size_t position, const size_t end, size_t *newPosition=NULL) |
| void | parse (const parsingContext &ctx, shared_ptr< utility::inputStream > inputStream, const size_t position, const size_t end, size_t *newPosition=NULL) |
| virtual const string | generate (const size_t maxLineLength=lineLengthLimits::infinite, const size_t curLinePos=0) const |
| virtual void | generate (utility::outputStream &outputStream, const size_t curLinePos=0, size_t *newLinePos=NULL) const |
| virtual void | generate (const generationContext &ctx, utility::outputStream &outputStream, const size_t curLinePos=0, size_t *newLinePos=NULL) const |
| size_t | getParsedOffset () const |
| size_t | getParsedLength () const |
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).
| enum EncodeAndFoldFlags |
Flags used by "encodeAndFold" function.
| text | ( | ) |
Referenced by copyFrom(), decodeAndUnfold(), decodeAndUnfold(), operator!=(), operator=(), operator=(), operator==(), and text().
| text | ( | const text & | t | ) |
References copyFrom(), and text().
References createFromString().
|
explicit |
References createFromString(), and charset::getLocalCharset().
|
explicit |
References appendWord().
| ~text | ( | ) |
References removeAllWords().
| void appendWord | ( | shared_ptr< word > | w | ) |
Add a word at the end of the list.
| w | word to append |
Referenced by createFromString(), text(), and emailAddress::toText().
|
virtual |
Clone this component.
Implements component.
Referenced by htmlTextPart::setText().
|
virtual |
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 removeAllWords(), and text().
Referenced by operator=(), operator=(), and 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 appendWord(), vmime::count(), stringUtils::countASCIIchars(), vmime::end(), charset::getRecommendedEncoding(), getWordAt(), getWordCount(), parserHelpers::isAscii(), parserHelpers::isSpace(), removeAllWords(), and vmime::charsets::US_ASCII.
|
static |
Decode and unfold text (RFC-2047).
| ctx | parsingContext |
| in | input string |
References decodeAndUnfold().
|
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(), fixBrokenWords(), removeAllWords(), and text().
Decode and unfold text (RFC-2047), using the default parsing context.
| in | input string |
References decodeAndUnfold(), and parsingContext::getDefaultContext().
Referenced by decodeAndUnfold(), decodeAndUnfold(), 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 decodeAndUnfold(), parsingContext::getDefaultContext(), and text().
| 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 getWordAt(), and getWordCount().
Referenced by body::generateImpl(), relay::generateImpl(), generateImpl(), and body::getGeneratedSize().
|
staticprotected |
Referenced by decodeAndUnfold().
|
protectedvirtual |
Implements component.
References 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 |
Referenced by SMTPCommand::MAIL(), SMTPCommand::RCPT(), and courierMaildirFormat::toModifiedUTF7().
| const string getWholeBuffer | ( | ) | const |
Return the unconverted (raw) data of all words.
This is the concatenation of the results returned by getBuffer() on the contained words.
Referenced by importanceHelper::getImportanceHeader(), htmlTextPart::parse(), and body::parseImpl().
Return the word at the specified position.
| pos | position |
Referenced by createFromString(), and encodeAndFold().
Return the word at the specified position.
| pos | position |
| size_t getWordCount | ( | ) | const |
Return the number of words in the list.
Referenced by createFromString(), encodeAndFold(), and operator==().
| const std::vector< shared_ptr< word > > getWordList | ( | ) |
Return the word list.
| const std::vector< shared_ptr< const word > > getWordList | ( | ) | const |
Return the word list.
Insert a new word after the specified position.
| pos | position of the word before the new word |
| w | word to insert |
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 |
| bool isEmpty | ( | ) | const |
Tests whether the list of words is empty.
Referenced by body::generateImpl(), and body::getGeneratedSize().
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 copyFrom(), and text().
References copyFrom(), and text().
| bool operator== | ( | const text & | t | ) | const |
References getWordCount(), and text().
|
protectedvirtual |
Reimplemented from component.
References vmime::copy_vector(), vmime::end(), removeAllWords(), and component::setParsedBounds().
| void removeAllWords | ( | ) |
Remove all words from the list.
Referenced by copyFrom(), createFromString(), decodeAndUnfold(), parseImpl(), and ~text().
| void removeWord | ( | const size_t | pos | ) |
Remove the word at the specified position.
| pos | position of the word to remove |