std::moneypunct<CharT,International>:: positive_sign, do_positive_sign, negative_sign, do_negative_sign
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
|
moneypunct::positive_sign
moneypunct::do_positive_sign
moneypunct::negative_sign
moneypunct::do_negative_sign
|
||||
|
헤더 파일에 정의됨
<locale>
|
||
|
public
:
string_type positive_sign ( ) const ; |
(1) | |
|
public
:
string_type negative_sign ( ) const ; |
(2) | |
|
protected
:
virtual string_type do_positive_sign ( ) const ; |
(3) | |
|
protected
:
virtual string_type do_negative_sign ( ) const ; |
(4) | |
do_positive_sign
멤버 함수를 호출합니다.
do_negative_sign
멤버 함수를 호출합니다.
반환된 문자열의 첫 번째 문자만이 pos_format() / neg_format() 에서 sign 값으로 표시된 위치에 나타납니다. 나머지 문자들은 통화 문자열의 나머지 부분 뒤에 나타납니다.
특히, negative_sign이 "-" 인 경우 형식은 "-1.23 €" 와 같이 표시될 수 있으며, negative_sign이 "()" 인 경우에는 "(1.23 €)" 와 같이 표시됩니다.
반환값
양수 또는 음수 부호로 사용될 문자들을 담고 있는
string_type
타입의 문자열입니다.
예제
#include <iomanip> #include <iostream> #include <locale> struct my_punct : std::moneypunct_byname<char, false> { my_punct(const char* name) : moneypunct_byname(name) {} string_type do_negative_sign() const { return "()"; } }; int main() { std::locale loc("de_DE.utf8"); std::cout.imbue(loc); std::cout << loc.name() << " negative sign is '" << std::use_facet<std::moneypunct<char>>(loc).negative_sign() << "' for example: " << std::showbase << std::put_money(-1234) << '\n'; std::locale loc2("ms_MY.utf8"); std::cout.imbue(loc2); std::cout << loc2.name() << " negative sign is '" << std::use_facet<std::moneypunct<char>>(loc2).negative_sign() << "' for example: " << std::put_money(-1234) << '\n'; std::cout.imbue(std::locale(std::cout.getloc(), new my_punct("de_DE.utf8"))); std::cout << "de_DE.utf8 with negative_sign set to \"()\": " << std::put_money(-1234) << '\n'; }
출력:
de_DE.utf8 negative sign is '-' for example: -12,34 € ms_MY.utf8 negative sign is '()' for example: (RM12.34) de_DE.utf8 with negative_sign set to "()": (12,34 €)
참고 항목
|
[virtual]
|
통화 값에 대한 서식 패턴을 제공합니다
(가상 protected 멤버 함수) |