2 * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef _pbd_archive_h_
20 #define _pbd_archive_h_
24 #include "pbd/signals.h"
27 #include "pbd/libpbd_visibility.h"
33 class LIBPBD_API FileArchive
36 FileArchive (const std::string& url);
38 int inflate (const std::string& destdir);
39 std::vector<std::string> contents ();
41 int create (const std::string& srcdir);
42 int create (const std::map <std::string, std::string>& filemap);
44 PBD::Signal2<void, size_t, size_t> progress; // TODO
52 pthread_mutex_init (&_lock, NULL);
53 pthread_cond_init (&_ready, NULL);
63 pthread_mutex_destroy (&_lock);
64 pthread_cond_destroy (&_ready);
79 void lock () { pthread_mutex_lock (&_lock); }
80 void unlock () { pthread_mutex_unlock (&_lock); }
81 void signal () { pthread_cond_signal (&_ready); }
82 void wait () { pthread_cond_wait (&_ready, &_lock); }
91 FileArchive* progress;
94 pthread_mutex_t _lock;
95 pthread_cond_t _ready;
100 Request (const std::string& u)
103 url = strdup (u.c_str());
114 bool is_remote () const
116 if (!strncmp (url, "https://", 8) || !strncmp (url, "http://", 7) || !strncmp (url, "ftp://", 6)) {
131 std::vector<std::string> contents_url ();
132 std::vector<std::string> contents_file ();
137 int do_extract (struct archive* a);
138 std::vector<std::string> get_contents (struct archive *a);
147 #endif // _reallocpool_h_