/********************************************************************************** * * * Copyright (c) 2003 - 2004 by Royal. All rights reserved. * * * * Permission to use, copy, modify, and distribute this software for any purpose * * is hereby granted without fee, provided that this copyright and permissions * * notice appear in all copies and derivatives, and that no charge may be made * * for the software and its documentation except to cover cost of distribution. * * * * This software is provided "as is" without express or implied warranty. * * * **********************************************************************************/ /* * Description: * * Declaration of class FileSplitter. * * History: * * Initial version created by Royal, May, 2003. * * Notes: * * This code has been written to conform to standard C++ and STL. It has been * compiled successfully using GNU C++ 3.2, Borland C++ 5.5, and Visual C++ 7.0. */ #ifndef FILE_SPLITTER_H #define FILE_SPLITTER_H #include #include #include using namespace std; class FileSplitter { public: FileSplitter(const string& name, int max_chunk_size = 1024*1024); ~FileSplitter(); void merge(); void split(); private: bool read(const string& name, vector& buffer); bool write(const string& name, const vector& buffer); private: vector buffer_; //buffer of file size_t size_; //size of file string name_; //name of file size_t max_chunk_size_; //maximal size of chunk file }; #endif