From 5cdaa6ec6b51e506802dceceff3ed32d84dfb85e Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Fri, 22 Jul 2016 23:41:57 -0400 Subject: [PATCH] remove cell_reference comparisons --- include/xlnt/cell/cell.hpp | 6 ----- include/xlnt/cell/cell_reference.hpp | 6 ----- source/cell/cell.cpp | 5 ---- source/cell/cell_reference.cpp | 40 ---------------------------- source/cell/tests/test_cell.hpp | 6 +---- 5 files changed, 1 insertion(+), 62 deletions(-) diff --git a/include/xlnt/cell/cell.hpp b/include/xlnt/cell/cell.hpp index e2d77254..f8603003 100644 --- a/include/xlnt/cell/cell.hpp +++ b/include/xlnt/cell/cell.hpp @@ -390,12 +390,6 @@ public: /// friend XLNT_FUNCTION bool operator==(std::nullptr_t, const cell &cell); - /// - /// Return the result of left.get_reference() < right.get_reference(). - /// What's the point of this? - /// - friend XLNT_FUNCTION bool operator<(cell left, cell right); - /// /// Convenience function for writing cell to an ostream. /// Uses cell::to_string() internally. diff --git a/include/xlnt/cell/cell_reference.hpp b/include/xlnt/cell/cell_reference.hpp index a64661c5..0494c564 100644 --- a/include/xlnt/cell/cell_reference.hpp +++ b/include/xlnt/cell/cell_reference.hpp @@ -232,12 +232,6 @@ public: /// bool operator!=(const char *reference_string) const; - // TODO: are these useful? maybe get rid of them - bool operator<(const cell_reference &other); - bool operator>(const cell_reference &other); - bool operator<=(const cell_reference &other); - bool operator>=(const cell_reference &other); - private: /// /// Index of the column. Important: this is one-indexed to conform diff --git a/source/cell/cell.cpp b/source/cell/cell.cpp index 7b3e9787..fc818e4e 100644 --- a/source/cell/cell.cpp +++ b/source/cell/cell.cpp @@ -432,11 +432,6 @@ cell &cell::operator=(const cell &rhs) return *this; } -bool operator<(cell left, cell right) -{ - return left.get_reference() < right.get_reference(); -} - std::string cell::to_repr() const { return "parent_).get_title() + "." + get_reference().to_string() + ">"; diff --git a/source/cell/cell_reference.cpp b/source/cell/cell_reference.cpp index 2982258c..fd33e35f 100644 --- a/source/cell/cell_reference.cpp +++ b/source/cell/cell_reference.cpp @@ -276,44 +276,4 @@ bool cell_reference::operator==(const cell_reference &comparand) const absolute_row_ == comparand.absolute_row_; } -bool cell_reference::operator<(const cell_reference &other) -{ - if (row_ != other.row_) - { - return row_ < other.row_; - } - - return column_ < other.column_; -} - -bool cell_reference::operator>(const cell_reference &other) -{ - if (row_ != other.row_) - { - return row_ > other.row_; - } - - return column_ > other.column_; -} - -bool cell_reference::operator<=(const cell_reference &other) -{ - if (row_ != other.row_) - { - return row_ < other.row_; - } - - return column_ <= other.column_; -} - -bool cell_reference::operator>=(const cell_reference &other) -{ - if (row_ != other.row_) - { - return row_ > other.row_; - } - - return column_ >= other.column_; -} - } // namespace xlnt diff --git a/source/cell/tests/test_cell.hpp b/source/cell/tests/test_cell.hpp index 24bde9e4..eaaba5eb 100644 --- a/source/cell/tests/test_cell.hpp +++ b/source/cell/tests/test_cell.hpp @@ -608,7 +608,7 @@ public: TS_ASSERT_EQUALS((xlnt::cell_reference("A1"), xlnt::cell_reference("B2")), xlnt::range_reference("A1:B2")); - TS_ASSERT_THROWS(xlnt::cell_reference("A1A"), xlnt::cell_coordinates_error); + TS_ASSERT_THROWS(xlnt::cell_reference("A1&"), xlnt::cell_coordinates_error); TS_ASSERT_THROWS(xlnt::cell_reference("A"), xlnt::cell_coordinates_error); auto ref = xlnt::cell_reference("$B$7"); @@ -617,10 +617,6 @@ public: TS_ASSERT(xlnt::cell_reference("A1") == "A1"); TS_ASSERT(xlnt::cell_reference("A1") != "A2"); - TS_ASSERT(xlnt::cell_reference("A1") < xlnt::cell_reference("A2")); - TS_ASSERT(xlnt::cell_reference("A2") <= xlnt::cell_reference("A2")); - TS_ASSERT(xlnt::cell_reference("A2") > xlnt::cell_reference("A1")); - TS_ASSERT(xlnt::cell_reference("A2") >= xlnt::cell_reference("A2")); } void test_anchor()