1 /* 2 Copyright (c) 2006 - 2021 3 CLST - Radboud University 4 ILK - Tilburg University 5 6 This file is part of ticcutils 7 8 ticcutils is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 3 of the License, or 11 (at your option) any later version. 12 13 ticcutils is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, see <http://www.gnu.org/licenses/>. 20 21 For questions and suggestions, see: 22 https://github.com/LanguageMachines/ticcutils/issues 23 or send mail to: 24 lamasoftware (at ) science.ru.nl 25 */ 26 27 #ifndef TICC_TAR_TOOLS_H 28 #define TICC_TAR_TOOLS_H 29 30 #include "libtar.h" 31 #include <fstream> 32 #include <vector> 33 34 namespace TiCC { 35 36 /// \brief a class to handle .tar files for extracting only 37 class tar { 38 public: 39 tar(); 40 ~tar(); 41 bool open( const std::string& ); 42 bool extract_file_names( std::vector<std::string>&, 43 const std::string& = "" ); 44 bool extract_file_names_match( std::vector<std::string>&, 45 const std::string& ); 46 bool next_ifstream( std::ifstream&, std::string& ); 47 bool extract_ifstream( const std::string&, std::ifstream& ); 48 bool close(); 49 private: 50 TAR *tar_file; 51 std::string tarname; 52 tar( const tar& ); // no copies 53 tar& operator=( const tar& ); // no copies 54 }; 55 56 } // namespace TiCC 57 58 #endif 59