|
|
@ -19,8 +19,35 @@ Bag::Bag( string dfname ) { |
|
|
|
getline(bagit_txt_file, utf8_line); |
|
|
|
bagit_txt_file.close(); |
|
|
|
stringstream version_ss ( version_line ); |
|
|
|
version_ss >> Bag::bagit_version_major; |
|
|
|
version_ss >> Bag::bagit_version_minor; |
|
|
|
string major; |
|
|
|
string minor; |
|
|
|
string vprefix; |
|
|
|
getline(version_ss, vprefix, ' '); |
|
|
|
getline(version_ss, major ,'.'); |
|
|
|
getline(version_ss, minor, '.'); |
|
|
|
if (0 != vprefix.compare("BagIt-Version:")) { |
|
|
|
log << "wrong vprefix='" << vprefix << "', but 'BagIt-Version:' expected" << endl; |
|
|
|
} |
|
|
|
cout << "major:'"<<major<<"'"<<endl; |
|
|
|
cout << "minor:'"<<minor<<"'"<<endl; |
|
|
|
Bag::bagit_version_major = stoi(major); |
|
|
|
Bag::bagit_version_minor = stoi(minor); |
|
|
|
|
|
|
|
stringstream utf8_ss (utf8_line); |
|
|
|
string uprefix; |
|
|
|
string uvalue; |
|
|
|
getline(utf8_ss, uprefix, ' '); |
|
|
|
getline(utf8_ss, uvalue, ' '); |
|
|
|
if (0 != uprefix.compare("Tag-File-Character-Encoding:")) { |
|
|
|
log << "wrong uprefix='" << uprefix << "', but 'Tag-File-Character-Encoding:' expected" << endl; |
|
|
|
} |
|
|
|
Bag::tag_file_character_encoding = uvalue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cout << "Bagit Version ("<< version_line << ") major=" << Bag::bagit_version_major << " minor=" << Bag::bagit_version_minor << endl; |
|
|
|
} else { |
|
|
|
Bag::log << "file " << bagit_txt_path << " could not be opened" <<endl; |
|
|
|
} |
|
|
@ -30,6 +57,8 @@ Bag::Bag( string dfname ) { |
|
|
|
list<string> files = Bag::payload_p->get_all_relative_paths(); |
|
|
|
// read in payload manifest
|
|
|
|
Bag::manifest_p = new Manifest(dfname); |
|
|
|
// read in tagmanifest
|
|
|
|
Bag::tagmanifest_p = new Tagmanifest(dfname); |
|
|
|
|
|
|
|
list<string>::iterator i; |
|
|
|
for (i=files.begin(); i!=files.end(); i++) { |
|
|
@ -37,7 +66,9 @@ Bag::Bag( string dfname ) { |
|
|
|
//cout << "file/dir (abs):" << (*i) << endl;
|
|
|
|
} |
|
|
|
Bag::manifest_p->get_checksum_file_pairs( md5 ); |
|
|
|
Bag::tagmanifest_p->get_checksum_file_pairs( md5 ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// vim: set tabstop=4
|
|
|
|
// vim: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
|
|
|
|
|