OSDN Git Service

52879e9b5b0975af1662fff5369cffeaa8357bd0
[roast/roast_ex.git] / roast_ex / include / roast / file / iso9660 / eltorito.hpp
1 //      Roast+ License
2
3 /*
4         El Torito Bootable CD Specification
5 */
6 #ifndef __SFJP_ROAST_EX__file__iso9660__eltorito_HPP__
7 #define __SFJP_ROAST_EX__file__iso9660__eltorito_HPP__
8
9 #include <fstream>
10 #include "roast/lexical/string_rule.hpp"
11 #include "roast/math/endian.hpp"
12
13 namespace roast
14 {
15         namespace iso9660
16         {
17                 namespace eltorito
18                 {
19                         using namespace ::roast::lexical::rule;
20
21 <<<<<<< HEAD
22                         typedef soft_repeat< unibyte<0>, 0x8800 > rule;
23 =======
24                         //class str_CD001 : public fixed_string{ public: str_CD001()
25                         ROAST_LEXICAL_FIXSTR(str_CD001, "CD001")
26                         ROAST_LEXICAL_FIXSTR(str_ELTORITOSPEC, "EL TORITO SPECIFICATION")       //      23byte
27
28                         //      _volume_desc
29                         typedef seq<
30                                 unibyte<0>,             //      Volume Descriptor Type
31                                 str_CD001,
32                                 unibyte<1>,             //      Volume Descriptor Version
33
34                                 //      System Descriptor (32byte)
35                                 str_ELTORITOSPEC,                               //      String 23byte
36                                 soft_repeat< unibyte<0>, 9 >,   //      Zero Padding (9byte)
37
38                                 //      Volume Discriminator - Zero Padding (32byte)
39                                 soft_repeat< unibyte<0>, 32 >,
40
41                                 //      [El Torito Only] Boot Record Volume Descriptor
42                                 fixed_uint< fixed_little_endian<unsigned int, 18 >::value >     //      18 Sector
43                         > _volume_desc;
44
45                         //      rule
46                         typedef seq<
47                                 soft_repeat< unibyte<0>, 0x8800 >,      //      Zero Padding 17 Sectors (1 Sector = 2048byte)
48                                 _volume_desc
49                         > rule;
50 >>>>>>> 63d7ba7... eltorito.hpp: とりあえず「Boot Record Volume Descriptor」の手前まで
51                 }
52                 
53                 ////////////////////////////////////////////////////////
54
55                 class eltorito_writer
56                 {
57                 public:
58                         bool write(const char* filename, const unsigned char* boot_img, size_t size )
59                         {
60                                 ::std::fstream fs(filename, std::ios::out | std::ios::binary);
61                                 if ( fs.fail() )
62                                         return false;
63
64                                 eltorito::rule rl;
65                                 rl.generate(fs, boot_img);
66
67                                 return true;
68                         }
69                 };
70         }
71 }
72
73 #endif//__SFJP_ROAST_EX__file__iso9660__eltorito_HPP__