A localized string resolver that bundles multiple string resolvers. More...
#include <Wt/WCombinedLocalizedStrings>
Inherits Wt::WLocalizedStrings.
Public Member Functions | |
WCombinedLocalizedStrings () | |
Constructor. | |
void | add (WLocalizedStrings *stringResolver) |
Adds a string resolver. | |
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) |
Resolves a key in the current locale. |
A localized string resolver that bundles multiple string resolvers.
This class implements the localized strings interface and delegates WString::tr() string resolution to one or more string resolvers. You will typically use this class if you want to combine different methods of string resolution (e.g. some from files, and other strings using a database).
void Wt::WCombinedLocalizedStrings::add | ( | WLocalizedStrings * | stringResolver | ) |
Adds a string resolver.
resolveKey() will consult each string resolver in the order they have been added.
void Wt::WCombinedLocalizedStrings::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 from Wt::WLocalizedStrings.
void Wt::WCombinedLocalizedStrings::refresh | ( | ) | [virtual] |
Rereads the message resources.
Purge any cached key/values, if applicable.
The default implementation does nothing.
Reimplemented from Wt::WLocalizedStrings.
bool Wt::WCombinedLocalizedStrings::resolveKey | ( | const std::string & | key, | |
std::string & | result | |||
) | [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.
Implements Wt::WLocalizedStrings.