mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Add debug output for a relationship mismatch
This commit is contained in:
parent
53c193433f
commit
ec02121c15
|
@ -3,11 +3,11 @@
|
|||
#include <sstream>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <xlnt/packaging/manifest.hpp>
|
||||
#include <xlnt/workbook/workbook.hpp>
|
||||
#include <detail/external/include_libstudxml.hpp>
|
||||
#include <detail/serialization/vector_streambuf.hpp>
|
||||
#include <detail/serialization/zstream.hpp>
|
||||
#include <xlnt/packaging/manifest.hpp>
|
||||
#include <xlnt/workbook/workbook.hpp>
|
||||
|
||||
class xml_helper
|
||||
{
|
||||
|
@ -63,8 +63,7 @@ public:
|
|||
bool difference = false;
|
||||
auto right_iter = right_parser.begin();
|
||||
|
||||
auto is_whitespace = [](const std::string &v)
|
||||
{
|
||||
auto is_whitespace = [](const std::string &v) {
|
||||
return v.find_first_not_of("\n\r\t ") == std::string::npos;
|
||||
};
|
||||
|
||||
|
@ -290,8 +289,7 @@ public:
|
|||
|
||||
if (std::abs(int(left_info.size()) - int(right_info.size())) == 1)
|
||||
{
|
||||
auto is_calc_chain = [](const xlnt::path &p)
|
||||
{
|
||||
auto is_calc_chain = [](const xlnt::path &p) {
|
||||
return p.filename() == "calcChain.xml";
|
||||
};
|
||||
|
||||
|
@ -306,7 +304,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (left_info.size() != right_info.size() && ! difference_is_missing_calc_chain)
|
||||
if (left_info.size() != right_info.size() && !difference_is_missing_calc_chain)
|
||||
{
|
||||
std::cout << "left has a different number of files than right" << std::endl;
|
||||
|
||||
|
@ -338,6 +336,35 @@ public:
|
|||
|
||||
if (!compare_relationships(left_manifest, right_manifest))
|
||||
{
|
||||
std::cout << "relationship mismatch\n"
|
||||
<< "Left:\n";
|
||||
for (const auto &part : left_manifest.parts())
|
||||
{
|
||||
std::cout << "-part: " << part.string() << '\n';
|
||||
auto rels = left_manifest.relationships(part);
|
||||
for (auto &rel : rels)
|
||||
{
|
||||
std::cout << rel.id() << ':'
|
||||
<< static_cast<int>(rel.type())
|
||||
<< ':' << static_cast<int>(rel.target_mode())
|
||||
<< ':' << rel.source().path().string()
|
||||
<< ':' << rel.target().path().string() << '\n';
|
||||
}
|
||||
}
|
||||
std::cout << "\nRight:\n";
|
||||
for (const auto &part : right_manifest.parts())
|
||||
{
|
||||
std::cout << "-part: " << part.string() << '\n';
|
||||
auto rels = right_manifest.relationships(part);
|
||||
for (auto &rel : rels)
|
||||
{
|
||||
std::cout << rel.id()
|
||||
<< ':' << static_cast<int>(rel.type())
|
||||
<< ':' << static_cast<int>(rel.target_mode())
|
||||
<< ':' << rel.source().path().string()
|
||||
<< ':' << rel.target().path().string() << '\n';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -357,9 +384,11 @@ public:
|
|||
}
|
||||
|
||||
auto left_content_type = left_member.string() == "[Content_Types].xml"
|
||||
? "[Content_Types].xml" : left_manifest.content_type(left_member);
|
||||
? "[Content_Types].xml"
|
||||
: left_manifest.content_type(left_member);
|
||||
auto right_content_type = left_member.string() == "[Content_Types].xml"
|
||||
? "[Content_Types].xml" : right_manifest.content_type(left_member);
|
||||
? "[Content_Types].xml"
|
||||
: right_manifest.content_type(left_member);
|
||||
|
||||
if (left_content_type != right_content_type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user