• R/O
  • SSH
  • HTTPS

hamigaki: 提交


Commit MetaInfo

修訂1620 (tree)
時間2008-04-26 23:28:20
作者hamigaki

Log Message

added tar::header::charset

Change Summary

差異

--- hamigaki/trunk/libs/archivers/test/tar_pax_wide_test.cpp (revision 1619)
+++ hamigaki/trunk/libs/archivers/test/tar_pax_wide_test.cpp (revision 1620)
@@ -32,6 +32,7 @@
3232 BOOST_CHECK(old.change_time == now.change_time);
3333 BOOST_CHECK_EQUAL(old.permissions, now.permissions);
3434 BOOST_CHECK(old.comment == now.comment);
35+ BOOST_CHECK(old.charset == now.charset);
3536 }
3637
3738 void unicode_test()
@@ -45,6 +46,7 @@
4546 head.change_time = fs_ex::timestamp(12345, 0);
4647 head.permissions = 0123;
4748 head.comment = L"\xC548\xB155\xD558\xC2ED\xB2C8\xAE4C";
49+ head.charset = L"BINARY";
4850
4951 io_ex::tmp_file archive;
5052 ar::basic_tar_file_sink<
--- hamigaki/trunk/libs/archivers/test/tar_pax_test.cpp (revision 1619)
+++ hamigaki/trunk/libs/archivers/test/tar_pax_test.cpp (revision 1620)
@@ -1,6 +1,6 @@
11 // tar_pax_test.cpp: test case for pax formatted tar
22
3-// Copyright Takeshi Mouri 2006, 2007.
3+// Copyright Takeshi Mouri 2006-2008.
44 // Distributed under the Boost Software License, Version 1.0.
55 // (See accompanying file LICENSE_1_0.txt or copy at
66 // http://www.boost.org/LICENSE_1_0.txt)
@@ -33,6 +33,7 @@
3333 BOOST_CHECK(old.change_time == now.change_time);
3434 BOOST_CHECK_EQUAL(old.permissions, now.permissions);
3535 BOOST_CHECK_EQUAL(old.comment, now.comment);
36+ BOOST_CHECK_EQUAL(old.charset, now.charset);
3637 }
3738
3839 void tar_test()
@@ -49,6 +50,7 @@
4950 head.file_size = data.size();
5051 head.permissions = 0123;
5152 head.comment = "test comment";
53+ head.charset = "ISO-IR 646 1990";
5254
5355 io_ex::tmp_file archive;
5456 ar::basic_tar_file_sink<
--- hamigaki/trunk/libs/archivers/doc/reference/tar/headers.xml (revision 1619)
+++ hamigaki/trunk/libs/archivers/doc/reference/tar/headers.xml (revision 1620)
@@ -119,6 +119,10 @@
119119 <type>string_type</type>
120120 </data-member>
121121
122+ <data-member name="charset">
123+ <type>string_type</type>
124+ </data-member>
125+
122126 <description>
123127 <para>
124128 <informaltable frame="all">
@@ -211,6 +215,11 @@
211215 <entry>コメント文字列</entry>
212216 <entry></entry>
213217 </row>
218+ <row>
219+ <entry>charset</entry>
220+ <entry>ファイルコンテンツの文字集合</entry>
221+ <entry></entry>
222+ </row>
214223 </tbody>
215224 </tgroup>
216225 </informaltable>
--- hamigaki/trunk/hamigaki/archivers/tar/headers.hpp (revision 1619)
+++ hamigaki/trunk/hamigaki/archivers/tar/headers.hpp (revision 1620)
@@ -44,6 +44,7 @@
4444 boost::uint16_t dev_major;
4545 boost::uint16_t dev_minor;
4646 string_type comment;
47+ string_type charset;
4748
4849 basic_header()
4950 : permissions(0644), uid(0), gid(0), file_size(0)
--- hamigaki/trunk/hamigaki/archivers/detail/tar_ex_header.hpp (revision 1619)
+++ hamigaki/trunk/hamigaki/archivers/detail/tar_ex_header.hpp (revision 1620)
@@ -35,6 +35,7 @@
3535 string_type user_name;
3636 string_type group_name;
3737 string_type comment;
38+ string_type charset;
3839 };
3940
4041 } } } // End namespaces detail, archivers, hamigaki.
--- hamigaki/trunk/hamigaki/archivers/detail/tar_file_sink_impl.hpp (revision 1619)
+++ hamigaki/trunk/hamigaki/archivers/detail/tar_file_sink_impl.hpp (revision 1620)
@@ -62,6 +62,7 @@
6262 tmp.dev_major = head.dev_major;
6363 tmp.dev_minor = head.dev_minor;
6464 tmp.comment = charset::to_code_page(head.comment, 0);
65+ tmp.charset = charset::to_code_page(head.charset, 0);
6566
6667 return tmp;
6768 }
@@ -274,6 +275,15 @@
274275 );
275276 }
276277
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+
277287 if (!ex.empty())
278288 write_extended_header(local.path, ex);
279289 }
--- hamigaki/trunk/hamigaki/archivers/detail/tar_file_source_impl.hpp (revision 1619)
+++ hamigaki/trunk/hamigaki/archivers/detail/tar_file_source_impl.hpp (revision 1620)
@@ -73,6 +73,7 @@
7373 tmp.dev_major = head.dev_major;
7474 tmp.dev_minor = head.dev_minor;
7575 tmp.comment = charset::from_code_page(head.comment, 0);
76+ tmp.charset = charset::from_code_page(head.charset, 0);
7677
7778 return tmp;
7879 }
@@ -221,6 +222,9 @@
221222 if (!ext.comment.empty())
222223 header_.comment = ext.comment;
223224
225+ if (!ext.charset.empty())
226+ header_.charset = ext.charset;
227+
224228 return true;
225229 }
226230
@@ -308,6 +312,8 @@
308312 ext.group_name = tar_detail::from_pax_string<string_type>(beg);
309313 else if (key == "comment")
310314 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);
311317 }
312318 }
313319 };
Show on old repository browser