VMime
|
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 text::decodeAndUnfold().
References text::copyFrom().
References text::createFromString().
References text::createFromString(), and charset::getLocalCharset().
References text::appendWord().
~text | ( | ) |
References text::removeAllWords().
void appendWord | ( | shared_ptr< word > | w | ) |
Add a word at the end of the list.
w | word to append |
Referenced by text::createFromString(), text::text(), and emailAddress::toText().
|
virtual |
|
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 text::removeAllWords().
Referenced by 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(), charset::getRecommendedEncoding(), text::getWordAt(), text::getWordCount(), parserHelpers::isAscii(), parserHelpers::isSpace(), text::removeAllWords(), and vmime::charsets::US_ASCII.
Referenced by text::text().
Decode and unfold text (RFC-2047), using the default parsing context.
in | input string |
References parsingContext::getDefaultContext().
Referenced by text::decodeAndUnfold(), mailbox::parseImpl(), and mailboxGroup::parseImpl().
|
static |
Decode and unfold text (RFC-2047).
ctx | parsingContext |
in | input string |
References text::decodeAndUnfold().
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(), and parsingContext::getDefaultContext().
|
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(), text::fixBrokenWords(), text::removeAllWords(), and text::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) |
Referenced by body::generateImpl(), and body::getGeneratedSize().
|
staticprotected |
Referenced by text::decodeAndUnfold().
|
protectedvirtual |
Implements component.
|
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(), and SMTPCommand::RCPT().
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 text::createFromString().
Return the word at the specified position.
pos | position |
size_t getWordCount | ( | ) | const |
Return the number of words in the list.
Referenced by text::createFromString(), and text::operator==().
const std::vector< shared_ptr< const word > > getWordList | ( | ) | const |
Return the word list.
const std::vector< shared_ptr< word > > getWordList | ( | ) |
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(), defaultAttachment::generatePart(), 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 |
bool operator!= | ( | const text & | t | ) | const |
References text::copyFrom().
References text::copyFrom().
bool operator== | ( | const text & | t | ) | const |
References text::getWordCount().
|
protectedvirtual |
Reimplemented from component.
References vmime::copy_vector().
void removeAllWords | ( | ) |
Remove all words from the list.
Referenced by mailbox::clear(), text::copyFrom(), text::createFromString(), text::decodeAndUnfold(), and text::~text().
void removeWord | ( | const size_t | pos | ) |
Remove the word at the specified position.
pos | position of the word to remove |