2016-12-12 4 views
0

ほとんどのlocaleconv()lconv ::フィールドのstd :: localeにマッピングがあることに気付きました。たとえば:std :: localeにはlconv :: p_cs_precedesと同等の機能はありませんか?

char *decimal_point;  // LC_NUMERIC, std::numpunct::decimal_point() 
char *thousands_sep;  // LC_NUMERIC, std::numpunct::thousands_sep() 
char *grouping;    // LC_NUMERIC, std::numpunct::grouping() 

char *int_curr_symbol;  // LC_MONETARY, std::moneypunct<,true>::curr_symbol() 
char *currency_symbol;  // LC_MONETARY, std::moneypunct::curr_symbol() 
char *mon_decimal_point; // LC_MONETARY, std::moneypunct::decimal_point() 
char *mon_thousands_sep; // LC_MONETARY, std::moneypunct::thousands_sep() 
char *mon_grouping;   // LC_MONETARY, std::moneypunct::grouping() 
char *positive_sign;  // LC_MONETARY, std::moneypunct::positive_sign() 
char *negative_sign;  // LC_MONETARY, std::moneypunct::negative_sign() 
char int_frac_digits;  // LC_MONETARY, std::moneypunct<,true>::curr_symbol() 
char frac_digits;   // LC_MONETARY, std::moneypunct::frac_digits() 

は、しかし、いくつかのフィールドは、私たちは特にC.に得ることができるよう、ロケールから同じ情報を得るためのC++のメカニズムを見ていない、私は取得の道が表示されません次のメンバーへの均等に:私はC++たとえば(簡単に移植するCを作るために同等のインターフェースのためのユースケースを想像するので、これらは、C++インタフェースから取り残された理由

char p_cs_precedes;   // LC_MONETARY, 1 if currency_symbol is placed before non-negative monetary value, 0 if after 
char p_sep_by_space;  // LC_MONETARY, indicates the separation of currency_symbol, positive_sign, and the non-negative monetary value 
char n_cs_precedes;   // LC_MONETARY, 1 if currency_symbol is placed before negative value, 0 if after 
char n_sep_by_space;  // LC_MONETARY, indicates the separation of currency_symbol, negative_sign, and the negative monetary value 
char p_sign_posn;   // LC_MONETARY, indicates the position of positive_sign in a non-negative monetary value 
char n_sign_posn;   // LC_MONETARY, Value indicating the position of the negative_sign for a negative formatted monetary quantity. 

私は、好奇心スレッド単位のロケールを使用することができます。これはC言語で移植可能ではありませんが、C++でも可能です)。

答えて

0

ドキュメントを見ているときに、moneypunct :: pos_pattern()と:: neg_pattern()関数が欠けていました。これらは、p_cs_precedes = 1のようなフィールドをエンコードします。

{..., symbol, ..., value, ...}