std::time_put
提供: cppreference.com
ヘッダ <locale> で定義
|
||
template< class CharT, |
||
クラステンプレート std::time_put
は日付と時間の書式化ルールをカプセル化します。 入出力マニピュレータ std::put_time は std::tm オブジェクトのテキスト表現を生成するために入出力ストリームのロケールの std::time_put
ファセットを使用します。
目次 |
[編集] 型の要件
-OutputIt は LegacyOutputIterator の要件を満たさなければなりません。
|
[編集] 特殊化
2つのスタンドアロンな (ロケール非依存な) 完全特殊化および2つの部分特殊化が標準ライブラリによって提供されます。
ヘッダ
<locale> で定義 | |
std::time_put<char> | 日付と時間のナロー文字列表現を作成します |
std::time_put<wchar_t> | 日付と時間のワイド文字列表現を作成します |
std::time_put<char, OutputIt> | カスタム出力イテレータを用いて日付と時間のナロー文字列表現を作成します |
std::time_put<wchar_t, OutputIt> | カスタム出力イテレータを用いて日付と時間のワイド文字列表現を作成します |
さらに、 C++ のプログラム内で構築されたすべてのロケールオブジェクトは、これらの特殊化の独自の (ロケール固有の) バージョンを実装します。
[編集] メンバ型
メンバ型 | 定義 |
char_type
|
CharT
|
iter_type
|
OutputIt
|
[編集] メンバ関数
新しい time_put ファセットを構築します (パブリックメンバ関数) | |
time_put ファセットを破棄します (プロテクテッドメンバ関数) | |
do_put を呼びます (パブリックメンバ関数) |
[編集] メンバオブジェクト
static std::locale::id id |
ロケールの id (パブリックメンバオブジェクト) |
[編集] プロテクテッドメンバ関数
[仮想] |
日付/時間を書式化し出力ストリームに書き込みます (仮想プロテクテッドメンバ関数) |
[編集] 例
Run this code
#include <iostream> #include <ctime> #include <iomanip> #include <codecvt> int main() { std::time_t t = std::time(NULL); std::wbuffer_convert<std::codecvt_utf8<wchar_t>> conv(std::cout.rdbuf()); std::wostream out(&conv); out.imbue(std::locale("ja_JP.utf8")); // this I/O manipulator std::put_time uses std::time_put<wchar_t> out << std::put_time(std::localtime(&t), L"%A %c") << '\n'; }
出力:
水曜日 2011年11月09日 12時32分05秒
[編集] 関連項目
指定された名前のロケールに対するシステム供給の std::time_put を表します (クラステンプレート) | |
入力文字シーケンスから時刻/日付の値をパースして struct std::tm に変換します (クラステンプレート) | |
(C++11) |
指定された書式に従って日付/時刻の値をフォーマットして出力します (関数テンプレート) |