]> git.lyx.org Git - features.git/commitdiff
Remove the magic boolean in getChildren() from the public interface.
authorRichard Heck <rgheck@comcast.net>
Wed, 29 Sep 2010 13:05:57 +0000 (13:05 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 29 Sep 2010 13:05:57 +0000 (13:05 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35538 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp
src/Buffer.h
src/BufferList.cpp
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiView.cpp

index 48127b5e7afd7ffcc9f8b37104ec4e979d747419..2d562c23e33ba5d7145c44aa59b38663fd493259 100644 (file)
@@ -2292,7 +2292,7 @@ void Buffer::getLanguages(std::set<Language const *> & languages) const
        for (ParConstIterator it = par_iterator_begin(); it != end; ++it)
                it->getLanguages(languages);
        // also children
-       ListOfBuffers clist = getChildren();
+       ListOfBuffers clist = getDescendents();
        ListOfBuffers::const_iterator cit = clist.begin();
        ListOfBuffers::const_iterator const cen = clist.end();
        for (; cit != cen; ++cit)
@@ -2482,7 +2482,7 @@ ListOfBuffers Buffer::allRelatives() const
 {
        if (parent())
                return masterBuffer()->allRelatives();
-       return getChildren(/* true */);
+       return getDescendents();
 }
 
 
@@ -2520,7 +2520,7 @@ bool Buffer::hasChildren() const
 }
 
 
-void Buffer::getChildren(ListOfBuffers & clist, bool grand_children) const
+void Buffer::collectChildren(ListOfBuffers & clist, bool grand_children) const
 {
        // loop over children
        Impl::BufferPositionMap::iterator it = d->children_positions.begin();
@@ -2534,15 +2534,23 @@ void Buffer::getChildren(ListOfBuffers & clist, bool grand_children) const
                clist.push_back(child);
                if (grand_children) 
                        // there might be grandchildren
-                       child->getChildren(clist /*, true */);
+                       child->collectChildren(clist, true);
        }
 }
 
 
-ListOfBuffers Buffer::getChildren(bool grand_children) const
+ListOfBuffers Buffer::getChildren() const
 {
        ListOfBuffers v;
-       getChildren(v, grand_children);
+       collectChildren(v, false);
+       return v;
+}
+
+
+ListOfBuffers Buffer::getDescendents() const
+{
+       ListOfBuffers v;
+       collectChildren(v, true);
        return v;
 }
 
@@ -3430,7 +3438,7 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
                } else 
                        errors(error_type);
                // also to the children, in case of master-buffer-view
-               ListOfBuffers clist = getChildren();
+               ListOfBuffers clist = getDescendents();
                ListOfBuffers::const_iterator cit = clist.begin();
                ListOfBuffers::const_iterator const cen = clist.end();
                for (; cit != cen; ++cit) {
index 8b5465c673d2a2979f5747bd5290f71926ca173d..a9696812bf7c458b1ae9103626166de7fe31b73b 100644 (file)
@@ -305,14 +305,6 @@ public:
        void setParent(Buffer const *);
        Buffer const * parent() const;
 
-       /// Collect all relative buffers, in the order in which they appear.
-       /// I.e., the "root" Buffer is first, then its first child, then any
-       /// of its children, etc. However, there are no duplicates in this
-       /// list.
-       /// This is "stable", too, in the sense that it returns the same
-       /// thing from whichever Buffer it is called.
-       ListOfBuffers allRelatives() const;
-
        /** Get the document's master (or \c this if this is not a
            child document)
         */
@@ -324,11 +316,23 @@ public:
        /// \return true if this \c Buffer has children
        bool hasChildren() const;
        
-       /// return a vector of all children (and grandchildren)
-       ListOfBuffers getChildren(bool grand_children = true) const;
+       /// \return a list of the direct children of this Buffer.
+       /// this list has no duplicates and is in the order in which
+       /// the children appear.
+       ListOfBuffers getChildren() const;
+       
+       /// \return a list of all descendents of this Buffer (children,
+       /// grandchildren, etc). this list has no duplicates and is in
+       /// the order in which the children appear.
+       ListOfBuffers getDescendents() const;
 
-       /// Add all children (and grandchildren) to supplied vector
-       void getChildren(ListOfBuffers & children, bool grand_children = true) const;
+       /// Collect all relative buffers, in the order in which they appear.
+       /// I.e., the "root" Buffer is first, then its first child, then any
+       /// of its children, etc. However, there are no duplicates in this
+       /// list.
+       /// This is "stable", too, in the sense that it returns the same
+       /// thing from whichever Buffer it is called.
+       ListOfBuffers allRelatives() const;
 
        /// Is buffer read-only?
        bool isReadonly() const;
@@ -606,7 +610,10 @@ private:
        /// of loaded child documents).
        support::FileNameList const & 
                getBibfilesCache(UpdateScope scope = UpdateMaster) const;
+       ///
+       void collectChildren(ListOfBuffers & children, bool grand_children) const;
 
+       
        /// Use the Pimpl idiom to hide the internals.
        class Impl;
        /// The pointer never changes although *pimpl_'s contents may.
index 15abbd830c5833c5c688f55f94e97101c26c0b99..466c924bdb2db851a29fb013703ddb4870966626 100644 (file)
@@ -276,7 +276,7 @@ Buffer * BufferList::getBufferFromTmp(string const & s)
                        if (suffixIs(s, master_name))
                                return *it;
                        // if not, try with the children
-                       ListOfBuffers clist = (*it)->getChildren();
+                       ListOfBuffers clist = (*it)->getDescendents();
                        ListOfBuffers::const_iterator cit = clist.begin();
                        ListOfBuffers::const_iterator cend = clist.end();
                        for (; cit != cend; ++cit) {
index 68bc7ab4b8d8ab41b6839ea50a22ee523283654e..782a05f7ea16538e31f8ebd6bbc2691bb416cdbd 100644 (file)
@@ -3045,7 +3045,7 @@ void GuiDocument::updateIncludeonlys()
                masterChildModule->maintainAuxCB->setEnabled(true);
        }
        QTreeWidgetItem * item = 0;
-       ListOfBuffers children = buffer().getChildren(false);
+       ListOfBuffers children = buffer().getChildren();
        ListOfBuffers::const_iterator it  = children.begin();
        ListOfBuffers::const_iterator end = children.end();
        bool has_unincluded = false;
index 8db725e8530c68e8074aed501b584f69f8d8152b..108d465e8a27491848b08351ee239bf90c5ee117 100644 (file)
@@ -2328,7 +2328,7 @@ bool GuiView::closeBuffer(Buffer & buf)
        // 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_) {
-               ListOfBuffers clist = buf.getChildren(false);
+               ListOfBuffers clist = buf.getChildren();
                ListOfBuffers::const_iterator it = clist.begin();
                ListOfBuffers::const_iterator const bend = clist.end();
                for (; it != bend; ++it) {