X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FParagraphList.h;h=7e5cc1a869ff50b54150f09d1c85d2448731ba9c;hb=d9082639080b9de993742bd352f92e5183058cf5;hp=6cb7da38c194314fe55bdfe167abef239aaba032;hpb=0be0fcfd5907d448cd51addf83ed7032719a0692;p=lyx.git diff --git a/src/ParagraphList.h b/src/ParagraphList.h index 6cb7da38c1..7e5cc1a869 100644 --- a/src/ParagraphList.h +++ b/src/ParagraphList.h @@ -4,7 +4,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Lars Gullik Bjønnes + * \author Angus Leeming * * Full author contact details are available in file CREDITS. */ @@ -12,14 +12,36 @@ #ifndef PARAGRAPH_LIST_H #define PARAGRAPH_LIST_H -#include "paragraph.h" +#include "Paragraph.h" -#include +#include "support/RandomAccessList.h" -struct ParagraphList : public std::list -{ + +namespace lyx { + +/// Container for all kind of Paragraphs used in LyX. +class ParagraphList : public RandomAccessList { +public: + /// + ParagraphList() {} + /// + template + ParagraphList(InputIterator first, InputIterator last) + : RandomAccessList(first, last) + {} + + const Paragraph * getParagraphBefore(const_iterator const & par) const + { + // No previous paragraph. + if (par == begin()) + return nullptr; + + auto prevpar = par; + --prevpar; + return &*prevpar; + } }; -typedef std::pair PitPosPair; +} // namespace lyx #endif