C++ Library to handle BagIt structures. BagIt is a standard format to create transfer packages for digital preservation purposes. See https://en.wikipedia.org/wiki/BagIt for details http://andreas-romeyke.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.5 KiB

  1. // Copyright (C) 2018 Andreas Romeyke (art1@andreas-romeyke.de), 2018.
  2. //
  3. // This program is free software: you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation, either version 3 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. #ifndef LIBCBAG_FETCHFILE
  16. #define LIBCBAG_FETCHFILE
  17. #include <string>
  18. #include <list>
  19. #include <sstream>
  20. using namespace std;
  21. typedef string url_t;
  22. typedef string filename_t;
  23. typedef struct {
  24. url_t url;
  25. size_t size;
  26. filename_t filename;
  27. } fetch_t;
  28. class Fetchfile{
  29. private:
  30. string basedir;
  31. list<fetch_t> entries;
  32. stringstream log;
  33. bool exist_fetchfile;
  34. public:
  35. Fetchfile( string basedir );
  36. bool has_fetchfile();
  37. list<fetch_t> get_entries();
  38. bool set_entries( list<fetch_t> &);
  39. bool fetch(fetch_t);
  40. bool fetch_all_entries();
  41. bool add_fetch_entry( fetch_t);
  42. bool remove_fetch_entry (fetch_t);
  43. bool validate();
  44. bool store( string basedir);
  45. void get_logstream( stringstream & log);
  46. void reset_logstream();
  47. };
  48. #endif
  49. // vim: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab