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.

47 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. #include "payloadmanifest.hpp"
  16. #include <iostream>
  17. #include <fstream>
  18. #include <sstream>
  19. #include <boost/filesystem.hpp>
  20. //#include <filesystem> // c++17
  21. //namespace fs = std::filesystem;
  22. namespace fs = boost::filesystem;
  23. using namespace std;
  24. Payloadmanifest::Payloadmanifest( string basedir ) : Manifest::Manifest( basedir, "manifest-") {
  25. }
  26. bool Payloadmanifest::validate() {
  27. bool is_valid = true;
  28. bool tmp = Manifest::validate();
  29. if (!tmp) { is_valid = false; }
  30. // check if at least one payload file exist
  31. if (this->manifest_algorithm_files.empty()) {
  32. this->log << "Bagit payloadmanifest count greater zero expected, but " << to_string(this->manifest_algorithm_files.size()) << " found" << endl;
  33. is_valid = false;
  34. }
  35. return is_valid;
  36. }
  37. // vim: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab