<< to_utf8(style) << "'\n"
<< "All layouts so far:"
<< endl;
- for (size_t i = 0; i != tclass.layoutCount(); ++i)
- lyxerr << to_utf8(tclass.layout(i)->name())
- << endl;
+ DocumentClass::const_iterator lit = tclass.begin();
+ DocumentClass::const_iterator len = tclass.end();
+ for (; lit != len; ++lit)
+ lyxerr << to_utf8((*lit)->name()) << endl;
//lexrc.printError("Cannot copy known "
// "style `$$Token'");
toclevel = start->layout()->toclevel;
if (toclevel == Layout::NOT_IN_TOC)
continue;
- for (size_t i = 0; i != tc.layoutCount(); ++i) {
- LayoutPtr const & lt = tc.layout(i);
+ DocumentClass::const_iterator lit = tc.begin();
+ DocumentClass::const_iterator len = tc.end();
+ for (; lit != len; ++lit) {
+ LayoutPtr const & lt = *lit;
if (lt->toclevel == toclevel + 1 &&
start->layout()->labeltype == lt->labeltype) {
start->setLayout(lt);
toclevel = start->layout()->toclevel;
if (toclevel == Layout::NOT_IN_TOC)
continue;
- for (size_t i = 0; i != tc.layoutCount(); ++i) {
- LayoutPtr const & lt = tc.layout(i);
+ DocumentClass::const_iterator lit = tc.begin();
+ DocumentClass::const_iterator len = tc.end();
+ for (; lit != len; ++lit) {
+ LayoutPtr const & lt = *lit;
if (lt->toclevel == toclevel - 1 &&
start->layout()->labeltype == lt->labeltype) {
start->setLayout(lt);
min_toclevel_ = Layout::NOT_IN_TOC;
max_toclevel_ = Layout::NOT_IN_TOC;
- for (size_t i = 0; i != layoutCount(); ++i) {
- int const toclevel = layout(i)->toclevel;
+ DocumentClass::const_iterator lit = begin();
+ DocumentClass::const_iterator len = end();
+ for (; lit != len; ++lit) {
+ Layout const & lt = **lit;
+ int const toclevel = lt.toclevel;
if (toclevel != Layout::NOT_IN_TOC) {
if (min_toclevel_ == Layout::NOT_IN_TOC)
min_toclevel_ = toclevel;
typedef std::vector<LayoutPtr> LayoutList;
/// The inset layouts available to this class
typedef std::map<docstring, InsetLayout> InsetLayouts;
+ ///
+ typedef LayoutList::const_iterator const_iterator;
+
+ ///////////////////////////////////////////////////////////////////
+ // Iterators
+ ///////////////////////////////////////////////////////////////////
+ /// Note that this returns a (LayoutPtr *). We really need a custom
+ /// iterator here.
+ const_iterator begin() const { return layoutlist_.begin(); }
+ ///
+ const_iterator end() const { return layoutlist_.end(); }
+
///////////////////////////////////////////////////////////////////
// Layout Info
{ return emptylayout_; }
/// Enumerate the paragraph styles.
size_t layoutCount() const { return layoutlist_.size(); }
- /// Access the paragraph styles.
- LayoutPtr const & layout(size_t index) const { return layoutlist_[index]; }
///
bool hasLayout(docstring const & name) const;
///
QString const no = qt_("No");
QString const yes = qt_("Yes");
QTreeWidgetItem * item = 0;
- for (size_t i = 0; i != tclass.layoutCount(); ++i) {
- Layout const & lt = *tclass.layout(i);
+
+ DocumentClass::const_iterator lit = tclass.begin();
+ DocumentClass::const_iterator len = tclass.end();
+ for (; lit != len; ++lit) {
+ Layout const & lt = **lit;
int const toclevel = lt.toclevel;
if (toclevel != Layout::NOT_IN_TOC && lt.labeltype == LABEL_COUNTER) {
item = new QTreeWidgetItem(numberingModule->tocTW);
text_class_ = text_class;
model_->clear();
- for (size_t i = 0; i != text_class_->layoutCount(); ++i) {
- Layout const & lt = *text_class_->layout(i);
+ DocumentClass::const_iterator lit = text_class_->begin();
+ DocumentClass::const_iterator len = text_class_->end();
+ for (; lit != len; ++lit) {
+ Layout const & lt = **lit;
docstring const & name = lt.name();
// if this inset requires the empty layout, we skip the default
// layout