Reviewers: lemzwerg, Message: commit e3c676f1f477818504992ac6c4c938aa56e69b78 Author: Han-Wen Nienhuys <han...@lilypond.org> Date: Fri Feb 28 14:48:56 2020 +0100
Add some const declarations to page breaking code https://sourceforge.net/p/testlilyissues/issues/5820 http://codereview.appspot.com/569490044 Description: Add some const declarations to page breaking code Please review this at https://codereview.appspot.com/569490044/ Affected files (+6, -6 lines): M lily/constrained-breaking.cc M lily/include/constrained-breaking.hh M lily/include/page-breaking.hh M lily/page-breaking.cc Index: lily/constrained-breaking.cc diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc index eba3b76390d6a83ff1ab607c31234d1a1c28bf93..9be00a8ac4bc7124880a1191fedf277870957a4a 100644 --- a/lily/constrained-breaking.cc +++ b/lily/constrained-breaking.cc @@ -328,7 +328,7 @@ Constrained_breaking::min_system_count (vsize start, vsize end) } vsize -Constrained_breaking::max_system_count (vsize start, vsize end) +Constrained_breaking::max_system_count (vsize start, vsize end) const { vsize brk = (end >= start_.size ()) ? breaks_.size () - 1 : starting_breakpoints_[end]; return brk - starting_breakpoints_[start]; Index: lily/include/constrained-breaking.hh diff --git a/lily/include/constrained-breaking.hh b/lily/include/constrained-breaking.hh index f4eccddfd498f18b606eedd41b8cea92dc590652..789b884a478ea091773346308e63c57adf98e378 100644 --- a/lily/include/constrained-breaking.hh +++ b/lily/include/constrained-breaking.hh @@ -163,7 +163,7 @@ public: Constrained_breaking (Paper_score *ps); Constrained_breaking (Paper_score *ps, std::vector<vsize> const &start_col_posns); - vsize max_system_count (vsize start, vsize end); + vsize max_system_count (vsize start, vsize end) const; vsize min_system_count (vsize start, vsize end); private: Index: lily/include/page-breaking.hh diff --git a/lily/include/page-breaking.hh b/lily/include/page-breaking.hh index 7999e1d5e809ffff2a1a415788cba88aa6c13ebb..2e6b75d7d1d3e795b4af37850cd15b1f4598b6e9 100644 --- a/lily/include/page-breaking.hh +++ b/lily/include/page-breaking.hh @@ -86,14 +86,14 @@ struct Break_position /* lexicographic in (system_spec_index_, score_break_) */ - bool operator < (const Break_position &other) + bool operator < (const Break_position &other) const { return (system_spec_index_ == VPOS && other.system_spec_index_ != VPOS) || (system_spec_index_ < other.system_spec_index_) || (system_spec_index_ == other.system_spec_index_ && score_break_ < other.score_break_); } - bool operator <= (const Break_position &other) + bool operator <= (const Break_position &other) const { return (system_spec_index_ == VPOS) || (system_spec_index_ < other.system_spec_index_ && other.system_spec_index_ != VPOS) @@ -224,7 +224,7 @@ private: mutable std::vector<Real> page_height_cache_; mutable std::vector<Real> last_page_height_cache_; - std::vector<Break_position> chunk_list (vsize start, vsize end); + std::vector<Break_position> chunk_list (vsize start, vsize end) const; Line_division system_count_bounds (std::vector<Break_position> const &chunks, bool min); void line_breaker_args (vsize i, Break_position const &start, Index: lily/page-breaking.cc diff --git a/lily/page-breaking.cc b/lily/page-breaking.cc index 5b2b771bb9083e4f7e59af4f78ba88cf2c353d34..8d44831e8b9e5d07bd351a05db7558d07fa9c06e 100644 --- a/lily/page-breaking.cc +++ b/lily/page-breaking.cc @@ -823,7 +823,7 @@ Page_breaking::find_chunks_and_breaks (Break_predicate is_break, Prob_break_pred } vector<Break_position> -Page_breaking::chunk_list (vsize start_index, vsize end_index) +Page_breaking::chunk_list (vsize start_index, vsize end_index) const { Break_position start = breaks_[start_index]; Break_position end = breaks_[end_index];