libstdc++/5499: True name and named locales

paolo@gcc.gnu.org paolo@gcc.gnu.org
Sun Jan 27 07:39:00 GMT 2002


Synopsis: True name and named locales

State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Sun Jan 27 07:39:32 2002
State-Changed-Why:
    Confirmed.
    It looks like this is not implemented at all: where the
    string literals "wahr" and "falsch" should be stored?!?
    For the time being, we can modify the facet by hand:
    #include <iostream>
    using namespace std;
    
    template <class charT>                                         
    class change_bool_names
      : public numpunct_byname<charT>                            
    {
    public:
      typedef basic_string<charT> string_type;
      explicit change_bool_names (const char* name,                
        const charT* t, const charT* f, size_t refs=0)
        : numpunct_byname<charT> (name,refs),
          true_string(t), false_string(f) { }
    protected:
      string_type do_truename () const { return true_string; }     
      string_type do_falsename () const { return false_string; }
    private:
      string_type true_string, false_string;
    };
    
    
    int main(int argc, char** argv)
    {
      locale loc(locale("de_DE"),                                 
        new change_bool_names<char>("de_DE","Ja.","Nein."));   
      cout.imbue(loc);                                            
      cout << "Argumente vorhanden? "  
             << boolalpha << (argc > 1) << endl;                    
    }

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5499



More information about the Gcc-prs mailing list