Small Locale Fixes #2, Revision 1 25 Jan 95 --------------------- X3J16/94-0214R1 by Nathan Myers, myersn@roguewave.com WG21/N0601R1 Rogue Wave Software 1. Extract common name definitions from class templates to base classes As in the case of ctype_base and ios_base, it is useful to users for constant and type names to be available from a non-parameterized base class. As members of a template class their types were not compatible with entities of the same name but instantiated with different template parameters. The following new locale classes are thus recommended, in addition to ctype_base: struct codecvt_base { enum result { ok, partial, error }; }; struct time_base { enum dateorder { no_order, dmy, mdy, ymd, ydm }; }; struct money_base { enum part { symbol = '$', sign = '=', space = ' ', value = 'v', none = 0 }; struct pattern { char field[4]; }; }; struct messages_base { typedef THE_POSIX_CATALOG_IDENTIFIER_TYPE catalog; }; These are inherited by, respectively, codecvt, time_get, moneypunct, and messages facets. Also: I recommend that ctype_base be simplified, eliminating its constructor and destructor. All these structs are inherited as "mixins" by their derived classes, in addition to deriving directly from locale::facet. These names are all used already by locale facets, but they are declared within the templates, where they are relatively inaccessible to users. 2. Change names of enumerated constants to lower case. Using upper case names exposes names to Cpp mischief; also, other library components define their constant names in lower case. I recommend changing the names as follows: ctype_base::space ctype_base::lower ctype_base::alnum ctype_base::print ctype_base::alpha ctype_base::graph ctype_base::cntrl ctype_base::digit ctype_base::upper ctype_base::xdigit codecvt_base::ok codecvt::partial codecvt::error time_base::no_order time_base::dmy time_base::mdy time_base::ymd time_base::ydm money_base::symbol money_base::sign money_base::space money_base::value money_base::none messages_base::catalog Small Locale Fixes #2, Revision 1 25 Jan 95 page 2 of 2 --------------------- 94-0214R1/N0601R1 3. Provide names for POSIX locale categories The values used to name POSIX categories, previously described as got from the standard header file , represent a backward compatibility problem for traditional implementations. While it is intended that these constants may by bitwise-or'd together to represent a set of categories, most C implementations define their LC_* constants in a way that does not permit this usage. Therefore, I recommend we provide a set of bitmask constants specified as such: locale::collate locale::monetary locale::time locale::ctype locale::numeric locale::messages locale::all = collate | ctype | monetary | numeric | time | messages and in addition: locale::none = 0 A footnote should be added to suggest that the values assigned might best be chosen so as not to interfere with those used for the LC_* values from , so that an implementation could accept a value from either source to specify a category.