kviewshell
DjVuMessageLite Class Reference
Exception causes and external messages are passed as message lists which have the following syntax:. More...
#include <DjVuMessageLite.h>
Public Member Functions | |
GUTF8String | LookUp (const GUTF8String &MessageList) const |
~DjVuMessageLite () | |
Static Public Member Functions | |
static void | AddByteStreamLater (const GP< ByteStream > &bs) |
static const DjVuMessageLite & | create_lite (void) |
static GNativeString | LookUpNative (const GUTF8String &MessageList) |
static GUTF8String | LookUpUTF8 (const GUTF8String &MessageList) |
static void | perror (const GUTF8String &MessageList) |
Static Public Attributes | |
static const DjVuMessageLite &(* | create )(void) |
Protected Member Functions | |
void | AddByteStream (const GP< ByteStream > &bs) |
DjVuMessageLite (void) | |
void | InsertArg (GUTF8String &message, const int ArgId, const GUTF8String &arg) const |
void | LookUpID (const GUTF8String &msgID, GUTF8String &message_text, GUTF8String &message_number) const |
GUTF8String | LookUpSingle (const GUTF8String &Single_Message) const |
Static Protected Member Functions | |
static GPList< ByteStream > & | getByteStream (void) |
static GP< DjVuMessageLite > & | getDjVuMessageLite (void) |
static const DjVuMessageLite & | real_create (void) |
Protected Attributes | |
GUTF8String | errors |
GMap< GUTF8String, GP < lt_XMLTags > > | Map |
Detailed Description
Exception causes and external messages are passed as message lists which have the following syntax:.message_list ::= single_message | single_message separator message_list
separator ::= newline | newline | separator
single_message ::= message_ID | message_ID parameters
parameters ::= tab string | tab string parameters
Message_IDs are looked up an external file and replaced by the message text strings they are mapped to. The message text may contain the following:
Parameter specifications: These are modelled after printf format specifications and have one of the following forms:
n!s! n!d! n!i! n!u! n!x! n!X!
where n is the parameter number. The parameter number is indicated explicitly to allow for the possibility that the parameter order may change when the message text is translated into another language. The final letter ('s', 'd', 'i', 'u', 'x', or 'X') indicates the form of the parameter (string, integer, integer, unsigned integer, lowercase hexadecimal, or uppercase hexadecimal, respectively). In addition formating options such as precision available in sprintf, may be used. So, to print the third argument as 5 digit unsigned number, with leading zero's one could use: 3!05u!
All of the arguments are actually strings. For forms that don't take string input ('d', 'i', 'u', 'x', or 'X'), and atoi() conversion is done on the string before formatting. In addition the form indicates to the translater whether to expect a word or a number.
The strings are read in from XML. To to format the strings, use the relavent XML escape sequences, such as follows:
[line feed] 	 [horizontal tab] ' [single quote] " [double quote] < [less than sign] > [greater than sign]
After parameters have been inserted in the message text, the formatting strings are replaced by their usual equivalents (newline and tab respectively).
If a message_id cannot be found in the external file, a message text is fabricated giving the message_id and the parameters (if any).
Separators (newlines) are preserved in the translated message list.
Expands message lists by looking up the message IDs and inserting arguments into the retrieved messages.
N.B. The resulting string may be encoded in UTF-8 format (ISO 10646-1 Annex R) and SHOULD NOT BE ASSUMED TO BE ASCII.
Definition at line 150 of file DjVuMessageLite.h.
Constructor & Destructor Documentation
DjVuMessageLite::DjVuMessageLite | ( | void | ) | [protected] |
Definition at line 171 of file DjVuMessageLite.cpp.
DjVuMessageLite::~DjVuMessageLite | ( | ) |
Destructor: Does any necessary cleanup.
Actions depend on how the message file is implemented.
Definition at line 174 of file DjVuMessageLite.cpp.
Member Function Documentation
void DjVuMessageLite::AddByteStream | ( | const GP< ByteStream > & | bs | ) | [protected] |
Definition at line 430 of file DjVuMessageLite.cpp.
void DjVuMessageLite::AddByteStreamLater | ( | const GP< ByteStream > & | bs | ) | [static] |
Adds a byte stream to be parsed whenever the next DjVuMessage::create() call is made.
Reimplemented in DjVuMessage.
Definition at line 146 of file DjVuMessageLite.cpp.
const DjVuMessageLite & DjVuMessageLite::create_lite | ( | void | ) | [static] |
GPList< ByteStream > & DjVuMessageLite::getByteStream | ( | void | ) | [static, protected] |
Definition at line 132 of file DjVuMessageLite.cpp.
GP< DjVuMessageLite > & DjVuMessageLite::getDjVuMessageLite | ( | void | ) | [static, protected] |
Definition at line 139 of file DjVuMessageLite.cpp.
void DjVuMessageLite::InsertArg | ( | GUTF8String & | message, | |
const int | ArgId, | |||
const GUTF8String & | arg | |||
) | const [protected] |
Definition at line 349 of file DjVuMessageLite.cpp.
GUTF8String DjVuMessageLite::LookUp | ( | const GUTF8String & | MessageList | ) | const |
Lookup the relavent string and parse the message.
Definition at line 189 of file DjVuMessageLite.cpp.
void DjVuMessageLite::LookUpID | ( | const GUTF8String & | msgID, | |
GUTF8String & | message_text, | |||
GUTF8String & | message_number | |||
) | const [protected] |
Definition at line 297 of file DjVuMessageLite.cpp.
static GNativeString DjVuMessageLite::LookUpNative | ( | const GUTF8String & | MessageList | ) | [inline, static] |
Same as Lookup, but returns the a multibyte character string in the current locale.
Reimplemented in DjVuMessage.
Definition at line 184 of file DjVuMessageLite.h.
GUTF8String DjVuMessageLite::LookUpSingle | ( | const GUTF8String & | Single_Message | ) | const [protected] |
Definition at line 234 of file DjVuMessageLite.cpp.
static GUTF8String DjVuMessageLite::LookUpUTF8 | ( | const GUTF8String & | MessageList | ) | [inline, static] |
void DjVuMessageLite::perror | ( | const GUTF8String & | MessageList | ) | [static] |
This is a simple alias to the above class, but does an fprintf to stderr.
Reimplemented in DjVuMessage.
Definition at line 178 of file DjVuMessageLite.cpp.
static const DjVuMessageLite& DjVuMessageLite::real_create | ( | void | ) | [static, protected] |
Creates a DjVuMessage class.
Member Data Documentation
const DjVuMessageLite &(* DjVuMessageLite::create)(void) | ( | void | ) | [static] |
GUTF8String DjVuMessageLite::errors [protected] |
Definition at line 156 of file DjVuMessageLite.h.
GMap<GUTF8String,GP<lt_XMLTags> > DjVuMessageLite::Map [protected] |
Definition at line 155 of file DjVuMessageLite.h.
The documentation for this class was generated from the following files: