• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KDECore

KCharsets Class Reference

Charset font and encoder/decoder handling. More...

#include <kcharsets.h>

List of all members.


Public Member Functions

QStringList availableEncodingNames ()
QTextCodec * codecForName (const QString &n, bool &ok) const
QTextCodec * codecForName (const QString &name) const
QStringList descriptiveEncodingNames ()
QString encodingForName (const QString &descriptiveName)
QString languageForEncoding (const QString &encoding)
virtual ~KCharsets ()

Static Public Member Functions

static QChar fromEntity (const QString &str, int &len)
static QChar fromEntity (const QString &str)
static QString resolveEntities (const QString &text)
static QString toEntity (const QChar &ch)

Protected Member Functions

 KCharsets ()

Detailed Description

Charset font and encoder/decoder handling.

This is needed, because Qt's font matching algorithm gives the font family a higher priority than the charset. For many applications this is not acceptable, since it can totally obscure the output, in languages which use non iso-8859-1 charsets.

Author:
Lars Knoll <knoll@kde.org>

Definition at line 43 of file kcharsets.h.


Constructor & Destructor Documentation

KCharsets::KCharsets (  )  [protected]

Protected constructor.

If you need the kcharsets object, use KGlobal::charsets() instead.

Definition at line 360 of file kcharsets.cpp.

KCharsets::~KCharsets (  )  [virtual]

Destructor.

Definition at line 365 of file kcharsets.cpp.


Member Function Documentation

QStringList KCharsets::availableEncodingNames (  ) 

Lists all available encodings as names.

Returns:
the list of all encodings

Definition at line 475 of file kcharsets.cpp.

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 latin1 codec will be returned an ok will be set to false.

Returns:
the QTextCodec. If the desired codec could not be found, it returns a default (Latin-1) codec

Definition at line 528 of file kcharsets.cpp.

QTextCodec * KCharsets::codecForName ( const QString &  name  )  const

Provided for compatibility.

Parameters:
name the name of the codec
Returns:
the QTextCodec. If the desired codec could not be found, it returns a default (Latin-1) codec

Definition at line 522 of file kcharsets.cpp.

QStringList KCharsets::descriptiveEncodingNames (  ) 

Lists the available encoding names together with a more descriptive language.

Returns:
the list of descriptive encoding names

Definition at line 509 of file kcharsets.cpp.

QString KCharsets::encodingForName ( const QString &  descriptiveName  ) 

Returns the encoding for a string obtained with descriptiveEncodingNames().

Parameters:
descriptiveName the descriptive name for the encoding
Returns:
the name of the encoding

Definition at line 492 of file kcharsets.cpp.

QChar KCharsets::fromEntity ( const QString &  str,
int &  len 
) [static]

Overloaded member function.

Tries to find an entity in the QString str.

Parameters:
str the string containing entified
len is a return value, that gives the length of the decoded entity.
Returns:
a decoded entity if one could be found, QChar::null otherwise

Definition at line 406 of file kcharsets.cpp.

QChar KCharsets::fromEntity ( const QString &  str  )  [static]

Converts an entity to a character.

The string must contain only the entity without the trailing ';'.

Parameters:
str the entity
Returns:
QChar::null if the entity could not be decoded.

Definition at line 370 of file kcharsets.cpp.

QString KCharsets::languageForEncoding ( const QString &  encoding  ) 

Returns the language the encoding is used for.

Parameters:
encoding the encoding for the language
Returns:
the language of the encoding

Definition at line 485 of file kcharsets.cpp.

QString KCharsets::resolveEntities ( const QString &  text  )  [static]

Scans the given string for entities (like &amp;) and resolves them using fromEntity.

Parameters:
text the string containing the entities
Returns:
the clean string
Since:
3.1

Definition at line 429 of file kcharsets.cpp.

QString KCharsets::toEntity ( const QChar &  ch  )  [static]

Converts a QChar to an entity.

The returned string does already contain the leading '&' and the trailing ';'.

Parameters:
ch the char to convert
Returns:
the entity

Definition at line 422 of file kcharsets.cpp.


The documentation for this class was generated from the following files:
  • kcharsets.h
  • kcharsets.cpp

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal