olena-2.0-447-gc6262b2 Small fixes in scribo.

* scribo/core/line_set.hh: Add update_types(). * scribo/core/paragraph_info.hh: Set paragraph as valid when a line is added. * scribo/core/paragraph_set.hh: Add a forward declaration. * scribo/text/link_lines.hh: Add more documentation. --- scribo/ChangeLog | 13 +++++++++++++ scribo/scribo/core/line_set.hh | 19 ++++++++++++++++++- scribo/scribo/core/paragraph_info.hh | 4 +++- scribo/scribo/core/paragraph_set.hh | 7 +++++++ scribo/scribo/text/link_lines.hh | 8 ++++++-- 5 files changed, 47 insertions(+), 4 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index f356280..a438ae0 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,18 @@ 2013-03-26 Guillaume Lazzara <z@lrde.epita.fr> + Small fixes in scribo. + + * scribo/core/line_set.hh: Add update_types(). + + * scribo/core/paragraph_info.hh: Set paragraph as valid when a + line is added. + + * scribo/core/paragraph_set.hh: Add a forward declaration. + + * scribo/text/link_lines.hh: Add more documentation. + +2013-03-26 Guillaume Lazzara <z@lrde.epita.fr> + * tests/binarization/Makefile.am: Fix EXTRA_DIST file names. 2013-03-04 Roland Levillain <roland@lrde.epita.fr> diff --git a/scribo/scribo/core/line_set.hh b/scribo/scribo/core/line_set.hh index 4880a77..26bbb6d 100644 --- a/scribo/scribo/core/line_set.hh +++ b/scribo/scribo/core/line_set.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Copyright (C) 2009, 2010, 2011, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -133,6 +133,10 @@ namespace scribo template <typename F> void update_tags(const mln::Function_v2b<F>& f, line::Tag tag); + /// Update Type of lines set to 'false' in \p f with \p tag. + template <typename F> + void update_types(const mln::Function_v2b<F>& f, line::Type type); + /// Create a copy of this line_set<L> line_set<L> duplicate() const; @@ -345,6 +349,19 @@ namespace scribo data_->infos_[i].update_tag(tag); } + template <typename L> + template <typename F> + inline + void + line_set<L>::update_types(const mln::Function_v2b<F>& f_, + line::Type type) + { + const F& f = exact(f_); + + for_all_lines_info(i, data_->infos_) + if (!f(i)) + data_->infos_[i].update_type(type); + } template <typename L> inline diff --git a/scribo/scribo/core/paragraph_info.hh b/scribo/scribo/core/paragraph_info.hh index 31e5aa0..1bbf101 100644 --- a/scribo/scribo/core/paragraph_info.hh +++ b/scribo/scribo/core/paragraph_info.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of Olena. // @@ -128,6 +129,7 @@ namespace scribo // More data may need to be updated! tag_ = paragraph::Needs_Precise_Stats_Update; + is_valid_ = true; } template <typename L> diff --git a/scribo/scribo/core/paragraph_set.hh b/scribo/scribo/core/paragraph_set.hh index 69194be..42bf4a3 100644 --- a/scribo/scribo/core/paragraph_set.hh +++ b/scribo/scribo/core/paragraph_set.hh @@ -116,6 +116,13 @@ namespace scribo scribo::paragraph_set<L> paragraph(const scribo::line_set<L>& lines); + + /// \brief Construct a paragraph set from line links information. + template <typename L> + scribo::paragraph_set<L> + paragraph(const line_links<L>& llinks); + + } // end of namespace scribo::make diff --git a/scribo/scribo/text/link_lines.hh b/scribo/scribo/text/link_lines.hh index a1e746e..0c5e733 100644 --- a/scribo/scribo/text/link_lines.hh +++ b/scribo/scribo/text/link_lines.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2011, 2012 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2011, 2012, 2013 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -52,6 +52,10 @@ namespace scribo /*! \brief Link text lines to prepare paragraph construction. + + Lines MUST be tagged as line::Text to be considered in this + processing. + \ingroup grptext */ template <typename L> -- 1.7.2.5
participants (1)
-
Guillaume Lazzara