LanguageTag Class Reference
#include <LanguageTag.h>
Public Member Functions
LanguageTag () LanguageTag (const String &languageTagString) LanguageTag (const LanguageTag &languageTag) ~LanguageTag () LanguageTag & operator= (const LanguageTag &languageTag) String getLanguage () const String getCountry () const String getVariant () const String toString () const Boolean operator== (const LanguageTag &languageTag) const Boolean operator!= (const LanguageTag &languageTag) const Detailed Description
This class specifies a language in a standard form (based on RFC 3066), including the special language range "*". Note: This class may be extended to support RFC 3066bis in the future.
Constructor & Destructor Documentation
Constructs an uninitialized LanguageTag object. A method invocation on an uninitialized LanguageTag object will result in the throwing of an UninitializedObjectException. An uninitialized object may be converted into an initialized object only by using the assignment operator with an initialized object.
LanguageTag::LanguageTag ( const String & languageTagString ) Constructs a LanguageTag object from a language tag String. The syntax of the language tag String is validated, but the subtags are not verified to be values registered with ISO or IANA.
- Parameters:
languageTagString A String containing a language tag (for example, "en-US").
LanguageTag::LanguageTag ( const LanguageTag & languageTag ) Copy constructor.
- Parameters:
languageTag The LanguageTag object to copy. Destructor.
Member Function Documentation
String LanguageTag::getCountry ( ) const Gets the country code from the second subtag, if present.
- Returns:
- A String containing the country code for this LanguageTag object if the primary subtag is two or three characters in length and the second subtag is two characters in length, an empty String otherwise.
- Exceptions:
UninitializedObjectException if the LanguageTag has not been initialized.
String LanguageTag::getLanguage ( ) const Gets the language value, if present.
- Returns:
- A String containing the language value for this LanguageTag object if the primary subtag is two or three characters in length, an empty String otherwise.
- Exceptions:
UninitializedObjectException if the LanguageTag has not been initialized.
String LanguageTag::getVariant ( ) const Gets the language variant, if applicable. The language variant includes all the subtags after the country code (if present) or language value (if present).
- Returns:
- A String containing the language variant for this LanguageTag object if the primary subtag is two or three characters in length, an empty String otherwise.
- Exceptions:
UninitializedObjectException if the LanguageTag has not been initialized.
Boolean LanguageTag::operator!= ( const LanguageTag & languageTag ) const Tests LanguageTag objects for inequality. Comparisons are case-insensitive. Distinct but equivalent language tags are not considered equal. Language range matching is not performed.
- Parameters:
languageTag A LanguageTag object to be compared.
- Returns:
- True if the language tags differ in more than just case, false otherwise.
- Exceptions:
UninitializedObjectException if either of the LanguageTags has not been initialized.
LanguageTag& LanguageTag::operator= ( const LanguageTag & languageTag ) Assignment operator.
- Parameters:
languageTag The LanguageTag object to copy.
Boolean LanguageTag::operator== ( const LanguageTag & languageTag ) const Tests LanguageTag objects for equality. Comparisons are case-insensitive. Distinct but equivalent language tags are not considered equal. Language range matching is not performed.
- Parameters:
languageTag A LanguageTag object to be compared.
- Returns:
- True if the language tags differ only in case, false otherwise.
- Exceptions:
UninitializedObjectException if either of the LanguageTags has not been initialized.
String LanguageTag::toString ( ) const Returns a String representation of the language tag.
- Returns:
- A String representing the LanguageTag object in RFC 3066 syntax (for example, "language-country-variant").
- Exceptions:
UninitializedObjectException if the LanguageTag has not been initialized.
The documentation for this class was generated from the following file:
- /var/tmp/tog-pegasus-2.9.0-8m.mo8/pegasus/src/Pegasus/Common/LanguageTag.h