Richard Heck wrote:
This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.

Some C++ comments:

Please don't forget to put a trailing dot at the end of the short title for Doxygen comments.


+       enum ReadType { BASECLASS, MERGE, MODULE };

Some comments are in order.


+       bool isModular() { return modular_; };
+       ///
+       bool isModular() const { return modular_; }

The first one doesn't bring anything and I am surprised actually that it compiles at all (I guess this is because you don't use it yet).


+       /// need to reset this.
+       void markAsModular() { modular_ = true; }

I'd prefer:

  void setModular(bool modular) { modular_ = modular; }


+       LFUN_MODULES_CLEAR,              // rgh, 20070825
+       LFUN_MODULE_ADD,                 // rgh, 20070825

Maybe LFUN_LAYOUT_MODULES_CLEAR/ADD to clarify the intent?


+bool BufferParams::addLayoutModule(string modName, bool makeClass) {
+       LayoutModuleList::const_iterator it = layoutModules_.begin();
+       for (; it != layoutModules_.end(); it++) {
+               if (*it == modName)
+                       break;
+       }
+       if (it != layoutModules_.end())
+               return false;
+       layoutModules_.push_back(modName);
+       if (makeClass)
+               makeTextClass();
+       return true;
+}

end() is more important because it can be optimized:

+       LayoutModuleList::const_iterator it = layoutModules_.begin();
+       LayoutModuleList::const_iterator end = layoutModules_.end();
+       for (; it != end; it++)
+               if (*it == modName)
+                       return false;
+
+       layoutModules_.push_back(modName);
+       if (makeClass)
+               makeTextClass();
+       return true;
+}


+bool BufferParams::addLayoutModules(std::vector<string>modNames)
+{
+       bool retval = true;
+       std::vector<string>::const_iterator it = modNames.begin();
+       for (; it != modNames.end(); ++it)

Same comment for end().

+               retval = addLayoutModule(*it, false);

Shouldn't it be:
+               retval |= addLayoutModule(*it, false);
otherwise retval doesn't mean much. In this case retval should be initialised to false.

+       makeTextClass();
+       return retval;

I guess I am missing  some doxygen comments about the returned booleans.


Index: lib/configure.py
===================================================================
--- lib/configure.py    (revision 19769)
+++ lib/configure.py    (working copy)
@@ -639,6 +639,9 @@
         # for chkconfig.ltx
         p1 = re.compile(r'\Declare(LaTeX|DocBook)Class')
         testclasses = list()
+#        for file in glob.glob( os.path.join('layouts', '*.mod') ) + \
+#            glob.glob( os.path.join(srcdir, 'layouts', '*.mod' ) ) :
+#          print file

Don't comment out things, remove them if they are not needed. And if still needed add a FIXME to explain why these lines are commented.

Hope this helps,
Abdel.

Reply via email to