00001 // This is oxl/oxp/oxp_bunch_of_files.h 00002 #ifndef oxp_bunch_of_files_h_ 00003 #define oxp_bunch_of_files_h_ 00004 //: 00005 // \file 00006 // \author awf@robots.ox.ac.uk 00007 // Created: 18 Dec 01 00008 00009 #include <vcl_cstdio.h> 00010 #include <vcl_vector.h> 00011 #include <vcl_string.h> 00012 00013 struct oxp_bunch_of_files 00014 { 00015 typedef unsigned long offset_t; 00016 00017 oxp_bunch_of_files() {} 00018 oxp_bunch_of_files(char const* fmt); 00019 ~oxp_bunch_of_files() { close(); } 00020 00021 bool open(char const* fmt); 00022 bool open_1(char const* fmt); 00023 void close(); 00024 00025 bool seek(offset_t to); 00026 offset_t tell() const; 00027 offset_t read(void*, offset_t); 00028 bool ok() { return current_file_index != -1; } 00029 00030 private: 00031 bool fix_sizes(); // filenames has been filled 00032 00033 int current_file_index; 00034 vcl_vector<vcl_string> filenames; 00035 vcl_vector<vcl_FILE*> fps; 00036 vcl_vector<offset_t> filesizes; 00037 vcl_vector<offset_t> start_byte; 00038 }; 00039 00040 #endif // oxp_bunch_of_files_h_
1.4.4