Archived:Open C++ - 'id' member variable of facet class cannot be accessed directly (Known Issue)
Archived: 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
Compatibility
Platform(s): S60 3rd Edition
S60 3rd Edition, FP1 and FP2
S60 3rd Edition, FP1 and FP2
Article
Created: User:Technical writer 1
(12 Jun 2008)
Last edited: hamishwillee
(19 Jun 2012)
Solution
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
{
public:
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;
}


(no comments yet)