KCodecs 5.109.0
|
Charset font and encoder/decoder handling. More...
#include <KCharsets>
Public Member Functions | |
virtual | ~KCharsets () |
Destructor. | |
QStringList | availableEncodingNames () const |
Lists all available encodings as names. | |
QTextCodec * | codecForName (const QString &n, bool &ok) const |
Tries to find a QTextCodec to convert the given encoding from and to Unicode. | |
QTextCodec * | codecForName (const QString &name) const |
Provided for compatibility. | |
QString | descriptionForEncoding (const QString &encoding) const |
Returns a long description for an encoding name. | |
QStringList | descriptiveEncodingNames () const |
Lists the available encoding names together with a more descriptive language. | |
QString | encodingForName (const QString &descriptiveName) const |
Returns the encoding for a string obtained with descriptiveEncodingNames(). | |
QList< QStringList > | encodingsByScript () const |
Lists the available encoding names grouped by script (or language that uses them). | |
Static Public Member Functions | |
static KCharsets * | charsets () |
The global charset manager. | |
static QChar | fromEntity (const QString &str) |
Converts an entity to a character. | |
static QChar | fromEntity (const QString &str, int &len) |
Overloaded member function. | |
static QString | resolveEntities (const QString &text) |
Scans the given string for entities (like &) and resolves them using fromEntity. | |
static QString | toEntity (const QChar &ch) |
Converts a QChar to an entity. | |
Protected Member Functions | |
KCharsets () | |
Protected constructor. | |
Charset font and encoder/decoder handling.
This is needed, because Qt's encoding name matching in QTextCodec::codecForName matches only closely-related encoded names but not alternate names, e.g. found in the reality of the Internet.
|
protected |
Protected constructor.
If you need the kcharsets object, use KCharsets::charsets() instead.
|
virtual |
Destructor.
QStringList KCharsets::availableEncodingNames | ( | ) | const |
Lists all available encodings as names.
|
static |
The global charset manager.
QTextCodec * KCharsets::codecForName | ( | const QString & | n, |
bool & | ok | ||
) | const |
Tries to find a QTextCodec to convert the given encoding from and to Unicode.
If no codec could be found, the ISO 8859-1 codec will be returned an and ok
will be set to false.
n | the name of the codec |
ok | true if a matching codec has been found, false if not |
QTextCodec * KCharsets::codecForName | ( | const QString & | name | ) | const |
Provided for compatibility.
name | the name of the codec |
QString KCharsets::descriptionForEncoding | ( | const QString & | encoding | ) | const |
Returns a long description for an encoding name.
encoding | the encoding for the language |
QStringList KCharsets::descriptiveEncodingNames | ( | ) | const |
Lists the available encoding names together with a more descriptive language.
QString KCharsets::encodingForName | ( | const QString & | descriptiveName | ) | const |
Returns the encoding for a string obtained with descriptiveEncodingNames().
descriptiveName | the descriptive name for the encoding |
QList< QStringList > KCharsets::encodingsByScript | ( | ) | const |
Lists the available encoding names grouped by script (or language that uses them).
|
static |
Converts an entity to a character.
The string must contain only the entity without the trailing ';'.
str | the entity |
|
static |
Overloaded member function.
Tries to find an entity in the QString str.
str | the string containing entified |
len | is a return value, that gives the length of the decoded entity. |
|
static |
Scans the given string for entities (like &) and resolves them using fromEntity.
text | the string containing the entities |
|
static |
Converts a QChar to an entity.
The returned string does already contain the leading '&' and the trailing ';'.
ch | the char to convert |