KNewStuff
#include <ktranslatable.h>
Public Types | |
typedef QMapIterator< QString, QString > | Iterator |
typedef QMap< QString, QString > | Map |
Public Member Functions | |
KTranslatable () | |
KTranslatable (const QString &string) | |
KTranslatable (const KTranslatable &) | |
~KTranslatable () | |
void | addString (const QString &lang, const QString &string) |
bool | isEmpty () const |
bool | isTranslated () const |
QString | language () const |
QStringList | languages () const |
KTranslatable & | operator= (const KTranslatable &) |
QString | representation () const |
QMap< QString, QString > | stringmap () const |
QStringList | strings () const |
QString | translated (const QString &lang) const |
Detailed Description
String class with multiple localized representations.
KTranslatable is used as a drop-in replacement for QString whenever human-visible information needs to be stored and this information depends on the current language.
Definition at line 41 of file ktranslatable.h.
Member Typedef Documentation
typedef QMapIterator<QString, QString> KNS::KTranslatable::Iterator |
Definition at line 45 of file ktranslatable.h.
typedef QMap<QString, QString> KNS::KTranslatable::Map |
Definition at line 44 of file ktranslatable.h.
Constructor & Destructor Documentation
KTranslatable::KTranslatable | ( | ) |
Constructor.
Definition at line 28 of file ktranslatable.cpp.
KTranslatable::KTranslatable | ( | const QString & | string | ) |
Constructor.
Initializes the contents with a single string.
Definition at line 53 of file ktranslatable.cpp.
KTranslatable::KTranslatable | ( | const KTranslatable & | other | ) |
Definition at line 33 of file ktranslatable.cpp.
KTranslatable::~KTranslatable | ( | ) |
Definition at line 48 of file ktranslatable.cpp.
Member Function Documentation
Adds a string to the contents of this object.
- Parameters
-
lang Language code in 'xx_XX' format string The string to be stored for this language
Definition at line 59 of file ktranslatable.cpp.
bool KTranslatable::isEmpty | ( | ) | const |
Returns whether no content is set yet.
- Returns
- true if no content has been added yet, false otherwise
Definition at line 116 of file ktranslatable.cpp.
bool KTranslatable::isTranslated | ( | ) | const |
Returns whether the content provides alternative (translated) strings.
- Returns
- true if contents are translated, false otherwise
Definition at line 111 of file ktranslatable.cpp.
QString KTranslatable::language | ( | ) | const |
Returns the language which most likely resembles the current language.
- Returns
- Current language, or one close to it
Definition at line 77 of file ktranslatable.cpp.
QStringList KTranslatable::languages | ( | ) | const |
Returns the list of all languages for which strings are stored.
- Returns
- All languages the content is available for
Definition at line 96 of file ktranslatable.cpp.
KTranslatable & KTranslatable::operator= | ( | const KTranslatable & | other | ) |
Definition at line 39 of file ktranslatable.cpp.
QString KTranslatable::representation | ( | ) | const |
Returns the string which matches most closely the current language.
- Returns
- Contents for the current language
Definition at line 64 of file ktranslatable.cpp.
Returns a map of all languages and their strings.
- Returns
- Map of all languages as keys and all strings as values
Definition at line 106 of file ktranslatable.cpp.
QStringList KTranslatable::strings | ( | ) | const |
Returns the list of all strings stored for all languages.
- Returns
- All strings stored in this object
Definition at line 101 of file ktranslatable.cpp.
Returns the string which matches most closely the specified language.
- Parameters
-
lang Language the contents should appear in, in 'xx_XX' format
- Returns
- Contents for the specified language
Definition at line 89 of file ktranslatable.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.