}
-std::vector<Buffer *> Buffer::getChildren() const
+std::vector<Buffer *> Buffer::getChildren(bool grand_children) const
{
std::vector<Buffer *> clist;
// loop over children
for (; it != end; ++it) {
Buffer * child = const_cast<Buffer *>(it->first);
clist.push_back(child);
- // there might be grandchildren
- std::vector<Buffer *> glist = child->getChildren();
- for (vector<Buffer *>::const_iterator git = glist.begin();
- git != glist.end(); ++git)
- clist.push_back(*git);
+ if (grand_children) {
+ // there might be grandchildren
+ std::vector<Buffer *> glist = child->getChildren();
+ for (vector<Buffer *>::const_iterator git = glist.begin();
+ git != glist.end(); ++git)
+ clist.push_back(*git);
+ }
}
return clist;
}
/// \return true if \p child is a child of this \c Buffer.
bool isChild(Buffer * child) const;
- /// return a vector with all children and grandchildren
- std::vector<Buffer *> getChildren() const;
+ /// return a vector with all children (and grandchildren)
+ std::vector<Buffer *> getChildren(bool grand_children = true) const;
/// Is buffer read-only?
bool isReadonly() const;
// in the session file in the correct order. If we close the master
// buffer, we can close or release the child buffers here too.
if (!closing_) {
- vector<Buffer *> clist = buf.getChildren();
+ vector<Buffer *> clist = buf.getChildren(false);
for (vector<Buffer *>::const_iterator it = clist.begin();
it != clist.end(); ++it) {
// If a child is dirty, do not close