std::messages<CharT>:: close, std::messages<CharT>:: do_close
From cppreference.net
C++
Text processing library
| 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 | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Localization library
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::messages
| Member functions | ||||
|
messages::close
messages::do_close
|
|
ヘッダー
<locale>
で定義
|
||
|
public
:
void close ( catalog c ) const ; |
(1) | |
|
protected
:
virtual void do_close ( catalog c ) const ; |
(2) | |
1)
パブリックメンバー関数。最も派生したクラスの保護された仮想メンバー関数
do_close
を呼び出します。
2)
open()
から取得された、
std::messages_base
から継承された
catalog
型の値
c
によって指定されるオープンされたカタログに関連付けられた、実装定義のリソースを解放する。
目次 |
パラメータ
| c | - |
有効なオープンカタログ識別子であり、
close()
がまだ呼び出されていないもの
|
戻り値
(なし)
注記
POSIXシステムでは、この関数呼び出しは通常
catclose()
の呼び出しに変換されます。GNU gettextを基に実装されているGNU libstdc++では、何も行いません。
例
以下の例はメッセージの取得を示しています:典型的なGNU/Linuxシステムでは、
/usr/share/locale/de/LC_MESSAGES/sed.mo
から読み取ります。
このコードを実行
#include <iostream> #include <locale> int main() { std::locale loc("de_DE.utf8"); std::cout.imbue(loc); auto& facet = std::use_facet<std::messages<char>>(loc); auto cat = facet.open("sed", loc); if (cat < 0) std::cout << "Could not open german \"sed\" message catalog\n"; else std::cout << "\"No match\" in German: " << facet.get(cat, 0, 0, "No match") << '\n' << "\"Memory exhausted\" in German: " << facet.get(cat, 0, 0, "Memory exhausted") << '\n'; facet.close(cat); }
出力例:
"No match" in German: Keine Übereinstimmung "Memory exhausted" in German: Speicher erschöpft