xlnt/source/detail/implementations/conditional_format_impl.hpp
Crzyrndm a8fa6637fe fix workbook::operator== always returning false, add tests for workbook::load
workbook::operator== was comparing the value of the raw pointer held by two std::unique_ptr's. By definition, this is always false in a well behaved program (if it's true, things go bang...). This then led to adding equality operators to nearly every other struct/class in xlnt to support workbook::operator==

workbook::load and the non-default ctors for loading data from a file are tested using the now functional equality operator

NOTE: a large number of copy ctors need updates/fixing. Many should be defaulted
2018-07-03 14:05:07 +12:00

51 lines
1.0 KiB
C++

#pragma once
#include <cstddef>
#include <xlnt/styles/conditional_format.hpp>
#include <xlnt/utils/optional.hpp>
#include <xlnt/worksheet/range_reference.hpp>
namespace xlnt {
class border;
class fill;
class font;
namespace detail {
struct stylesheet;
struct worksheet_impl;
struct conditional_format_impl
{
stylesheet *parent;
worksheet_impl *target_sheet;
bool operator==(const conditional_format_impl& rhs) const
{
// not comparing parent or target sheet
return target_range == rhs.target_range
&& priority == rhs.priority
&& differential_format_id == rhs.differential_format_id
&& when == rhs.when
&& border_id == rhs.border_id
&& fill_id == rhs.fill_id
&& font_id == rhs.font_id;
}
range_reference target_range;
std::size_t priority;
std::size_t differential_format_id;
condition when;
optional<std::size_t> border_id;
optional<std::size_t> fill_id;
optional<std::size_t> font_id;
};
} // namespace detail
} // namespace xlnt