SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches

Exception class thrown by many methods in the Internationalization Module. More...

#include <rw/i18n/RWUException.h>

Inheritance diagram for RWUException:
RWxmsg

Public Member Functions

 RWUException (const char *message, RWUStatusCode code=RWUNoError)
 
 RWUException (RWUStatusCode code)
 
RWUStatusCode getStatus () const
 
- Public Member Functions inherited from RWxmsg
 RWxmsg (const char *msg)
 
 RWxmsg (const RWxmsg &msg)
 
 RWxmsg (RWxmsg &&msg)
 
RWxmsgoperator= (const RWxmsg &)
 
RWxmsgoperator= (RWxmsg &&msg)
 
virtual void raise () const
 
void swap (RWxmsg &rhs)
 
virtual const char * why () const
 

Additional Inherited Members

- Protected Member Functions inherited from RWxmsg
 RWxmsg (const char *msg, bool doCopy)
 

Detailed Description

RWUException is thrown by many methods in the Internationalization Module. This class is a subclass of RWxmsg in the Essential Tools Module.

An RWUException instance contains a string message and an RWUStatusCode.

As with RWxmsg, the string message contains a textual description of the error, typically in English. The inherited why() method returns the message string contained in self. The RWUStatusCode of an RWUException identifies the type of the error. Member function getStatus() returns the RWUStatusCode.

Example
#include <rw/i18n/RWUCollationKey.h>
#include <rw/i18n/RWUException.h>
#include <iostream>
using std::cout;
using std::endl;
int main() {
// Attempt to use an invalid RWUCollationKey.
try {
RWUCollationKey invalidKey;
cout << invalidKey.getString() << endl;
// Catch the resulting exception.
} catch (const RWUException& e) {
cout << "Unable to obtain string from key: " << e.why() << endl;
}
return 0;
} // main
Stores preprocessed comparison information for a Unicode string to speed repeated string comparisons.
Definition RWUCollationKey.h:116
RWUString getString(void) const
Exception class thrown by many methods in the Internationalization Module.
Definition RWUException.h:70
virtual const char * why() const

Program output:

Unable to obtain string from key: invalid RWUCollationKey

Constructor & Destructor Documentation

◆ RWUException() [1/2]

RWUException::RWUException ( RWUStatusCode code)
inline

Constructs an RWUException from a given RWUStatusCode indicating the specific type of error encountered. The string message of the exception object is set to the name of the status code.

◆ RWUException() [2/2]

RWUException::RWUException ( const char * message,
RWUStatusCode code = RWUNoError )
inline

Constructs an RWUException from an RWUStatusCode and a string message. The RWUStatusCode indicates the specific type of error encountered, and the string message describes the error.

Member Function Documentation

◆ getStatus()

RWUStatusCode RWUException::getStatus ( ) const
inline

Returns the RWUStatusCode contained in self.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.