added tar::header::charset
@@ -32,6 +32,7 @@ | ||
32 | 32 | BOOST_CHECK(old.change_time == now.change_time); |
33 | 33 | BOOST_CHECK_EQUAL(old.permissions, now.permissions); |
34 | 34 | BOOST_CHECK(old.comment == now.comment); |
35 | + BOOST_CHECK(old.charset == now.charset); | |
35 | 36 | } |
36 | 37 | |
37 | 38 | void unicode_test() |
@@ -45,6 +46,7 @@ | ||
45 | 46 | head.change_time = fs_ex::timestamp(12345, 0); |
46 | 47 | head.permissions = 0123; |
47 | 48 | head.comment = L"\xC548\xB155\xD558\xC2ED\xB2C8\xAE4C"; |
49 | + head.charset = L"BINARY"; | |
48 | 50 | |
49 | 51 | io_ex::tmp_file archive; |
50 | 52 | ar::basic_tar_file_sink< |
@@ -1,6 +1,6 @@ | ||
1 | 1 | // tar_pax_test.cpp: test case for pax formatted tar |
2 | 2 | |
3 | -// Copyright Takeshi Mouri 2006, 2007. | |
3 | +// Copyright Takeshi Mouri 2006-2008. | |
4 | 4 | // Distributed under the Boost Software License, Version 1.0. |
5 | 5 | // (See accompanying file LICENSE_1_0.txt or copy at |
6 | 6 | // http://www.boost.org/LICENSE_1_0.txt) |
@@ -33,6 +33,7 @@ | ||
33 | 33 | BOOST_CHECK(old.change_time == now.change_time); |
34 | 34 | BOOST_CHECK_EQUAL(old.permissions, now.permissions); |
35 | 35 | BOOST_CHECK_EQUAL(old.comment, now.comment); |
36 | + BOOST_CHECK_EQUAL(old.charset, now.charset); | |
36 | 37 | } |
37 | 38 | |
38 | 39 | void tar_test() |
@@ -49,6 +50,7 @@ | ||
49 | 50 | head.file_size = data.size(); |
50 | 51 | head.permissions = 0123; |
51 | 52 | head.comment = "test comment"; |
53 | + head.charset = "ISO-IR 646 1990"; | |
52 | 54 | |
53 | 55 | io_ex::tmp_file archive; |
54 | 56 | ar::basic_tar_file_sink< |
@@ -119,6 +119,10 @@ | ||
119 | 119 | <type>string_type</type> |
120 | 120 | </data-member> |
121 | 121 | |
122 | + <data-member name="charset"> | |
123 | + <type>string_type</type> | |
124 | + </data-member> | |
125 | + | |
122 | 126 | <description> |
123 | 127 | <para> |
124 | 128 | <informaltable frame="all"> |
@@ -211,6 +215,11 @@ | ||
211 | 215 | <entry>コメント文字列</entry> |
212 | 216 | <entry></entry> |
213 | 217 | </row> |
218 | + <row> | |
219 | + <entry>charset</entry> | |
220 | + <entry>ファイルコンテンツの文字集合</entry> | |
221 | + <entry></entry> | |
222 | + </row> | |
214 | 223 | </tbody> |
215 | 224 | </tgroup> |
216 | 225 | </informaltable> |
@@ -44,6 +44,7 @@ | ||
44 | 44 | boost::uint16_t dev_major; |
45 | 45 | boost::uint16_t dev_minor; |
46 | 46 | string_type comment; |
47 | + string_type charset; | |
47 | 48 | |
48 | 49 | basic_header() |
49 | 50 | : permissions(0644), uid(0), gid(0), file_size(0) |
@@ -35,6 +35,7 @@ | ||
35 | 35 | string_type user_name; |
36 | 36 | string_type group_name; |
37 | 37 | string_type comment; |
38 | + string_type charset; | |
38 | 39 | }; |
39 | 40 | |
40 | 41 | } } } // End namespaces detail, archivers, hamigaki. |
@@ -62,6 +62,7 @@ | ||
62 | 62 | tmp.dev_major = head.dev_major; |
63 | 63 | tmp.dev_minor = head.dev_minor; |
64 | 64 | tmp.comment = charset::to_code_page(head.comment, 0); |
65 | + tmp.charset = charset::to_code_page(head.charset, 0); | |
65 | 66 | |
66 | 67 | return tmp; |
67 | 68 | } |
@@ -274,6 +275,15 @@ | ||
274 | 275 | ); |
275 | 276 | } |
276 | 277 | |
278 | + if (!head.charset.empty()) | |
279 | + { | |
280 | + ex += | |
281 | + tar_detail::make_ex_header_recoed( | |
282 | + "charset", | |
283 | + tar_detail::to_pax_string(head.charset) | |
284 | + ); | |
285 | + } | |
286 | + | |
277 | 287 | if (!ex.empty()) |
278 | 288 | write_extended_header(local.path, ex); |
279 | 289 | } |
@@ -73,6 +73,7 @@ | ||
73 | 73 | tmp.dev_major = head.dev_major; |
74 | 74 | tmp.dev_minor = head.dev_minor; |
75 | 75 | tmp.comment = charset::from_code_page(head.comment, 0); |
76 | + tmp.charset = charset::from_code_page(head.charset, 0); | |
76 | 77 | |
77 | 78 | return tmp; |
78 | 79 | } |
@@ -221,6 +222,9 @@ | ||
221 | 222 | if (!ext.comment.empty()) |
222 | 223 | header_.comment = ext.comment; |
223 | 224 | |
225 | + if (!ext.charset.empty()) | |
226 | + header_.charset = ext.charset; | |
227 | + | |
224 | 228 | return true; |
225 | 229 | } |
226 | 230 |
@@ -308,6 +312,8 @@ | ||
308 | 312 | ext.group_name = tar_detail::from_pax_string<string_type>(beg); |
309 | 313 | else if (key == "comment") |
310 | 314 | ext.comment = tar_detail::from_pax_string<string_type>(beg); |
315 | + else if (key == "charset") | |
316 | + ext.charset = tar_detail::from_pax_string<string_type>(beg); | |
311 | 317 | } |
312 | 318 | } |
313 | 319 | }; |