if (!ploader)
return;
- InsetIterator it = inset_iterator_begin(*d->inset);
- InsetIterator const end = inset_iterator_end(*d->inset);
- for (; it != end; ++it)
+ InsetIterator it = begin(*d->inset);
+ InsetIterator const itend = end(*d->inset);
+ for (; it != itend; ++it)
it->addPreview(it, *ploader);
ploader->startLoading();
if (!parent())
clearIncludeList();
- for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
+ for (InsetIterator it = begin(inset()); it; ++it) {
it->collectBibKeys(it, checkedFiles);
if (it->lyxCode() == BIBITEM_CODE) {
if (parent() != nullptr)
docstring const oldname = from_utf8(func.getArg(0));
docstring const newname = from_utf8(func.getArg(1));
- InsetIterator it = inset_iterator_begin(inset());
- InsetIterator const end = inset_iterator_end(inset());
+ InsetIterator it = begin(inset());
+ InsetIterator const itend = end(inset());
bool success = false;
- for (; it != end; ++it) {
+ for (; it != itend; ++it) {
if (it->lyxCode() == BRANCH_CODE) {
InsetBranch & ins = static_cast<InsetBranch &>(*it);
if (ins.branch() == oldname) {
void Buffer::getUsedBranches(std::list<docstring> & result, bool const from_master) const
{
- InsetIterator it = inset_iterator_begin(inset());
- InsetIterator const end = inset_iterator_end(inset());
- for (; it != end; ++it) {
- if (it->lyxCode() == BRANCH_CODE) {
- InsetBranch & br = static_cast<InsetBranch &>(*it);
+ for (Inset const & it : inset()) {
+ if (it.lyxCode() == BRANCH_CODE) {
+ InsetBranch const & br = static_cast<InsetBranch const &>(it);
docstring const name = br.branch();
if (!from_master && !params().branchlist().find(name))
result.push_back(name);
result.push_back(name);
continue;
}
- if (it->lyxCode() == INCLUDE_CODE) {
+ if (it.lyxCode() == INCLUDE_CODE) {
// get buffer of external file
InsetInclude const & ins =
- static_cast<InsetInclude const &>(*it);
+ static_cast<InsetInclude const &>(it);
Buffer * child = ins.loadIfNeeded();
if (!child)
continue;
string const paramName = "key";
UndoGroupHelper ugh(this);
- InsetIterator it = inset_iterator_begin(inset());
+ InsetIterator it = begin(inset());
for (; it; ++it) {
if (it->lyxCode() != CITE_CODE)
continue;
}
// Check this buffer
- Inset & inset = buffer.inset();
- InsetIterator it = inset_iterator_begin(inset);
- InsetIterator const end = inset_iterator_end(inset);
- for (; it != end; ++it)
- it->initUnicodeMath();
+ for (Inset const & it : buffer.inset())
+ it.initUnicodeMath();
if (!for_master)
return;
// Prepare the paragraphs and insets for insertion.
insertion.swap(in.paragraphs());
- InsetIterator const i_end = inset_iterator_end(in);
- for (InsetIterator it = inset_iterator_begin(in); it != i_end; ++it) {
+ InsetIterator const i_end = end(in);
+ for (InsetIterator it = begin(in); it != i_end; ++it) {
// Even though this will also be done later, it has to be done here
// since some inset might try to access the buffer() member.
it->setBuffer(const_cast<Buffer &>(buffer));
if (oldname == newname)
continue;
// adapt the references
- for (InsetIterator itt = inset_iterator_begin(in);
+ for (InsetIterator itt = begin(in);
itt != i_end; ++itt) {
if (itt->lyxCode() == REF_CODE) {
InsetCommand * ref = itt->asInsetCommand();
if (oldname == newname)
break;
// adapt the references
- for (InsetIterator itt = inset_iterator_begin(in); itt != i_end; ++itt) {
+ for (InsetIterator itt = begin(in); itt != i_end; ++itt) {
if (itt->lyxCode() == REF_CODE) {
InsetCommand & ref = static_cast<InsetCommand &>(*itt);
if (ref.getParam("reference") == oldname)
if (oldkey == newkey)
break;
// adapt the references
- for (InsetIterator itt = inset_iterator_begin(in);
+ for (InsetIterator itt = begin(in);
itt != i_end; ++itt) {
if (itt->lyxCode() == CITE_CODE) {
InsetCommand * ref = itt->asInsetCommand();
// layouts
ParIterator it = par_iterator_begin(in);
- ParIterator end = par_iterator_end(in);
+ ParIterator pend = par_iterator_end(in);
// for remembering which layouts we've had to add
set<docstring> newlayouts;
- for (; it != end; ++it) {
+ for (; it != pend; ++it) {
docstring const name = it->layout().name();
// the pasted text will keep their own layout name. If this layout does
}
// character styles and hidden table cells
- InsetIterator const i_end = inset_iterator_end(in);
- for (InsetIterator iit = inset_iterator_begin(in); iit != i_end; ++iit) {
+ InsetIterator const i_end = end(in);
+ for (InsetIterator iit = begin(in); iit != i_end; ++iit) {
InsetCode const code = iit->lyxCode();
if (code == FLEX_CODE) {
// FIXME: Should we verify all InsetCollapsible?
}
-InsetIterator inset_iterator_begin(Inset & inset)
+InsetIterator begin(Inset & inset)
{
InsetIterator it = InsetIterator(inset);
it.forwardInset();
}
-InsetIterator inset_iterator_end(Inset & inset)
+InsetIterator end(Inset & inset)
{
return InsetIterator(inset);
}
Inset & operator*() { return *nextInset(); }
};
-InsetIterator inset_iterator_begin(Inset & inset);
+InsetIterator begin(Inset & inset);
-InsetIterator inset_iterator_end(Inset & inset);
+InsetIterator end(Inset & inset);
void getGraphicsGroups(Buffer const & b, set<string> & ids)
{
- Inset & inset = b.inset();
- InsetIterator it = inset_iterator_begin(inset);
- InsetIterator const end = inset_iterator_end(inset);
- for (; it != end; ++it) {
- InsetGraphics const * ins = it->asInsetGraphics();
+ for (Inset const & it : b.inset()) {
+ InsetGraphics const * ins = it.asInsetGraphics();
if (!ins)
continue;
InsetGraphicsParams const & inspar = ins->getParams();
int n = 0;
if (groupId.empty())
return n;
- Inset & inset = b.inset();
- InsetIterator it = inset_iterator_begin(inset);
- InsetIterator const end = inset_iterator_end(inset);
- for (; it != end; ++it) {
- InsetGraphics const * ins = it->asInsetGraphics();
+ for (Inset const & it : b.inset()) {
+ InsetGraphics const * ins = it.asInsetGraphics();
if (!ins)
continue;
if (ins->getParams().groupId == groupId)
{
if (groupId.empty())
return string();
- Inset & inset = b.inset();
- InsetIterator it = inset_iterator_begin(inset);
- InsetIterator const end = inset_iterator_end(inset);
- for (; it != end; ++it) {
- InsetGraphics const * ins = it->asInsetGraphics();
+ for (Inset const & it : b.inset()) {
+ InsetGraphics const * ins = it.asInsetGraphics();
if (!ins)
continue;
InsetGraphicsParams const & inspar = ins->getParams();
// This handles undo groups automagically
UndoGroupHelper ugh(&b);
Inset & inset = b.inset();
- InsetIterator it = inset_iterator_begin(inset);
- InsetIterator const end = inset_iterator_end(inset);
- for (; it != end; ++it) {
+ InsetIterator it = begin(inset);
+ InsetIterator const itend = end(inset);
+ for (; it != itend; ++it) {
InsetGraphics * ins = it->asInsetGraphics();
if (!ins)
continue;
} else if (ltCaption(row)) {
// Inside longtable caption rows, we must only output the caption inset
// with its content and omit anything outside of that (see #10791)
- InsetIterator it = inset_iterator_begin(*const_cast<InsetTableCell *>(inset));
- InsetIterator i_end = inset_iterator_end(*const_cast<InsetTableCell *>(inset));
- for (; it != i_end; ++it) {
- if (it->lyxCode() != CAPTION_CODE)
+ InsetTableCell & tc_inset = *const_cast<InsetTableCell *>(inset);
+ for (Inset const & it : tc_inset) {
+ if (it.lyxCode() != CAPTION_CODE)
continue;
- it->latex(os, runparams);
+ it.latex(os, runparams);
break;
}
} else if (!isPartOfMultiRow(row, c)) {