Wt 3.1.10
Public Member Functions
Wt::WLocalizedStrings Class Reference

An abstract class that provides support for localized strings. More...

#include <Wt/WLocalizedStrings>

Inheritance diagram for Wt::WLocalizedStrings:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~WLocalizedStrings ()
 Destructor.
virtual void refresh ()
 Rereads the message resources.
virtual void hibernate ()
 Purges memory resources, if possible.
virtual bool resolveKey (const std::string &key, std::string &result)=0
 Resolves a key in the current locale.
virtual bool resolvePluralKey (const std::string &key, std::string &result,::uint64_t amount)
 Resolves the plural form of a key in the current locale.

Detailed Description

An abstract class that provides support for localized strings.

This abstract class provides the content to localized WStrings, by resolving the key to a string using the current application locale.

See also:
WString::tr(), WApplication::setLocalizedStrings()

Member Function Documentation

void Wt::WLocalizedStrings::hibernate ( ) [virtual]

Purges memory resources, if possible.

This is called afer event handling, and is an opportunity to conserve memory inbetween events, by freeing memory used for cached key/value bindings, if applicable.

The default implementation does nothing.

Reimplemented in Wt::WCombinedLocalizedStrings, and Wt::WMessageResourceBundle.

void Wt::WLocalizedStrings::refresh ( ) [virtual]

Rereads the message resources.

Purge any cached key/values, if applicable.

The default implementation does nothing.

Reimplemented in Wt::WCombinedLocalizedStrings, and Wt::WMessageResourceBundle.

virtual bool Wt::WLocalizedStrings::resolveKey ( const std::string &  key,
std::string &  result 
) [pure virtual]

Resolves a key in the current locale.

This method is used by WString to obtain the UTF8 value corresponding to a key in the current locale.

Returns true if the key could be resolved. The value is written in result, encoded using UTF8.

See also:
WApplication::locale(), WString::tr()

Implemented in Wt::WCombinedLocalizedStrings, and Wt::WMessageResourceBundle.

bool Wt::WLocalizedStrings::resolvePluralKey ( const std::string &  key,
std::string &  result,
::uint64_t  amount 
) [virtual]

Resolves the plural form of a key in the current locale.

This method is used by WString to obtain the UTF8 value corresponding to a key in the current locale, taking into account the possibility of multiple plural forms, and chosing the right plural form based on the amount passed.

Throws a std::logic_error if the underlying implementation does not provide support for plural internationalized strings.

Returns true if the key could be resolved. The value is written in result, encoded as UTF8.

See also:
WApplication::locale(), WString::trn()

Reimplemented in Wt::WCombinedLocalizedStrings, and Wt::WMessageResourceBundle.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator

Generated on Mon Nov 14 2011 for the C++ Web Toolkit (Wt) by doxygen 1.7.4