Class: TLocale

Declaration: Localization.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

None.

Purpose:

TLocale is a lightweight object used for two primary purpose: 1) it collects items such as keyboard and number format associated with a geographic location, and 2) it is used as a key to look up localized presentation or names in archives. Objects in TLocale are stored and accessed via TLocaleItems (see description for TLocaleItem)

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

TLocale is a concrete class designed to be used directly.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TLocale::TLocale

  1. TLocale ()
  2. TLocale (const TLocale &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and by clients.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

At this time, the constructors initialize the locale hierarchy if it has not been done.

Member Function: TLocale::~TLocale

virtual ~ TLocale ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::GetRootLocale

  1. static TLocale GetRootLocale ()
  2. static void GetRootLocale (TLocale & rootLocale)

Interface Category:

API.

Purpose:

  1. Returns the root locale.
  2. Fills in the given locale with the root locale.

Calling Context:

  1. Called by clients.
  2. Called by clients.

Parameters:

Return Value:

  1. The root locale.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::GetCurrentLocale

  1. static TLocale GetCurrentLocale ()
  2. static void GetCurrentLocale (TLocale & locale)

Interface Category:

API.

Purpose:

  1. Returns the current locale.
  2. Fills in the given locale with the current locale.

Calling Context:

  1. Called by clients.
  2. Called by clients.

Parameters:

Return Value:

  1. The current locale.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::SetCurrentLocale

static void SetCurrentLocale (const TLocale& locale)

Interface Category:

API.

Purpose:

This static function sets the current locale to the specified locale.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::FindLocale

static bool FindLocale (const TLocalizableName& name, TLocale & locale)

Interface Category:

API.

Purpose:

Given the internal name of a locale, this static function attempts to retrieve the locale. If none can be found, returns an empty locale

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns true if a locale that matches the internal name is found.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::IsParentLocale

virtual bool IsParentLocale (const TLocale &locale) const

Interface Category:

API.

Purpose:

Used to determine if the argument is the parent locale for this object.

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns true if the argument is the parent locale of this object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::GetParentLocale

virtual void GetParentLocale (TLocale & locale) const

Interface Category:

API.

Purpose:

Returns the parent locale. If the locale has no parent, an empty locale is returned.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::SetParentLocale

virtual void SetParentLocale (const TLocale & locale)

Interface Category:

API.

Purpose:

Specifies the parent locale for this object.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::GetChildLocales

virtual void GetChildLocales (TCollectionOf < TLocale > & locales) const

Interface Category:

API.

Purpose:

Returns a collection of child locales for this locale. The caller can then create the appropriate collection class iterator to iterate over the children. This function can thus be used to traverse the locale hierarchy.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::IsValid

virtual bool IsValid () const

Interface Category:

API.

Purpose:

Determines if the locale is valid; that is, if it references an actual location.

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns true if the locale references a valid location.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::GetName

virtual void GetName (TLocalizableName & name) const

Interface Category:

API.

Purpose:

Returns the localizable name of this locale.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::SetName

virtual void SetName (const TLocalizableName & name)

Interface Category:

API.

Purpose:

Specifies the localizable name of this locale.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::operator=

TLocale & operator =(const TLocale &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called by clients.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::operator>>=

virtual TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::operator<<=

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::operator==

virtual bool operator ==(const TLocale &) const

Interface Category:

API.

Purpose:

Equality operator.

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns true if the objects are equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::operator!=

virtual bool operator != (const TLocale &) const

Interface Category:

API.

Purpose:

Inequality operator.

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns true if the objects are not equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Overrides inherited MCollectible function.

Calling Context:

Same as for base class.

Parameters:

Return Value:

The numeric value of the hash.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::ItemIsInherited

virtual bool ItemIsInherited (const TText & localeItemID) const

Interface Category:

API.

Purpose:

Queries whether a particular item in this locale is inherited from a parent locale.

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns true if this item is not defined in the current locale, but in a parent locale.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLocale::CreateLocaleItemIterator

virtual TLocaleItemIterator * CreateLocaleItemIterator () const

Interface Category:

API.

Purpose:

Creates an iterator that can be used to iterate through the contents of this locale.

Calling Context:

Called by clients.

Parameters:

Return Value:

A TLocaleItemIterator that can iterate through the contents of this locale.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.