Does not inherit
#include rwsf/core/LocalizedMessage.h
Class used by localized exceptions to contain the exception message string and an identifier specifying a unique value represented with the message
Messages are obtained the messages.cpp file within the constructors using MessageCatalog::getLocalizedMessage() Therefore, the constructor argument must match the id of an existing message within the messages.cpp file (which is created at compile time from the messages.xml file)
Note
C-string functions are used instead of std::string functions because:
To avoid the chance that an exception will be thrown, possibly while creating an exception. When processing an exception, we don't want it to be superceded by another exception.
Because std::exception returns a char*, we're maintaining consistency with the eventual interface that will be invoked by the user.
Using std::string could require the use of try-catch blocks, which aren't necessarily cheap. Even if they aren't invoked (an exception isn't thrown), there is still a cost associated with setting up the necessary control structure. (One anecdotal estimate indicated that about 130 instructions are required for a simple try/catch block.)
std::string doesn't provide protection against SIGSEGV. If a string isn't null terminated, it's just as likely to create problems when constructing the std::string as when calling any of the C-string functions.
LocalizedMessage(const MessageCatalogId & id);
Construct a localized message for the given identifier by using the global MessageCatalogManager.
std::string getIdentifier() const;
Returns the identifier used to retrieve this message.
std::string getMessage() const;
Returns the string associated with this LocalizedMessage.
void replace(const std::string & second);
Replace occurrences of next index with given value second.
void replace(char second);
Replace occurrences of next index with given value second.
void replace(unsigned char second);
Replace occurrences of next index with given value second.
void replace(int second);
Replace occurrences of next index with given value second.
void replace(unsigned int second);
Replace occurrences of next index with given value second.
void replace(short second);
Replace occurrences of next index with given value second.
void replace(unsigned short second);
Replace occurrences of next index with given value second.
void replace(long second);
Replace occurrences of next index with given value second.
void replace(unsigned long second);
Replace occurrences of next index with given value second.
void replace(long long second);
Replace occurrences of next index with given value second.
void replace(unsigned long long second);
Replace occurrences of next index with given value second.
void replace(float second);
Replace occurrences of next index with given value second.
void replace(double second);
Replace occurrences of next index with given value second.
void replace(long double second);
Replace occurrences of next index with given value second.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.