An immediate improvement. The following header files (only 4!) #include
RowList.h:
lyxtext.h, paragraph.h, insets/insettext.h, lyxrow_funcs.hwhere RowList.h is simply: #include "lyxrow.h" #include <list> typedef std::list<Row> RowList; paragraph.h stores a RowList member variable. The other three mention RowList::iterator. In all cases, we could use a RowList_fwd.h header: #include <list> class Row; typedef std::list<Row> RowList; Why is this a good idea? Well run the attached shell script ;-) $ ../../scripts/depends_on.sh RowList.h ../build/src Searching for files depending on RowList.h: ../build/src/mathed/formulabase.o ../build/src/graphics/PreviewLoader.o ../build/src/graphics/Previews.o [snip] In total, 115 files depend on RowList.h and therefore also depend on lyxrow.h. Most of 'em would be perfectly happy with RowList_fwd.h instead. Doing so (patch attached): $ ../../scripts/depends_on.sh lyxrow.h ../build/src Searching for files depending on lyxrow.h: ../build/src/frontends/screen.o ../build/src/bufferview_funcs.o ../build/src/lyxfunc.o ../build/src/lyxrow.o ../build/src/lyxrow_funcs.o ../build/src/paragraph.o ../build/src/rowpainter.o ../build/src/text.o ../build/src/text2.o ../build/src/text3.o Now, that has to be better than 115 spurious dependencies. I have committed the patch. I assume the ParagraphList_fwd.h would be equally useful. -- Angus
depends_on.sh
Description: application/shellscript
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.1548 diff -u -p -r1.1548 ChangeLog --- src/ChangeLog 5 Sep 2003 22:17:00 -0000 1.1548 +++ src/ChangeLog 6 Sep 2003 10:53:40 -0000 @@ -1,3 +1,22 @@ +2003-09-06 Angus Leeming <[EMAIL PROTECTED]> + + * RowList_fwd.h: new file, forward-declaring Row rather than + #including lyxrow.h + + * lyxrow_funcs.h: + * lyxtext.h: + * paragraph.h: + * insets/insettext.h: use it instead of RowList.h + + * bufferview_funcs.C: + * lyxfunc.C: + * lyxrow_funcs.C: + * paragraph.C: + * rowpainter.C: + * text.C: + * text2.C: + * text3.C: #include "RowList.h". + 2003-09-05 Angus Leeming <[EMAIL PROTECTED]> * factory.C (createInset): Index: src/RowList_fwd.h =================================================================== RCS file: src/RowList_fwd.h diff -N src/RowList_fwd.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/RowList_fwd.h 6 Sep 2003 10:47:57 -0000 @@ -0,0 +1,21 @@ +// -*- C++ -*- +/** + * \file RowList_fwd.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Angus Leeming + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef ROW_LIST_FWD_H +#define ROW_LIST_FWD_H + +#include <list> + +class Row; + +typedef std::list<Row> RowList; + +#endif Index: src/bufferview_funcs.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferview_funcs.C,v retrieving revision 1.101 diff -u -p -r1.101 bufferview_funcs.C --- src/bufferview_funcs.C 5 Sep 2003 18:02:15 -0000 1.101 +++ src/bufferview_funcs.C 6 Sep 2003 10:47:58 -0000 @@ -20,6 +20,7 @@ #include "language.h" #include "gettext.h" #include "ParagraphParameters.h" +#include "RowList.h" #include "frontends/LyXView.h" #include "frontends/Alert.h" Index: src/lyxfunc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v retrieving revision 1.489 diff -u -p -r1.489 lyxfunc.C --- src/lyxfunc.C 5 Sep 2003 18:02:15 -0000 1.489 +++ src/lyxfunc.C 6 Sep 2003 10:47:59 -0000 @@ -44,6 +44,7 @@ #include "lyxfind.h" #include "undo_funcs.h" #include "ParagraphParameters.h" +#include "RowList.h" #include "insets/insetcommand.h" #include "insets/insetexternal.h" Index: src/lyxrow_funcs.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow_funcs.C,v retrieving revision 1.15 diff -u -p -r1.15 lyxrow_funcs.C --- src/lyxrow_funcs.C 5 Sep 2003 16:31:25 -0000 1.15 +++ src/lyxrow_funcs.C 6 Sep 2003 10:48:00 -0000 @@ -15,6 +15,7 @@ #include "lyxtext.h" #include "lyxlayout.h" #include "debug.h" +#include "RowList.h" #include "support/LAssert.h" Index: src/lyxrow_funcs.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow_funcs.h,v retrieving revision 1.7 diff -u -p -r1.7 lyxrow_funcs.h --- src/lyxrow_funcs.h 4 Sep 2003 15:21:33 -0000 1.7 +++ src/lyxrow_funcs.h 6 Sep 2003 10:48:00 -0000 @@ -13,7 +13,7 @@ #ifndef LYXROW_FUNCS_H #define LYXROW_FUNCS_H -#include "RowList.h" +#include "RowList_fwd.h" #include "support/types.h" class Paragraph; Index: src/lyxtext.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v retrieving revision 1.227 diff -u -p -r1.227 lyxtext.h --- src/lyxtext.h 4 Sep 2003 03:53:57 -0000 1.227 +++ src/lyxtext.h 6 Sep 2003 10:48:00 -0000 @@ -18,7 +18,7 @@ #include "layout.h" #include "LColor.h" #include "insets/inset.h" -#include "RowList.h" +#include "RowList_fwd.h" #include "bufferview_funcs.h" #include "textcursor.h" Index: src/paragraph.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v retrieving revision 1.309 diff -u -p -r1.309 paragraph.C --- src/paragraph.C 5 Sep 2003 18:02:15 -0000 1.309 +++ src/paragraph.C 6 Sep 2003 10:48:01 -0000 @@ -26,6 +26,7 @@ #include "gettext.h" #include "language.h" #include "latexrunparams.h" +#include "RowList.h" #include "support/std_sstream.h" Index: src/paragraph.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.h,v retrieving revision 1.99 diff -u -p -r1.99 paragraph.h --- src/paragraph.h 5 Sep 2003 17:22:51 -0000 1.99 +++ src/paragraph.h 6 Sep 2003 10:48:02 -0000 @@ -24,7 +24,7 @@ #include "support/types.h" #include "changes.h" -#include "RowList.h" +#include "RowList_fwd.h" #include "support/std_string.h" Index: src/rowpainter.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v retrieving revision 1.62 diff -u -p -r1.62 rowpainter.C --- src/rowpainter.C 5 Sep 2003 16:31:26 -0000 1.62 +++ src/rowpainter.C 6 Sep 2003 10:48:02 -0000 @@ -27,6 +27,7 @@ #include "rowpainter.h" #include "lyxrow_funcs.h" #include "metricsinfo.h" +#include "RowList.h" using namespace lyx::support; Index: src/text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.437 diff -u -p -r1.437 text.C --- src/text.C 5 Sep 2003 16:31:26 -0000 1.437 +++ src/text.C 6 Sep 2003 10:48:04 -0000 @@ -33,6 +33,7 @@ #include "paragraph_funcs.h" #include "rowpainter.h" #include "lyxrow_funcs.h" +#include "RowList.h" #include "insets/insettext.h" Index: src/text2.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v retrieving revision 1.458 diff -u -p -r1.458 text2.C --- src/text2.C 5 Sep 2003 18:02:15 -0000 1.458 +++ src/text2.C 6 Sep 2003 10:48:06 -0000 @@ -40,6 +40,7 @@ #include "lyxrow_funcs.h" #include "metricsinfo.h" #include "paragraph_funcs.h" +#include "RowList.h" #include "insets/insetbibitem.h" #include "insets/insetenv.h" Index: src/text3.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v retrieving revision 1.132 diff -u -p -r1.132 text3.C --- src/text3.C 5 Sep 2003 22:17:01 -0000 1.132 +++ src/text3.C 6 Sep 2003 10:48:07 -0000 @@ -38,6 +38,7 @@ #include "insets/insetnewline.h" #include "undo_funcs.h" #include "text_funcs.h" +#include "RowList.h" #include <clocale> Index: src/insets/insettext.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.h,v retrieving revision 1.201 diff -u -p -r1.201 insettext.h --- src/insets/insettext.h 5 Sep 2003 17:23:05 -0000 1.201 +++ src/insets/insettext.h 6 Sep 2003 10:48:09 -0000 @@ -16,7 +16,7 @@ #include "support/std_string.h" #include "LColor.h" #include "ParagraphList.h" -#include "RowList.h" +#include "RowList_fwd.h" #include "dimension.h" #include "lyxtext.h"
