Archived:Open C++ - 'id' member variable of facet class cannot be accessed directly (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The id member variable of a facet class cannot be accessed directly in Open C++. Instead, it has to be accessed via the GetFacetLocaleId() interface.

Article Metadata
Platform(s): S60 3rd Edition
S60 3rd Edition, FP1 and FP2
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Created: User:Technical writer 1 (12 Jun 2008)
Last edited: hamishwillee (19 Jun 2012)


The following code snippet demonstrates how to use locale::id when writing an application on top of the Standard Template Library (STL).

Declare a static method GetFacetLocaleId() instead of the member variable id, when defining a class which is inherited from class locale::facet.

  // b_facet.h 
class base_facet : public locale::facet
static locale::id& GetFacetLocaleId(); // in place of static locale::id

In the source file, define the method GetFacetLocaleId():

// b_facet.cpp
locale::id base_facet_id;
locale::id& base_facet::GetFacetLocaleId()
return base_facet_id;
This page was last modified on 19 June 2012, at 07:57.
23 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.