VMime
|
Public Member Functions | |
charset () | |
charset (const string &name) | |
charset (const char *name) | |
const string & | getName () const |
charset & | operator= (const charset &other) |
bool | operator== (const charset &value) const |
bool | operator!= (const charset &value) const |
const std::vector< shared_ptr < component > > | getChildComponents () |
bool | getRecommendedEncoding (encoding &enc) const |
bool | isValidText (const string &text, string::size_type *firstInvalidByte) const |
shared_ptr< component > | clone () const |
void | copyFrom (const component &other) |
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 |
virtual size_t | getGeneratedSize (const generationContext &ctx) |
Static Public Member Functions | |
static const charset | getLocalCharset () |
static void | convert (const string &in, string &out, const charset &source, const charset &dest, const charsetConverterOptions &opts=charsetConverterOptions()) |
static void | convert (utility::inputStream &in, utility::outputStream &out, const charset &source, const charset &dest, const charsetConverterOptions &opts=charsetConverterOptions()) |
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 () |
Charset description (basic type).
charset | ( | ) |
References stringUtils::isStringEqualNoCase().
charset | ( | const char * | name | ) |
|
virtual |
|
static |
Convert a string buffer from one charset to another charset (in-memory conversion)
in | input buffer |
out | output buffer |
source | input charset |
dest | output charset |
opts | conversion options |
exceptions::illegal_byte_sequence_for_charset | if an illegal byte sequence was found in the input bytes, and the 'silentlyReplaceInvalidSequences' flag is set to false in the charsetConverterOptions |
exceptions::charset_conv_error | if an unexpected error occured during the conversion |
References charsetConverter::create().
Referenced by charsetConverter_idna::convert(), courierMaildirFormat::fromModifiedUTF7(), word::getConvertedText(), and wordEncoder::wordEncoder().
|
static |
Convert the contents of an input stream in a specified charset to another charset and write the result to an output stream.
in | input stream to read data from |
out | output stream to write the converted data |
source | input charset |
dest | output charset |
opts | conversion options |
exceptions::illegal_byte_sequence_for_charset | if an illegal byte sequence was found in the input bytes, and the 'silentlyReplaceInvalidSequences' flag is set to false in the charsetConverterOptions |
exceptions::charset_conv_error | if an unexpected error occured during the conversion |
References charsetConverter::create().
|
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.
Referenced by charset::operator=().
|
protectedvirtual |
Implements component.
|
virtual |
Return the list of children of this component.
Implements component.
|
static |
Returns the default charset used on the system.
This function simply calls platformHandler::getLocalCharset()
and is provided for convenience.
References platform::getHandler().
Referenced by word::operator=(), and text::text().
const string & getName | ( | ) | const |
Return the ISO name of the charset.
Referenced by charset::getRecommendedEncoding(), and IMAPCommand::SEARCH().
bool getRecommendedEncoding | ( | encoding & | enc | ) | const |
Gets the recommended encoding for this charset.
Note: there may be no recommended encoding.
enc | output parameter that will hold recommended encoding |
References vmime::g_charsetEncodingMap, charset::getName(), vmime::npos, and stringUtils::toLower().
Referenced by text::createFromString(), encoding::decide(), wordEncoder::guessBestEncoding(), and wordEncoder::isEncodingNeeded().
bool isValidText | ( | const string & | text, |
string::size_type * | firstInvalidByte | ||
) | const |
Checks whether the specified text is valid in this charset.
text | input text |
firstInvalidByte | if the function returns false, will contain the index of the first invalid byte in the string. Can be NULL if not used. |
References charsetConverter::create(), charsetConverter::status::inputBytesRead, and charsetConverterOptions::silentlyReplaceInvalidSequences.
bool operator!= | ( | const charset & | value | ) | const |
References charset::copyFrom().
bool operator== | ( | const charset & | value | ) | const |
References stringUtils::isStringEqualNoCase().
|
protectedvirtual |
Reimplemented from component.
References vmime::end(), stringUtils::isStringEqualNoCase(), and stringUtils::trim().