Share via


moneypunct 클래스

클래스 템플릿은 통화 입력 필드 또는 통화 출력 필드를 나타내는 데 사용되는 CharType 형식의 시퀀스를 설명하는 로캘 패싯으로 사용할 수 있는 개체를 설명합니다. 템플릿 매개 변수 Intl이 true면 국제 규칙이 관찰됩니다.

구문

template <class CharType, bool Intl>
class moneypunct;

매개 변수

Chartype
문자를 인코딩하기 위해 프로그램 내 사용하는 형식

국제공항
국제 규약을 준수하는지 여부를 지정하는 플래그입니다.

설명

모든 로캘 패싯과 마찬가지로, 고정 개체 ID에는 초기값 0이 저장되어 있습니다. 저장된 값에 액세스를 처음 시도하면 id에 고유한 양수 값이 저장됩니다.

상수 정적 개체 intl에는 템플릿 매개 변수 Intl의 값이 저장됩니다.

생성자

생성자 Description
moneypunct moneypunct 형식의 개체 생성자입니다.

Typedef

형식 이름 설명
char_type 로캘에서 사용하는 문자를 설명하기 위해 사용하는 형식입니다.
string_type CharType 형식의 문자가 포함된 문자열을 설명하는 형식입니다.

멤버 함수

멤버 함수 설명
curr_symbol 통화 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.
decimal_point 소수점 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.
do_curr_symbol 통화 기호로 사용할 로캘별 요소 시퀀스를 반환하는 보호된 가상 멤버 함수입니다.
do_decimal_point 소수점 기호로 사용할 로캘별 요소 시퀀스를 반환하기 위해 호출하는 보호된 가상 멤버 함수입니다.
do_frac_digits 보호된 가상 멤버 함수가 소수점 오른쪽에 표시할 자릿수를 로캘별로 반환합니다.
do_grouping 보호된 가상 멤버 함수가 소수점 자리 왼쪽의 숫자를 그룹화하는 방법을 결정하는 로캘별 규칙을 반환합니다.
do_neg_format 음수 금액의 출력의 서식을 지정하기 위한 로캘별 규칙을 반환하기 위해 호출하는 보호된 가상 멤버 함수입니다.
do_negative_sign 음수 부호 기호로 사용할 로캘별 요소 시퀀스를 반환하기 위해 호출하는 보호된 가상 멤버 함수입니다.
do_pos_format 양수 금액의 출력의 서식을 지정하기 위한 로캘별 규칙을 반환하기 위해 호출하는 보호된 가상 멤버 함수입니다.
do_positive_sign 양수 부호 기호로 사용할 로캘별 요소 시퀀스를 반환하기 위해 호출하는 보호된 가상 멤버 함수입니다.
do_thousands_sep 1000 단위 구분 기호로 사용할 로캘별 요소 시퀀스를 반환하기 위해 호출하는 보호된 가상 멤버 함수입니다.
frac_digits 소수점 오른쪽에 표시할 자릿수를 로캘별로 반환합니다.
grouping 소수점 왼쪽의 숫자를 그룹화할 방법을 결정하기 위한 로캘별 규칙을 반환합니다.
neg_format 음수 금액의 출력의 서식을 지정하기 위한 로캘별 규칙을 반환합니다.
negative_sign 음수 부호 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.
pos_format 양수 금액의 출력의 서식을 지정하기 위한 로캘별 규칙을 반환합니다.
positive_sign 양수 부호 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.
thousands_sep 1000 단위 구분 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.

요구 사항

헤더:<로캘>

네임스페이스: std

moneypunct::char_type

로캘에서 사용하는 문자를 설명하기 위해 사용하는 형식입니다.

typedef CharType char_type;

설명

이 형식은 템플릿 매개 변수 CharType과 동일한 의미입니다.

moneypunct::curr_symbol

통화 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.

string_type curr_symbol() const;

Return Value

통화 기호를 포함하는 문자열입니다.

설명

구성원 함수는 do_curr_symbol을 반환합니다.

예시

// moneypunct_curr_symbol.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>
using namespace std;
int main( )
{
   locale loc( "german_germany" );

   const moneypunct < char, true > &mpunct = use_facet < moneypunct < char, true > >(loc);
   cout << loc.name( ) << " international currency symbol "<<  mpunct.curr_symbol( ) << endl;

   const moneypunct < char, false> &mpunct2 = use_facet < moneypunct < char, false> >(loc);
   cout << loc.name( ) << " domestic currency symbol "<<  mpunct2.curr_symbol( ) << endl;
};

moneypunct::d ecimal_point

소수점 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.

CharType decimal_point() const;

Return Value

소수점 기호로 사용할 로캘별 요소 시퀀스입니다.

설명

구성원 함수는 do_decimal_point를 반환합니다.

예시

// moneypunct_decimal_pt.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>
using namespace std;
int main( )
{
   locale loc("german_germany");

   const moneypunct < char, true > &mpunct = use_facet
      < moneypunct < char, true > >(loc);
   cout << loc.name( ) << " international decimal point "
        << mpunct.decimal_point( ) << endl;

   const moneypunct < char, false> &mpunct2 = use_facet
      < moneypunct < char, false> >(loc);
   cout << loc.name( ) << " domestic decimal point "
        << mpunct2.decimal_point( ) << endl;
}
German_Germany.1252 international decimal point ,
German_Germany.1252 domestic decimal point ,

moneypunct::d o_curr_symbol

통화 기호로 사용할 로캘별 요소 시퀀스를 반환하는 보호된 가상 멤버 함수입니다.

virtual string_type do_curr_symbol() const;

Return Value

소수점 기호로 사용할 로캘별 요소 시퀀스입니다.

예시

curr_symbol에 의해 가상 구성원 함수가 호출되는 curr_symbol의 예제를 참조하세요.

moneypunct::d o_decimal_point

소수점 기호통화 기호로 사용할 로캘별 요소 시퀀스를 반환하는 보호된 가상 구성원 함수입니다.

virtual CharType do_decimal_point() const;

Return Value

소수점 기호로 사용할 로캘별 요소 시퀀스입니다.

예시

decimal_point에 의해 가상 구성원 함수가 호출되는 decimal_point의 예제를 참조하세요.

moneypunct::d o_frac_digits

소수점 오른쪽에 표시할 자릿수를 로캘별로 반환하는 보호된 가상 구성원 함수입니다.

virtual int do_frac_digits() const;

Return Value

소수점 오른쪽에 표시할 로캘별 자릿수입니다.

예시

frac_digits에 의해 가상 구성원 함수가 호출되는 frac_digits의 예제를 참조하세요.

moneypunct::d o_grouping

소수점 자리 왼쪽의 숫자를 그룹화하는 방법을 결정하는 로캘별 규칙을 반환하는 보호된 가상 구성원 함수입니다.

virtual string do_grouping() const;

Return Value

소수점 왼쪽의 숫자를 그룹화할 방법을 결정하기 위한 로캘별 규칙입니다.

예시

가상 멤버 함수가 호출grouping되는 그룹화 예제를 참조하세요.

moneypunct::d o_neg_format

음수 금액의 출력의 서식을 지정하기 위한 로캘별 규칙을 반환하기 위해 호출하는 보호된 가상 멤버 함수입니다.

virtual pattern do_neg_format() const;

Return Value

보호된 가상 구성원 함수는 음수 값에 대해 통화 출력 필드를 생성하는 방법을 결정하기 위한 로캘별 규칙을 반환합니다. 4개의 요소 pattern::field 각각에는 다음 값이 있을 수 있습니다.

  • none 0개 이상의 공백과 일치하거나 아무 것도 생성하지 않습니다.

  • sign 양수 또는 음수 기호를 일치하거나 생성합니다.

  • space 0개 이상의 공백과 일치하거나 공백을 생성합니다.

  • symbol 통화 기호를 일치하거나 생성합니다.

  • value 통화 값을 일치하거나 생성합니다.

통화 출력 필드의 구성 요소가 생성되고 통화 입력 필드의 구성 요소가 이러한 요소가 표시되는 pattern::field순서대로 일치합니다. 각 값 sign, symbolvalue하나 none 또는 space 정확히 한 번 표시되어야 합니다. 값 none 이 먼저 표시되지 않아야 합니다. 값 space 이 첫 번째 또는 마지막에 표시되어서는 안됩니다. true이면 Intl 순서는 symbol, sign, none.value

반환의 moneypunct< CharType, Intl > 템플릿 버전입니다 {money_base::symbol, money_base::sign, money_base::value, money_base::none}.

예시

neg_format에 의해 가상 구성원 함수가 호출되는 neg_format의 예제를 참조하세요.

moneypunct::d o_negative_sign

음수 부호 기호로 사용할 로캘별 요소 시퀀스를 반환하기 위해 호출하는 보호된 가상 멤버 함수입니다.

virtual string_type do_negative_sign() const;

Return Value

음수 부호로 사용할 로캘별 요소 시퀀스입니다.

예시

negative_sign에 의해 가상 구성원 함수가 호출되는 negative_sign의 예제를 참조하세요.

moneypunct::d o_pos_format

양수 금액의 출력의 서식을 지정하기 위한 로캘별 규칙을 반환하기 위해 호출하는 보호된 가상 멤버 함수입니다.

virtual pattern do_pos_format() const;

Return Value

보호된 가상 구성원 함수는 양수 금액에 대해 통화 출력 필드를 생성하는 방법을 결정하기 위한 로캘별 규칙을 반환합니다. (통화 입력 필드의 구성 요소와 일치하는 방법도 결정합니다.) 인코딩은 do_neg_format 경우와 동일합니다.

반환의 moneypunct< CharType, Inputlterator > 템플릿 버전입니다 { money_base::symbol, money_base::sign, money_base::value, money_base::none }.

예시

pos_format에 의해 가상 구성원 함수가 호출되는 pos_format의 예제를 참조하세요.

moneypunct::d o_positive_sign

양수 부호로 사용할 로캘별 요소 시퀀스를 반환하는 보호된 가상 구성원 함수입니다.

virtual string_type do_positive_sign() const;

Return Value

양수 부호로 사용할 로캘별 요소 시퀀스입니다.

예시

positive_sign에 의해 가상 구성원 함수가 호출되는 positive_sign의 예제를 참조하세요.

moneypunct::d o_thousands_sep

소수점 왼쪽의 그룹 구분 기호로 사용할 로캘별 요소를 반환하는 보호된 가상 구성원 함수입니다.

virtual CharType do_thousands_sep() const;

Return Value

소스점 왼쪽의 그룹 구분 기호로 사용할 로캘별 요소입니다.

예시

thousands_sep에 의해 가상 구성원 함수가 호출되는 thousands_sep의 예제를 참조하세요.

moneypunct::frac_digits

소수점 오른쪽에 표시할 자릿수를 로캘별로 반환합니다.

int frac_digits() const;

Return Value

소수점 오른쪽에 표시할 로캘별 자릿수입니다.

설명

구성원 함수는 do_frac_digits를 반환합니다.

예시

// moneypunct_frac_digits.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>
using namespace std;
int main( )
{
   locale loc( "german_germany" );

   const moneypunct <char, true> &mpunct =
       use_facet <moneypunct <char, true> >(loc);
   for (unsigned int i = 0; i <mpunct.grouping( ).length( ); i++ )
   {
      cout << loc.name( ) << " international grouping:\n the "
           << i <<"th group to the left of the radix character "
           << "is of size " << (int)(mpunct.grouping ( )[i])
           << endl;
   }
   cout << loc.name( ) << " international frac_digits\n to the right"
        << " of the radix character: "
        << mpunct.frac_digits ( ) << endl << endl;

   const moneypunct <char, false> &mpunct2 =
       use_facet <moneypunct <char, false> >(loc);
   for (unsigned int i = 0; i <mpunct2.grouping( ).length( ); i++ )
   {
      cout << loc.name( ) << " domestic grouping:\n the "
           << i <<"th group to the left of the radix character "
           << "is of size " << (int)(mpunct2.grouping ( )[i])
           << endl;
   }
   cout << loc.name( ) << " domestic frac_digits\n to the right"
        << " of the radix character: "
        << mpunct2.frac_digits ( ) << endl << endl;
}
German_Germany.1252 international grouping:
the 0th group to the left of the radix character is of size 3
German_Germany.1252 international frac_digits
to the right of the radix character: 2

German_Germany.1252 domestic grouping:
the 0th group to the left of the radix character is of size 3
German_Germany.1252 domestic frac_digits
to the right of the radix character: 2

moneypunct::grouping

소수점 왼쪽의 숫자를 그룹화할 방법을 결정하기 위한 로캘별 규칙을 반환합니다.

string grouping() const;

Return Value

소수점 왼쪽의 숫자를 그룹화할 방법을 결정하기 위한 로캘별 규칙입니다.

설명

구성원 함수는 do_grouping을 반환합니다.

예시

// moneypunct_grouping.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>
using namespace std;
int main( )
{
   locale loc( "german_germany" );

   const moneypunct <char, true> &mpunct =
       use_facet <moneypunct <char, true> >( loc );
   for (unsigned int i = 0; i <mpunct.grouping( ).length( ); i++ )
   {
      cout << loc.name( ) << " international grouping:\n the "
           << i <<"th group to the left of the radix character "
           << "is of size " << (int)(mpunct.grouping ( )[i])
           << endl;
   }
   cout << loc.name( ) << " international frac_digits\n to the right"
        << " of the radix character: "
        << mpunct.frac_digits ( ) << endl << endl;

   const moneypunct <char, false> &mpunct2 =
       use_facet <moneypunct <char, false> >( loc );
   for (unsigned int i = 0; i <mpunct2.grouping( ).length( ); i++ )
   {
      cout << loc.name( ) << " domestic grouping:\n the "
           << i <<"th group to the left of the radix character "
           << "is of size " << (int)(mpunct2.grouping ( )[i])
           << endl;
   }
   cout << loc.name( ) << " domestic frac_digits\n to the right"
        << " of the radix character: "
        << mpunct2.frac_digits ( ) << endl << endl;
}
German_Germany.1252 international grouping:
the 0th group to the left of the radix character is of size 3
German_Germany.1252 international frac_digits
to the right of the radix character: 2

German_Germany.1252 domestic grouping:
the 0th group to the left of the radix character is of size 3
German_Germany.1252 domestic frac_digits
to the right of the radix character: 2

moneypunct::moneypunct

moneypunct 형식의 개체 생성자입니다.

explicit moneypunct(size_t _Refs = 0);

매개 변수

_심판
개체에 대한 메모리 관리의 유형을 지정하는 데 사용하는 정수 값입니다.

설명

_Refs 매개 변수 및 해당 중요도에 사용할 수 있는 값은 다음과 같습니다.

  • 0: 개체를 포함하는 로캘에 의해 개체의 수명이 관리됩니다.

  • 1: 개체의 수명을 수동으로 관리해야 합니다.

  • > 1: 이러한 값은 정의되지 않습니다.

소멸자는 보호되므로 직접적인 예제는 확인할 수 없습니다.

생성자는 locale::facet(_ Refs)를 통해 해당 기준 개체를 초기화합니다.

moneypunct::neg_format

음수 금액의 출력의 서식을 지정하기 위한 로캘별 규칙을 반환합니다.

pattern neg_format() const;

Return Value

음수 금액의 출력 서식을 지정하기 위한 로캘별 규칙입니다.

설명

구성원 함수는 do_neg_format을 반환합니다.

예시

// moneypunct_neg_format.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>

using namespace std;

int main( ) {
   locale loc( "german_germany" );

   const moneypunct <char, true> &mpunct =
      use_facet <moneypunct <char, true > >(loc);
   cout << loc.name( ) << " international negative number format: "
        << mpunct.neg_format( ).field[0]
        << mpunct.neg_format( ).field[1]
        << mpunct.neg_format( ).field[2]
        << mpunct.neg_format( ).field[3] << endl;

   const moneypunct <char, false> &mpunct2 =
      use_facet <moneypunct <char, false> >(loc);
   cout << loc.name( ) << " domestic negative number format: "
        << mpunct2.neg_format( ).field[0]
        << mpunct2.neg_format( ).field[1]
        << mpunct2.neg_format( ).field[2]
        << mpunct2.neg_format( ).field[3] << endl;
}

moneypunct::negative_sign

음수 부호 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.

string_type negative_sign() const;

Return Value

음수 부호 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.

설명

구성원 함수는 do_negative_sign을 반환합니다.

예시

// moneypunct_neg_sign.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>

using namespace std;

int main( )
{
   locale loc( "german_germany" );

   const moneypunct <char, true> &mpunct =
      use_facet <moneypunct <char, true> >(loc);
   cout << loc.name( ) << " international negative sign: "
        << mpunct.negative_sign( ) << endl;

   const moneypunct <char, false> &mpunct2 =
      use_facet <moneypunct <char, false> >(loc);
   cout << loc.name( ) << " domestic negative sign: "
        << mpunct2.negative_sign( ) << endl;

   locale loc2( "French" );

   const moneypunct <char, true> &mpunct3 =
      use_facet <moneypunct <char, true> >(loc2);
   cout << loc2.name( ) << " international negative sign: "
        << mpunct3.negative_sign( ) << endl;

   const moneypunct <char, false> &mpunct4 =
      use_facet <moneypunct <char, false> >(loc2);
   cout << loc2.name( ) << " domestic negative sign: "
        << mpunct4.negative_sign( ) << endl;
};
German_Germany.1252 international negative sign: -
German_Germany.1252 domestic negative sign: -
French_France.1252 international negative sign: -
French_France.1252 domestic negative sign: -

moneypunct::p os_format

양수 금액의 출력의 서식을 지정하기 위한 로캘별 규칙을 반환합니다.

pattern pos_format() const;

Return Value

양수 금액의 출력 서식을 지정하기 위한 로캘별 규칙입니다.

설명

구성원 함수는 do_pos_format을 반환합니다.

예시

// moneypunct_pos_format.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>

using namespace std;

int main() {
   locale loc( "german_germany" );

   const moneypunct <char, true> &mpunct =
      use_facet <moneypunct <char, true> >(loc);
   cout << loc.name( ) << " international positive number format: "
        << mpunct.pos_format( ).field[0]
        << mpunct.pos_format( ).field[1]
        << mpunct.pos_format( ).field[2]
        << mpunct.pos_format( ).field[3] << endl;

   const moneypunct <char, false> &mpunct2 =
      use_facet <moneypunct <char, false> >(loc);
   cout << loc.name( ) << " domestic positive number format: "
        << mpunct2.pos_format( ).field[0]
        << mpunct2.pos_format( ).field[1]
        << mpunct2.pos_format( ).field[2]
        << mpunct2.pos_format( ).field[3] << endl;
}

moneypunct::p ositive_sign

양수 부호 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.

string_type positive_sign() const;

Return Value

양수 부호 기호로 사용할 로캘별 요소 시퀀스입니다.

설명

구성원 함수는 do_positive_sign을 반환합니다.

예시

// moneypunct_pos_sign.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>

using namespace std;

int main( )
{
   locale loc( "german_germany" );

   const moneypunct <char, true> &mpunct =
      use_facet <moneypunct <char, true > >(loc);
   cout << loc.name( ) << " international positive sign:"
        << mpunct.positive_sign( ) << endl;

   const moneypunct <char, false> &mpunct2 =
      use_facet <moneypunct <char, false> >(loc);
   cout << loc.name( ) << " domestic positive sign:"
        << mpunct2.positive_sign( ) << endl;

   locale loc2( "French" );

   const moneypunct <char, true> &mpunct3 =
      use_facet <moneypunct <char, true> >(loc2);
   cout << loc2.name( ) << " international positive sign:"
        << mpunct3.positive_sign( ) << endl;

   const moneypunct <char, false> &mpunct4 =
      use_facet <moneypunct <char, false> >(loc2);
   cout << loc2.name( ) << " domestic positive sign:"
        << mpunct4.positive_sign( ) << endl;
};
German_Germany.1252 international positive sign:
German_Germany.1252 domestic positive sign:
French_France.1252 international positive sign:
French_France.1252 domestic positive sign:

moneypunct::string_type

CharType 형식의 문자가 포함된 문자열을 설명하는 형식입니다.

typedef basic_string<CharType, Traits, Allocator> string_type;

설명

이 형식은 개체가 문장 부호 시퀀스의 복사본을 저장할 수 있는 클래스 템플릿 basic_string 특수화를 설명합니다.

moneypunct::thousands_sep

1000 단위 구분 기호로 사용할 로캘별 요소 시퀀스를 반환합니다.

CharType thousands_sep() const;

Return Value

1000 단위 구분 기호로 사용할 로캘별 요소 시퀀스입니다.

설명

구성원 함수는 do_thousands_sep를 반환합니다.

예시

// moneypunct_thou_sep.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>
using namespace std;
int main( )
{
   locale loc( "german_germany" );

   const moneypunct <char, true> &mpunct =
       use_facet <moneypunct <char, true > >(loc);
   cout << loc.name( ) << " international thousands separator: "
        << mpunct.thousands_sep( ) << endl;

   const moneypunct <char, false> &mpunct2 =
      use_facet <moneypunct <char, false> >(loc);
   cout << loc.name( ) << " domestic thousands separator: "
        << mpunct2.thousands_sep( ) << endl << endl;

   locale loc2( "english_canada" );

   const moneypunct <char, true> &mpunct3 =
       use_facet <moneypunct <char, true> >(loc2);
   cout << loc2.name( ) << " international thousands separator: "
        << mpunct3.thousands_sep( ) << endl;

   const moneypunct <char, false> &mpunct4 =
      use_facet <moneypunct <char, false> >(loc2);
   cout << loc2.name( ) << " domestic thousands separator: "
        << mpunct4.thousands_sep( ) << endl;
}
German_Germany.1252 international thousands separator: .
German_Germany.1252 domestic thousands separator: .

English_Canada.1252 international thousands separator: ,
English_Canada.1252 domestic thousands separator: ,

참고 항목

<로캘>
C++ 표준 라이브러리의 스레드 보안