Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

DjVuMessageLite Class Reference

#include <DjVuMessageLite.h>

Inheritance diagram for DjVuMessageLite:


List of all members.

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:

&#10; [line feed] &#09; [horizontal tab] ' [single quote] &#34; [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 152 of file DjVuMessageLite.h.

Public Member Functions

int get_count (void) const
GUTF8String LookUp (const GUTF8String &MessageList) const
 Lookup the relavent string and parse the message.
 ~DjVuMessageLite ()

Static Public Member Functions

static void AddByteStreamLater (const GP< ByteStream > &bs)
static const DjVuMessageLitecreate_lite (void)
 Creates this class specifically.
static GNativeString LookUpNative (const GUTF8String &MessageList)
static GUTF8String LookUpUTF8 (const GUTF8String &MessageList)
static void perror (const GUTF8String &MessageList)
 This is a simple alias to the above class, but does an fprintf to stderr.

Static Public Attributes

static const DjVuMessageLite &(* create )(void)
 Creates a DjVuMessage class.

Protected Member Functions

void AddByteStream (const GP< ByteStream > &bs)
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 DjVuMessageLitereal_create (void)
 Creates a DjVuMessage class.

Protected Attributes

volatile int count
 The reference counter.
GUTF8String errors
GMap< GUTF8String, GP
< lt_XMLTags > > 

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index