Xavax C++ Library | Class Index FAQ Overview |
Constructor Summary |
MessageCatalog(const char* name,
const MessageSetData* setData, UInt16 nSets)
Construct a MessageCatalog object. |
Method Summary | |
const char*
|
defaultText(UInt16 setNum,
UInt16 msgNum)
Return the default text for a message. |
UInt16
|
maxSets() const
Return the maximum set capacity for this catalog. |
const char*
|
name() const
Return the filename for this message catalog. |
MessageSet*
|
set(UInt16) const
Return a pointer to the specified message set. |
UInt16
|
setCount() const
Return the number of message sets in this catalog. |
bool
|
open()
Open the message catalog. |
const char*
|
text(UInt16 setNum,
UInt16 msgNum)
Return the text for a message. |
Related Classes | |
Formatter, Message, MessageSet |
Constructor Detail |
MessageCatalog(const char* name,
const MessageSetData* setData, UInt16 nSets)
setData
.
name
- the filename of the message catalog.setData
- an array of message set definitions.nSets
- the number of set definitions in setData.
Method Detail |
const char* defaultText(UInt16 setNum, UInt16 msgNum)
setNum
- the message set number.msgNum
- the message number.UInt16 maxSets() const
const char* name() const
bool open()
MsgCatOpenError
- if an error occurred opening the message catalog.
MsgCatReadError
- if an error occurred reading the message catalog.
MsgCatResourceException
- if sufficient resources were not available.
MessageSet* set(UInt16 setNum) const
setNum
.
setNum
- the message set number.UInt16 setCount() const
const char* text(UInt16 setNum, UInt16 msgNum)
setNum
- the message set number.msgNum
- the message number.
Example Code |
// // Copyright (c) 1997,2003 Phillip L. Harbison // All Rights Reserved // // Program Name: Test4 // Usage: // Test4 // Description: // This program tests the message catalog facility. // #include Headers_h #include Headers_h #include Cx_h #include MessageCatalog_h #include <stdlib.h> #include <iostream.h> // // Include the definitions created by the message editor. // #include "Test4Msg.h" int main(int argc, char **argv) { // // Create the message catalog using default data provided // by the message editor in Test4Msg.h and Test4Msg.C. // MessageCatalog* mcp = new MessageCatalog("./Test4.cat", Test4Catalog); try { // Open the message catalog. mcp->open(); const char *cp; // Output message 1 of set 1. cp = mcp->text(1, Set1Msg1); cout << cp << endl; // Output message 2 of set 1. cp = mcp->text(1, Set1Msg2); cout << cp << endl; // Output message 1 of set 2. cp = mcp->text(2, Set2Msg1); cout << cp << endl; // Output message 2 of set 2. cp = mcp->text(2, Set2Msg2); cout << cp << endl; } catch (Exception &e) { cerr << "Exception type: " << e.classRecord()->name() << endl; e.print(); } }
// // This file was created by the message editor and should not be edited. // Make any changes using the message editor and regenerate the file. // #ifndef _Test4Msg_h #define _Test4Msg_h typedef enum Test4Set1_e { Set1Msg1 = 1, Set1Msg2 = 2 } Test4Set1; typedef enum Test4Set2_e { Set2Msg1 = 1, Set2Msg2 = 2 } Test4Set2; extern MessageCatalogData Test4Catalog; #endif
// // This file was created by the message editor and should not be edited. // Make any changes using the message editor and regenerate the file. // #include Headers_h #include Headers_h #include Cx_h #include MessageCatalog_h #include "Test4Msg.h" MessageData Test4Set1Msgs[] = { { Set1Msg1, "## default ## Set 1 Test message 1." }, { Set1Msg2, "## default ## Set 1 Test message 2." } }; MessageData Test4Set2Msgs[] = { { Set2Msg1, "## default ## Set 2 Test message 1." }, { Set2Msg2, "## default ## Set 2 Test message 2." } }; MessageSetData Test4Sets[] = { { 1, Number(Test4Set1Msgs), Test4Set1Msgs }, { 2, Number(Test4Set2Msgs), Test4Set2Msgs } }; MessageCatalogData Test4Catalog = { Number(Test4Sets), Test4Sets };
Copyright © 2003 Xavax Inc. -- All Rights Reserved