degate  0.1.2
ProjectArchiver.h
Go to the documentation of this file.
00001 /* -*-c++-*-
00002 
00003  This file is part of the IC reverse engineering tool degate.
00004 
00005  Copyright 2008, 2009, 2010 by Martin Schobert
00006 
00007  Degate is free software: you can redistribute it and/or modify
00008  it under the terms of the GNU General Public License as published by
00009  the Free Software Foundation, either version 3 of the License, or
00010  any later version.
00011 
00012  Degate is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU General Public License for more details.
00016 
00017  You should have received a copy of the GNU General Public License
00018  along with degate. If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 #ifndef __PROJECTARCHIVER_H__
00023 #define __PROJECTARCHIVER_H__
00024 
00025 #include <degate.h>
00026 #include <Project.h>
00027 
00028 #include <stdexcept>
00029 
00030 namespace degate {
00031 
00032   /**
00033    * Export a project directory as a ZIP archive.
00034    *
00035    */
00036 
00037   class ProjectArchiver {
00038 
00039   private:
00040 
00041     void add_single_file(struct zip * zip_archive,
00042                          boost::filesystem::path const& archive_file,
00043                          boost::filesystem::path const& base_dir_path,
00044                          boost::filesystem::path const& file,
00045                          boost::filesystem::path const& prepend_dir) const;
00046 
00047 
00048       void add_directory(struct zip * zip_archive,
00049                          boost::filesystem::path const& archive_file,
00050                          boost::filesystem::path const& base_dir_path,
00051                          boost::filesystem::path const& dir,
00052                          boost::filesystem::path const& prepend_dir) const;
00053 
00054   public:
00055     ProjectArchiver() {}
00056     ~ProjectArchiver() {}
00057 
00058     void export_data(boost::filesystem::path const& project_dir,
00059                      boost::filesystem::path const& archive_file,
00060                      boost::filesystem::path const& prepend_dir) const;
00061   };
00062 
00063 }
00064 
00065 #endif