47    std::cout << 
"Usage:  " << 
g_progname << 
" <output>[.zip] <input-dir>" << std::endl;
 
   48    std::cout << 
"This tool creates a zip file from a directory or a file." << std::endl;
 
   49    std::cout << 
"This is a way to exercise the library." << std::endl;
 
 
 
   58int main(
int argc, 
char *argv[])
 
   76    for(
int i(1); i < argc; ++i)
 
   78        if(strcmp(argv[i], 
"-h") == 0
 
   79        || strcmp(argv[i], 
"--help") == 0)
 
   83        if(strcmp(argv[i], 
"-V") == 0
 
   84        || strcmp(argv[i], 
"--version") == 0)
 
   89        if(strcmp(argv[i], 
"--level") == 0)
 
   94                std::cerr << 
"error: the --level option must be followed by a level.";
 
   97            if(strcmp(argv[i], 
"default") == 0)
 
  101            else if(strcmp(argv[i], 
"smallest") == 0)
 
  105            else if(strcmp(argv[i], 
"fastest") == 0)
 
  109            else if(strcmp(argv[i], 
"none") == 0)
 
  120                        << 
"error: the --level parameter expects one of" 
  121                           " \"default\", \"smallest\", \"fastest\", \"none\"" 
  122                           " or a number between " 
  131        else if(strcmp(argv[i], 
"--limit") == 0)
 
  136                std::cerr << 
"error: the --limit option must be followed by a limit.";
 
  139            if(strcmp(argv[i], 
"default") == 0)
 
  145                limit = std::atoi(argv[i]);
 
  158            std::cerr << 
"error: unknown command line option \"" 
  160                << 
"\". Try --help for additional information.";
 
  167        std::cerr << 
"error: missing input directory name on command line.\n";
 
  205    std::string zipname(out);
 
  206    if(zipname.find(
".zip", zipname.length() - 4) == std::string::npos)
 
  210    std::ofstream output(zipname, std::ios_base::binary);
 
 
A collection generated from reading a directory.
void setMethod(size_t limit, StorageMethod small_storage_method, StorageMethod large_storage_method)
Change the storage method to the specified value.
void setLevel(size_t limit, FileEntry::CompressionLevel small_compression_level, FileEntry::CompressionLevel large_compression_level)
Change the compression level to the specified value.
int CompressionLevel
The compression level to be used to save an entry.
static CompressionLevel const COMPRESSION_LEVEL_MINIMUM
static CompressionLevel const COMPRESSION_LEVEL_MAXIMUM
static CompressionLevel const COMPRESSION_LEVEL_DEFAULT
static CompressionLevel const COMPRESSION_LEVEL_NONE
static CompressionLevel const COMPRESSION_LEVEL_FASTEST
static CompressionLevel const COMPRESSION_LEVEL_SMALLEST
static void saveCollectionToArchive(std::ostream &os, FileCollection &collection, std::string const &zip_comment=std::string())
Create a Zip archive from the specified FileCollection.
Define the zipios::DirectoryCollection class.
int main(int argc, char *argv[])
Define the zipios::ZipFile class.
#define ZIPIOS_VERSION_STRING