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.

108 lines
3.1 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_BAGMETADATA
  16. #define LIBCBAG_BAGMETADATA
  17. #include <string>
  18. #include <map>
  19. #include <sstream>
  20. #include "checksum.hpp"
  21. using namespace std;
  22. enum {
  23. SourceOrganization,
  24. OrganizationAddress,
  25. ContactName,
  26. ContactPhone,
  27. ContactEmail,
  28. ExternalDescription,
  29. BaggingDate,
  30. ExternalIdentifier,
  31. BagSize,
  32. PayloadOxum,
  33. BagGroupIdentifier,
  34. BagCount,
  35. InternalSenderIdentifier,
  36. InternalSenderDescription,
  37. };
  38. class Bagmetadata{
  39. private:
  40. map<string,string> metadata;
  41. bool exist_bagmetadata_file;
  42. stringstream log;
  43. public:
  44. Bagmetadata( string basedir );
  45. string get_SourceOrganization();
  46. string get_OrganizationAddress();
  47. string get_ContactName();
  48. string get_ContactPhone();
  49. string get_ContactEmail();
  50. string get_ExternalDescription();
  51. string get_BaggingDate();
  52. string get_ExternalIdentifier();
  53. string get_BagSize();
  54. oxum_t get_PayloadOxum();
  55. string get_BagGroupIdentifier();
  56. string get_BagCount();
  57. string get_InternalSenderIdentifier();
  58. string get_InternalSenderDescription();
  59. bool has_SourceOrganization();
  60. bool has_OrganizationAddress();
  61. bool has_ContactName();
  62. bool has_ContactPhone();
  63. bool has_ContactEmail();
  64. bool has_ExternalDescription();
  65. bool has_BaggingDate();
  66. bool has_ExternalIdentifier();
  67. bool has_BagSize();
  68. bool has_PayloadOxum();
  69. bool has_BagGroupIdentifier();
  70. bool has_BagCount();
  71. bool has_InternalSenderIdentifier();
  72. bool has_InternalSenderDescription();
  73. void set_SourceOrganization( string );
  74. void set_OrganizationAddress( string );
  75. void set_ContactName( string );
  76. void set_ContactPhone( string );
  77. void set_ContactEmail( string );
  78. void set_ExternalDescription( string );
  79. void set_BaggingDate( string );
  80. void set_ExternalIdentifier( string );
  81. void set_BagSize( string );
  82. void set_PayloadOxum( oxum_t );
  83. void set_BagGroupIdentifier( string );
  84. void set_BagCount( string );
  85. void set_InternalSenderIdentifier( string );
  86. void set_InternalSenderDescription( string );
  87. map<string,string> get_metadata();
  88. void set_metadata(map<string,string> &);
  89. bool has_metadata();
  90. bool validate();
  91. bool store( string basedir);
  92. void get_logstream( stringstream & log);
  93. void reset_logstream();
  94. };
  95. #endif
  96. // vim: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab