TQTranslatorMessage Class Reference
The TQTranslatorMessage class contains a translator message and its
properties.
More...
#include <ntqtranslator.h>
List of all member functions.
Public Members
- TQTranslatorMessage ()
- TQTranslatorMessage ( const char * context, const char * sourceText, const char * comment, const TQString & translation = TQString::null )
- TQTranslatorMessage ( TQDataStream & stream )
- TQTranslatorMessage ( const TQTranslatorMessage & m )
- TQTranslatorMessage & operator= ( const TQTranslatorMessage & m )
- uint hash () const
- const char * context () const
- const char * sourceText () const
- const char * comment () const
- void setTranslation ( const TQString & translation )
- TQString translation () const
- enum Prefix { NoPrefix, Hash, HashContext, HashContextSourceText, HashContextSourceTextComment }
- void write ( TQDataStream & stream, bool strip = FALSE, Prefix prefix = HashContextSourceTextComment ) const
- Prefix commonPrefix ( const TQTranslatorMessage & m ) const
- bool operator== ( const TQTranslatorMessage & m ) const
- bool operator!= ( const TQTranslatorMessage & m ) const
- bool operator< ( const TQTranslatorMessage & m ) const
- bool operator<= ( const TQTranslatorMessage & m ) const
- bool operator> ( const TQTranslatorMessage & m ) const
- bool operator>= ( const TQTranslatorMessage & m ) const
Detailed Description
The TQTranslatorMessage class contains a translator message and its
properties.
This class is of no interest to most applications. It is useful
for translation tools such as TQt
Linguist. It is provided simply to make the API complete
and regular.
For a TQTranslator object, a lookup key is a triple (context, source text, comment) that uniquely identifies a message. An
extended key is a quadruple (hash, context, source text, comment), where hash is computed from the source text
and the comment. Unless you plan to read and write messages
yourself, you need not worry about the hash value.
TQTranslatorMessage stores this triple or quadruple and the relevant
translation if there is any.
See also TQTranslator, Environment Classes, and Internationalization with TQt.
Member Type Documentation
TQTranslatorMessage::Prefix
Let (h, c, s, m) be the extended key. The possible
prefixes are
- TQTranslatorMessage::NoPrefix - no prefix
- TQTranslatorMessage::Hash - only (h)
- TQTranslatorMessage::HashContext - only (h, c)
- TQTranslatorMessage::HashContextSourceText - only (h, c, s)
- TQTranslatorMessage::HashContextSourceTextComment - the whole extended key, (h, c, s, m)
See also write() and commonPrefix().
Member Function Documentation
TQTranslatorMessage::TQTranslatorMessage ()
Constructs a translator message with the extended key (0, 0, 0, 0)
and TQString::null as translation.
TQTranslatorMessage::TQTranslatorMessage ( const char * context, const char * sourceText, const char * comment, const TQString & translation = TQString::null )
Constructs an translator message with the extended key (h, context, sourceText, comment), where h is computed from
sourceText and comment, and possibly with a translation.
TQTranslatorMessage::TQTranslatorMessage ( TQDataStream & stream )
Constructs a translator message read from the stream. The
resulting message may have any combination of content.
See also TQTranslator::save().
TQTranslatorMessage::TQTranslatorMessage ( const TQTranslatorMessage & m )
Constructs a copy of translator message m.
const char * TQTranslatorMessage::comment () const
Returns the comment for this message (e.g. "File|Save").
Warning: This may return 0 if the TQTranslator object is stripped
(compressed).
Prefix TQTranslatorMessage::commonPrefix ( const TQTranslatorMessage & m ) const
Returns the widest lookup prefix that is common to this translator
message and to message m.
For example, if the extended key is for this message is (71,
"PrintDialog", "Yes", "Print?") and that for m is (71,
"PrintDialog", "No", "Print?"), this function returns HashContext.
See also write().
const char * TQTranslatorMessage::context () const
Returns the context for this message (e.g. "MyDialog").
Warning: This may return 0 if the TQTranslator object is stripped
(compressed).
uint TQTranslatorMessage::hash () const
Returns the hash value used internally to represent the lookup
key. This value is zero only if this translator message was
constructed from a stream containing invalid data.
The hashing function is unspecified, but it will remain unchanged
in future versions of TQt.
bool TQTranslatorMessage::operator!= ( const TQTranslatorMessage & m ) const
Returns TRUE if the extended key of this object is different from
that of m; otherwise returns FALSE.
bool TQTranslatorMessage::operator< ( const TQTranslatorMessage & m ) const
Returns TRUE if the extended key of this object is
lexicographically before than that of m; otherwise returns
FALSE.
bool TQTranslatorMessage::operator<= ( const TQTranslatorMessage & m ) const
Returns TRUE if the extended key of this object is
lexicographically before that of m or if they are equal;
otherwise returns FALSE.
Assigns message m to this translator message and returns a
reference to this translator message.
bool TQTranslatorMessage::operator== ( const TQTranslatorMessage & m ) const
Returns TRUE if the extended key of this object is equal to that of
m; otherwise returns FALSE.
bool TQTranslatorMessage::operator> ( const TQTranslatorMessage & m ) const
Returns TRUE if the extended key of this object is
lexicographically after that of m; otherwise returns FALSE.
bool TQTranslatorMessage::operator>= ( const TQTranslatorMessage & m ) const
Returns TRUE if the extended key of this object is
lexicographically after that of m or if they are equal;
otherwise returns FALSE.
void TQTranslatorMessage::setTranslation ( const TQString & translation )
Sets the translation of the source text to translation.
See also translation().
const char * TQTranslatorMessage::sourceText () const
Returns the source text of this message (e.g. "&Save").
Warning: This may return 0 if the TQTranslator object is stripped
(compressed).
TQString TQTranslatorMessage::translation () const
Returns the translation of the source text (e.g., "&Sauvegarder").
See also setTranslation().
void TQTranslatorMessage::write ( TQDataStream & stream, bool strip = FALSE, Prefix prefix = HashContextSourceTextComment ) const
Writes this translator message to the stream. If strip is
FALSE (the default), all the information in the message is
written. If strip is TRUE, only the part of the extended key
specified by prefix is written with the translation (HashContextSourceTextComment by default).
See also commonPrefix().
This file is part of the TQt toolkit.
Copyright © 1995-2007
Trolltech. All Rights Reserved.