HydraExpress 4.6 |
HydraExpress C++ API Reference Guide |
|
Creates a snapshot of a locale by querying the program's environment to determine the formatting conventions in effect at the moment of instantiation. More...
#include <rwsf/core/LocaleSnapshot.h>
Public Member Functions | |
virtual const std::string & | locale_name () const |
virtual const std::string & | decimal_point () const |
virtual const std::string & | thousands_sep () const |
virtual const std::string & | grouping () const |
virtual const std::string & | int_curr_symbol () const |
virtual const std::string & | currency_symbol () const |
virtual const std::string & | mon_decimal_point () const |
virtual const std::string & | mon_thousands_sep () const |
virtual const std::string & | mon_grouping () const |
virtual const std::string & | positive_sign () const |
virtual const std::string & | negative_sign () const |
virtual char | int_frac_digits () const |
virtual char | frac_digits () const |
virtual char | p_cs_precedes () const |
virtual char | p_sep_by_space () const |
virtual char | n_cs_precedes () const |
virtual char | n_sep_by_space () const |
virtual char | p_sign_posn () const |
virtual char | n_sign_posn () const |
LocaleSnapshot (const char *localeName=0) |
The class rwsf::LocaleSnapshot implements the rwsf::Locale interface using Standard C Library facilities. To use it, the program creates an rwsf::LocaleSnapshot instance. The constructor of the instance queries the program's environment (using Standard C Library functions such as localeconv()
, strftime()
, and, if available, vendor specific library functions) to determine the formatting conventions in effect at the moment of instantiation. When done, the locale can then be switched and another instance of rwsf::LocaleSnapshot created.
By creating multiple instances of rwsf::LocaleSnapshot, your program can have more than one locale active at the same time, something that is difficult to do with the Standard C Library facilities.
Class rwsf::LocaleSnapshot contains a set of public data members initialized by its constructor with information extracted from its execution environment.
For a description of the static members of the rwsf::Locale interface that operate on objects of type rwsf::LocaleSnapshot, see the rwsf::Locale class description.
For more information on using locales, see the chapter on internationalization in the Web Service Development Guide.
rwsf::LocaleSnapshot::LocaleSnapshot | ( | const char * | localeName = 0 |
) |
Constructs an rwsf::Locale object by extracting formats from the global locale environment. It uses the Standard C Library function setlocale()
to set the named locale, and then restores the previous global locale after formats have been extracted. If localeName is 0, it uses the current locale. The most useful locale name is the empty string, "", which is a synonym for the user's chosen locale (usually specified by the environment variable LANG
).
virtual const std::string& rwsf::LocaleSnapshot::currency_symbol | ( | ) | const [virtual] |
Returns a string to use as the currency symbol for this locale.
Implements rwsf::Locale.
virtual const std::string& rwsf::LocaleSnapshot::decimal_point | ( | ) | const [virtual] |
Returns a string to use as the numerical decimal separator.
Implements rwsf::Locale.
virtual char rwsf::LocaleSnapshot::frac_digits | ( | ) | const [virtual] |
Returns the number of local fractional digits.
Implements rwsf::Locale.
virtual const std::string& rwsf::LocaleSnapshot::grouping | ( | ) | const [virtual] |
Returns a string identifying the number of digits to be included in a numerical group. A group is simply the digits between adjacent thousands separators.
Each character of the string is an integer that specifies the number of digits in a group, starting with the right most group.
CHAR_MAX
, no further grouping is to be performed. Implements rwsf::Locale.
virtual const std::string& rwsf::LocaleSnapshot::int_curr_symbol | ( | ) | const [virtual] |
Returns a string to use as the international currency symbol.
Implements rwsf::Locale.
virtual char rwsf::LocaleSnapshot::int_frac_digits | ( | ) | const [virtual] |
Returns the number of international fractional digits.
Implements rwsf::Locale.
virtual const std::string& rwsf::LocaleSnapshot::locale_name | ( | ) | const [virtual] |
Returns the name of the encapsulated std::locale.
Implements rwsf::Locale.
virtual const std::string& rwsf::LocaleSnapshot::mon_decimal_point | ( | ) | const [virtual] |
Returns a string to use as the monetary decimal separator.
Implements rwsf::Locale.
virtual const std::string& rwsf::LocaleSnapshot::mon_grouping | ( | ) | const [virtual] |
Returns a string identifying the number of digits to be included in a numerical group. A group is simply the digits between adjacent thousands separators.
Each character of the string is an integer that specifies the number of digits in a group, starting with the right most group.
CHAR_MAX
, no further grouping is to be performed. Implements rwsf::Locale.
virtual const std::string& rwsf::LocaleSnapshot::mon_thousands_sep | ( | ) | const [virtual] |
Returns a string to use as the monetary thousands separator.
Implements rwsf::Locale.
virtual char rwsf::LocaleSnapshot::n_cs_precedes | ( | ) | const [virtual] |
Returns 1
if the return from currency_symbol() precedes a negative value, or 0
if it succeeds a negative value.
Implements rwsf::Locale.
virtual char rwsf::LocaleSnapshot::n_sep_by_space | ( | ) | const [virtual] |
Returns 1
if the return from currency_symbol() must be separated by a space
from a negative value, or 0
if no space is required.
Implements rwsf::Locale.
virtual char rwsf::LocaleSnapshot::n_sign_posn | ( | ) | const [virtual] |
Returns one of the following values, depending on the local currency system's requirements (for negative quantities):
0
Parentheses surround both the quantity and the return from currency_symbol().1
The string returned by negative_sign() precedes both the quantity and the return from currency_symbol().2
The string returned by negative_sign() succeeds both the quantity and the return from currency_symbol().3
The string returned by negative_sign() immediately precedes the return from currency_symbol().4
The string returned by negative_sign() immediately succeeds the return from currency_symbol(). Implements rwsf::Locale.
virtual const std::string& rwsf::LocaleSnapshot::negative_sign | ( | ) | const [virtual] |
Returns the string to use as the negative sign.
Implements rwsf::Locale.
virtual char rwsf::LocaleSnapshot::p_cs_precedes | ( | ) | const [virtual] |
Returns 1
if the return from currency_symbol() precedes a positive value, or 0
if it succeeds a positive value.
Implements rwsf::Locale.
virtual char rwsf::LocaleSnapshot::p_sep_by_space | ( | ) | const [virtual] |
Returns 1
if the return from currency_symbol() must be separated by a space
from a positive value, or 0
if no space is required.
Implements rwsf::Locale.
virtual char rwsf::LocaleSnapshot::p_sign_posn | ( | ) | const [virtual] |
Returns one of the following values, depending on the local currency system's requirements (for positive quantities):
0
Parentheses surround both the quantity and the return from currency_symbol().1
The string returned by positive_sign() precedes both the quantity and the return from currency_symbol().2
The string returned by positive_sign() succeeds both the quantity and the return from currency_symbol().3
The string returned by positive_sign() immediately precedes the return from currency_symbol().4
The string returned by positive_sign() immediately succeeds the return from currency_symbol(). Implements rwsf::Locale.
virtual const std::string& rwsf::LocaleSnapshot::positive_sign | ( | ) | const [virtual] |
Returns the string to use as the positive sign.
Implements rwsf::Locale.
virtual const std::string& rwsf::LocaleSnapshot::thousands_sep | ( | ) | const [virtual] |
Returns a string to use as the numerical thousands separator.
Implements rwsf::Locale.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.