diff options
Diffstat (limited to 'src/tools/bin2cpp.cpp')
-rw-r--r-- | src/tools/bin2cpp.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tools/bin2cpp.cpp b/src/tools/bin2cpp.cpp index 53da0b5..15ef73d 100644 --- a/src/tools/bin2cpp.cpp +++ b/src/tools/bin2cpp.cpp | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <bu/file.h> | 3 | #include <bu/file.h> |
4 | #include <bu/deflate.h> | 4 | #include <bu/deflate.h> |
5 | #include <bu/bzip2.h> | 5 | #include <bu/bzip2.h> |
6 | #include <bu/lzma.h> | ||
6 | #include <bu/base64.h> | 7 | #include <bu/base64.h> |
7 | #include <bu/hex.h> | 8 | #include <bu/hex.h> |
8 | #include <bu/streamstack.h> | 9 | #include <bu/streamstack.h> |
@@ -20,7 +21,7 @@ public: | |||
20 | addOption( sClass, 'c', "Class name [default=\"Datafiles\"]"); | 21 | addOption( sClass, 'c', "Class name [default=\"Datafiles\"]"); |
21 | addOption( sOutBase, 'o', "Output base filename [defaults to classname]"); | 22 | addOption( sOutBase, 'o', "Output base filename [defaults to classname]"); |
22 | addOption( sOutDir, 'd', "Output directory [defaults to current dir]"); | 23 | addOption( sOutDir, 'd', "Output directory [defaults to current dir]"); |
23 | addOption( slot(this, &Options::addFilter), 'f', "Add filter: deflate, bzip2, base64, hex"); | 24 | addOption( slot(this, &Options::addFilter), 'f', "Add filter: deflate, bzip2, lzma, base64, hex"); |
24 | setNonOption( slot(this, &Options::addInput) ); | 25 | setNonOption( slot(this, &Options::addInput) ); |
25 | addHelpOption(); | 26 | addHelpOption(); |
26 | 27 | ||
@@ -90,6 +91,7 @@ int main( int argc, char *argv[] ) | |||
90 | << "#include <bu/deflate.h>" << fSrc.nl | 91 | << "#include <bu/deflate.h>" << fSrc.nl |
91 | << "#include <bu/bzip2.h>" << fSrc.nl | 92 | << "#include <bu/bzip2.h>" << fSrc.nl |
92 | << "#include <bu/base64.h>" << fSrc.nl | 93 | << "#include <bu/base64.h>" << fSrc.nl |
94 | << "#include <bu/lzma.h>" << fSrc.nl | ||
93 | << "#include <bu/hex.h>" << fSrc.nl | 95 | << "#include <bu/hex.h>" << fSrc.nl |
94 | << "#include <bu/strfilter.h>" << fSrc.nl | 96 | << "#include <bu/strfilter.h>" << fSrc.nl |
95 | << "#include <bu/staticmembuf.h>" << fSrc.nl << fSrc.nl | 97 | << "#include <bu/staticmembuf.h>" << fSrc.nl << fSrc.nl |
@@ -120,6 +122,12 @@ int main( int argc, char *argv[] ) | |||
120 | sFltDesc.prepend("b"); | 122 | sFltDesc.prepend("b"); |
121 | hFilters.insert('b', true ); | 123 | hFilters.insert('b', true ); |
122 | } | 124 | } |
125 | else if( *f == "lzma" ) | ||
126 | { | ||
127 | sDat = encodeStr<Lzma>( sDat ); | ||
128 | sFltDesc.prepend("l"); | ||
129 | hFilters.insert('l', true ); | ||
130 | } | ||
123 | else if( *f == "base64" ) | 131 | else if( *f == "base64" ) |
124 | { | 132 | { |
125 | sDat = encodeStr<Base64>( sDat ); | 133 | sDat = encodeStr<Base64>( sDat ); |
@@ -181,6 +189,8 @@ int main( int argc, char *argv[] ) | |||
181 | fSrc << "\t\t\tcase 'd': s->pushFilter<Bu::Deflate>(); break;" << fSrc.nl; | 189 | fSrc << "\t\t\tcase 'd': s->pushFilter<Bu::Deflate>(); break;" << fSrc.nl; |
182 | if( hFilters.has('b') ) | 190 | if( hFilters.has('b') ) |
183 | fSrc << "\t\t\tcase 'b': s->pushFilter<Bu::BZip2>(); break;" << fSrc.nl; | 191 | fSrc << "\t\t\tcase 'b': s->pushFilter<Bu::BZip2>(); break;" << fSrc.nl; |
192 | if( hFilters.has('l') ) | ||
193 | fSrc << "\t\t\tcase 'l': s->pushFilter<Bu::Lzma>(); break;" << fSrc.nl; | ||
184 | if( hFilters.has('6') ) | 194 | if( hFilters.has('6') ) |
185 | fSrc << "\t\t\tcase '6': s->pushFilter<Bu::Base64>(); break;" << fSrc.nl; | 195 | fSrc << "\t\t\tcase '6': s->pushFilter<Bu::Base64>(); break;" << fSrc.nl; |
186 | if( hFilters.has('h') ) | 196 | if( hFilters.has('h') ) |