* scribo/core/component_set.hh,
* scribo/core/line_set.hh,
* scribo/core/object_links.hh,
* scribo/debug/highlight_text_area.hh,
* scribo/filter/object_groups_with_holes.hh,
* scribo/filter/objects_with_holes.hh,
* scribo/postprocessing/fill_object_holes.hh,
* scribo/table/internal/align_lines.hh: Use value::next to replace
evil casts.
---
scribo/ChangeLog | 14 ++++++++++++++
scribo/scribo/core/component_set.hh | 7 ++++---
scribo/scribo/core/line_set.hh | 2 +-
scribo/scribo/core/object_links.hh | 4 ++--
scribo/scribo/debug/highlight_text_area.hh | 2 +-
scribo/scribo/filter/object_groups_with_holes.hh | 5 ++---
scribo/scribo/filter/objects_with_holes.hh | 11 +++++------
scribo/scribo/postprocessing/fill_object_holes.hh | 6 +++---
scribo/scribo/table/internal/align_lines.hh | 2 +-
9 files changed, 33 insertions(+), 20 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 986678e..3a365b4 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-21 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Make use of value::next routine in Scribo.
+
+ * scribo/core/component_set.hh,
+ * scribo/core/line_set.hh,
+ * scribo/core/object_links.hh,
+ * scribo/debug/highlight_text_area.hh,
+ * scribo/filter/object_groups_with_holes.hh,
+ * scribo/filter/objects_with_holes.hh,
+ * scribo/postprocessing/fill_object_holes.hh,
+ * scribo/table/internal/align_lines.hh: Use value::next to replace
+ evil casts.
+
2010-10-11 Guillaume Lazzara <z(a)lrde.epita.fr>
Fix namespace ambiguities.
diff --git a/scribo/scribo/core/component_set.hh b/scribo/scribo/core/component_set.hh
index 937ba4f..77cbaa5 100644
--- a/scribo/scribo/core/component_set.hh
+++ b/scribo/scribo/core/component_set.hh
@@ -37,6 +37,7 @@
# include <mln/data/fill.hh>
# include <mln/util/array.hh>
+# include <mln/value/next.hh>
# include <mln/accu/pair.hh>
# include <mln/accu/center.hh>
@@ -315,7 +316,7 @@ namespace scribo
{
typedef mln_site(L) P;
- infos_.reserve(value::next(ncomps_));
+ infos_.reserve(mln::value::next(ncomps_));
infos_.append(component_info()); // Component 0, i.e. the background.
for_all_comp_data(i, attribs)
@@ -333,7 +334,7 @@ namespace scribo
{
typedef mln_site(L) P;
- infos_.reserve(value::next(ncomps_));
+ infos_.reserve(mln::value::next(ncomps_));
infos_.append(component_info()); // Component 0, i.e. the background.
for_all_comp_data(i, attribs)
@@ -509,7 +510,7 @@ namespace scribo
mln_concrete(L)
component_set<L>::valid_comps_image_() const
{
- mln::util::array<bool> f(value::next(this->data_->ncomps_));
+ mln::util::array<bool> f(mln::value::next(this->data_->ncomps_));
f(0) = true;
for_all_comps(c, (*this))
diff --git a/scribo/scribo/core/line_set.hh b/scribo/scribo/core/line_set.hh
index 5dca629..6ef3294 100644
--- a/scribo/scribo/core/line_set.hh
+++ b/scribo/scribo/core/line_set.hh
@@ -244,7 +244,7 @@ namespace scribo
// FIXME: object_groups should store the relation 'group -> comp'.
mln::util::array< mln::util::array<component_id_t> >
- group_to_comps(unsigned(n_groups) + 1);
+ group_to_comps(value::next(n_groups));
// 1st pass - Compute data.
diff --git a/scribo/scribo/core/object_links.hh b/scribo/scribo/core/object_links.hh
index 09e1cfe..af7dc38 100644
--- a/scribo/scribo/core/object_links.hh
+++ b/scribo/scribo/core/object_links.hh
@@ -148,7 +148,7 @@ namespace scribo
template <typename L>
object_links<L>::object_links(const component_set<L>& components)
{
- data_ = new data_t(components, unsigned(components.nelements()) + 1);
+ data_ = new data_t(components, value::next(components.nelements()));
}
@@ -156,7 +156,7 @@ namespace scribo
object_links<L>::object_links(const component_set<L>& components,
unsigned value)
{
- data_ = new data_t(components, unsigned(components.nelements()) + 1,
+ data_ = new data_t(components, value::next(components.nelements()),
value);
}
diff --git a/scribo/scribo/debug/highlight_text_area.hh
b/scribo/scribo/debug/highlight_text_area.hh
index 1ff673e..5fc9329 100644
--- a/scribo/scribo/debug/highlight_text_area.hh
+++ b/scribo/scribo/debug/highlight_text_area.hh
@@ -263,7 +263,7 @@ namespace scribo
initialize(mask, input);
data::fill(mask, false);
- mln::util::array<mln_box(I)> bbox(unsigned(components.nelements()) + 1);
+ mln::util::array<mln_box(I)> bbox(value::next(components.nelements()));
for_all_comps(i, components)
if (components(i).is_valid())
diff --git a/scribo/scribo/filter/object_groups_with_holes.hh
b/scribo/scribo/filter/object_groups_with_holes.hh
index e833092..b86b10e 100644
--- a/scribo/scribo/filter/object_groups_with_holes.hh
+++ b/scribo/scribo/filter/object_groups_with_holes.hh
@@ -172,13 +172,12 @@ namespace scribo
// Will store the first background component id associated
// to a group.
util::array<unsigned> bg_comps(
- static_cast<unsigned>(components.nelements()) + 1, 0);
+ value::next(components.nelements()), 0);
// Will 'True' if a group has at least two background
// components.
fun::i2v::array<bool>
- to_keep(static_cast<unsigned>(components.nelements()) + 1,
- false);
+ to_keep(value::next(components.nelements()), false);
const L& lbl = components.labeled_image();
diff --git a/scribo/scribo/filter/objects_with_holes.hh
b/scribo/scribo/filter/objects_with_holes.hh
index fdad0d9..09eaad5 100644
--- a/scribo/scribo/filter/objects_with_holes.hh
+++ b/scribo/scribo/filter/objects_with_holes.hh
@@ -173,10 +173,10 @@ namespace scribo
L bboxes_ima;
util::array<util::set<unsigned> > bg_comps(
- static_cast<unsigned>(components.nelements()) + 1);
+ value::next(components.nelements()));
fun::i2v::array<bool>
- to_keep(static_cast<unsigned>(components.nelements()) + 1,
+ to_keep(value::next(components.nelements()),
false);
const L& lbl = components.labeled_image();
@@ -337,13 +337,12 @@ namespace scribo
L bboxes_ima;
util::array<unsigned> bg_comps(
- static_cast<unsigned>(components.nelements()) + 1, 0);
+ value::next(components.nelements()), 0);
util::array<bool> bg_comps_done(
- static_cast<unsigned>(components.nelements()) + 1, false);
+ value::next(components.nelements()), false);
fun::i2v::array<bool>
- to_keep(static_cast<unsigned>(components.nelements()) + 1,
- false);
+ to_keep(value::next(components.nelements()), false);
const L& lbl = components.labeled_image();
diff --git a/scribo/scribo/postprocessing/fill_object_holes.hh
b/scribo/scribo/postprocessing/fill_object_holes.hh
index 14416be..ea77fb6 100644
--- a/scribo/scribo/postprocessing/fill_object_holes.hh
+++ b/scribo/scribo/postprocessing/fill_object_holes.hh
@@ -174,12 +174,12 @@ namespace scribo
L bboxes_ima;
util::array<unsigned> bg_comps(
- unsigned(components.nelements()) + 1, 0);
+ value::next(components.nelements()), 0);
util::array<bool> bg_comps_done(
- unsigned(components.nelements()) + 1, false);
+ value::next(components.nelements()), false);
mln::fun::i2v::array<bool>
- to_keep(unsigned(components.nelements()) + 1, false);
+ to_keep(value::next(components.nelements()), false);
const L& lbl = components.labeled_image();
diff --git a/scribo/scribo/table/internal/align_lines.hh
b/scribo/scribo/table/internal/align_lines.hh
index 01f9c39..7b31548 100644
--- a/scribo/scribo/table/internal/align_lines.hh
+++ b/scribo/scribo/table/internal/align_lines.hh
@@ -142,7 +142,7 @@ namespace scribo
// Init box2line
mln::util::array<int>
- box2line(unsigned(lines.nelements()) + 1, -1);
+ box2line(value::next(lines.nelements()), -1);
// Find the line with the highest element count.
unsigned max_nelts = 0;
--
1.5.6.5