Lars Gullik Bjønnes a écrit :
Abdelrazak Younes <[EMAIL PROTECTED]> writes:
| > I am not sure there are many precedence for capitalized member variables
| > in LyX code.
|
| There are some from which I took example... I think you guys should
| agree on coding style guidelines and write a _small_ document with it.
| Second step would be to actually use it all through the code ;-)
We have rules and guidelines... you just have to read them.
development/Code_rules/
OK, sorry, I didn't see them.
| >> bool erase(iterator start, iterator end) {
| >> size_t startpos = std::distance(Container_.begin(),
static_cast<base_it>(start));
| >> size_t endpos = std::distance(Container_.begin(),
static_cast<base_it>(end));
| >> return erase(startpos, endpos-startpos);
| >> }
| > const + spacing.
|
| const?
make endpos const.
enpos is a size_t, do you really think there is a benefit to make it
const? I believe you and I made the change but I'd really like to know
the benefits... And by the way, why not startpos?
| Thanks for the comments Andre. One question about the spacing: is it
| because of your editor or just that you find it easier to read?
In my case it is 'easier to read'.
OK, I believe my class is now compliant with your rules and guidelines.
Would you please consider applying the patch to trunk? If there is some
bits you want to change, it would still be possible to do so after
inclusion, wouldn't it?
I'll send the last version of it if you want.
Abdel.
Index: D:/msys/home/yns/src/lyx-svn/trunk/src/ParagraphList_fwd.h
===================================================================
--- D:/msys/home/yns/src/lyx-svn/trunk/src/ParagraphList_fwd.h (revision 13339)
+++ D:/msys/home/yns/src/lyx-svn/trunk/src/ParagraphList_fwd.h (working copy)
@@ -7,27 +7,37 @@
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS.
+ *
+ * \todo Rename this file to ParagraphList.h
*/
#ifndef PARAGRAPH_LIST_FWD_H
#define PARAGRAPH_LIST_FWD_H
#include "paragraph.h"
+#include "RandomAccessList.h"
-#include <vector>
+/// Container for all kind of Paragraphs used in Lyx.
+/**
+The line below could have been enougth
+ typedef RandomAccessList<Paragraph> ParagraphList;
-class ParagraphList : public std::vector<Paragraph>
+but in order to let other files that forward declare ParagraphList, we
+have to derive it from RandomAccessList.
+And then there might be some useful specialisation depending on the
+type of Paragraph we want to store... food for thought.
+*/
+
+class ParagraphList: public RandomAccessList<Paragraph>
{
public:
- ///
- typedef std::vector<Paragraph> BaseType;
- ///
- ParagraphList();
- ///
- template <class Iter>
- ParagraphList(Iter beg, Iter end)
- : BaseType(beg, end)
- {}
+ ParagraphList()
+ : RandomAccessList<Paragraph> () {}
+ ParagraphList(ParagraphList const & ext_list, size_t pos, size_t length)
+ : RandomAccessList<Paragraph> (ext_list, pos, length) {}
+ template<class It>
+ ParagraphList(It it_start, It it_end)
+ : RandomAccessList<Paragraph> (it_start, it_end) {}
};
#endif