>>>>> "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

Abdelrazak> Abdelrazak Younes wrote:
>> Ozgur Ugras BARAN wrote:
>>> This small patch prevents LOF, LOT always selects the last entry.
>>> LOT/LOF still does not follow the cursor, yet, but for this, we
>>> need serious update in TocBackend.
>>  Not that much work IMO. The problem is the way we search for the
>> toc item is very crude. Look at the comment in TocBackend::item():
>> 
>> // A good solution for Items inside insets would be to do: // //if
>> (std::distance(it->par_it_, current) <= 0) // return it; // // But
>> for an unknown reason, std::distance(current, it->par_it_) always
>> // returns a positive value and std::distance(it->par_it_, current)
>> // takes forever... // So for now, we do: if (it->par_it_.pit() <=
>> par_it_text.pit()) return it;
>> 
>> This is not correct and will work only for top-level items. So if
>> someone could implement an <= operator for ParConstIterator, that
>> would solve our problem. Jean-Marc, Andre, your the experts in this
>> field, could you implement this:
>> 
>> bool operator<=(ParConstIterator const &, ParConstIterator const
>> &);

Abdelrazak> I've done it but I am not sure I got it right. JMarc?

Here is what I have. Not tested (not even sure it compiles). I use the
operator< for cursor slice, that looks both at pit and pos.

JMarc

Index: src/DocIterator.cpp
===================================================================
--- src/DocIterator.cpp	(révision 18333)
+++ src/DocIterator.cpp	(copie de travail)
@@ -553,6 +553,27 @@ std::ostream & operator<<(std::ostream &
 }
 
 
+bool operator<(DocIterator const & p, DocIterator const & q) {
+	size_t depth = std::min(p.depth(), q.depth());
+	for (size_t i = 0 ; i < depth ; ++i)
+		if (p[i] != q[i])
+			return p[i] < q[i];
+	return p.depth() < q.depth();
+}
+
+
+bool operator>(DocIterator const & p, DocIterator const & q)
+{
+	return q < p;
+}
+
+
+bool operator<=(DocIterator const & p, DocIterator const & q)
+{
+	return !(q < p);
+}
+
+
 
 ///////////////////////////////////////////////////////
 

Reply via email to