From 323e3b020742127d430a83a0dfa6d391a25f3cc8 Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Sat, 23 Feb 2008 18:11:35 +0000 Subject: [PATCH] * Moved std::sets out of Buffer.h to reduce overall LyX compile time git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23163 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 11 ++++++++++- src/Buffer.h | 9 +++------ src/insets/InsetText.h | 3 +++ src/mathed/InsetMathNest.cpp | 8 ++++---- src/mathed/MacroTable.h | 3 +++ src/mathed/MathFactory.cpp | 6 +++--- src/mathed/MathFactory.h | 4 ++-- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index d9d9a82f69..3a074cba94 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -203,6 +203,9 @@ public: /// A cache for the bibfiles (including bibfiles of loaded child /// documents), needed for appropriate update of natbib labels. mutable EmbeddedFileList bibfilesCache_; + + /// + WordList words_; }; /// Creates the per buffer temporary directory @@ -2667,7 +2670,13 @@ void Buffer::bufferErrors(TeXErrors const & terr, ErrorList & errorList) const void Buffer::registerWord(docstring const & word) { - words_.insert(word); + d->words_.insert(word); +} + + +WordList const & Buffer::registeredWords() const +{ + return d->words_; } } // namespace lyx diff --git a/src/Buffer.h b/src/Buffer.h index 51c3855f87..ace9986f23 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -18,7 +18,6 @@ #include "support/types.h" #include "support/SignalSlot.h" -#include #include #include @@ -41,6 +40,7 @@ class LyXVC; class LaTeXFeatures; class Language; class MacroData; +class MacroNameSet; class OutputParams; class Paragraph; class ParConstIterator; @@ -50,6 +50,7 @@ class TeXErrors; class TexRow; class TocBackend; class Undo; +class WordList; namespace frontend { class GuiBufferDelegate; @@ -366,8 +367,6 @@ public: /// Iterate through the whole buffer and try to resolve macros void updateMacroInstances() const; - typedef std::set MacroNameSet; - /// List macro names of this buffer. the parent and the children void listMacroNames(MacroNameSet & macros) const; /// Write out all macros somewhere defined in the parent, @@ -457,7 +456,7 @@ public: /// Register word for completion word list. void registerWord(docstring const & word); /// - std::set const & registeredWords() const { return words_; } + WordList const & registeredWords() const; private: /// search for macro in local (buffer) table or in children @@ -510,8 +509,6 @@ private: //Signal setBusy(bool) = 0; /// Reset autosave timers for all users. Signal resetAutosaveTimers_; - - std::set words_; }; diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h index ed748c7680..0101724cb1 100644 --- a/src/insets/InsetText.h +++ b/src/insets/InsetText.h @@ -19,6 +19,8 @@ #include "support/types.h" +#include + namespace lyx { class Buffer; @@ -29,6 +31,7 @@ class Dimension; class ParagraphList; class InsetTabular; +class WordList : public std::set {}; /** A text inset is like a TeX box to write full text diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index e0cf27a5fb..4cf95e1928 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -1716,9 +1716,9 @@ bool InsetMathNest::cursorMathBackward(Cursor & cur) MathCompletionList::MathCompletionList(Cursor const & cur) { // fill it with macros from the buffer - Buffer::MacroNameSet macros; + MacroNameSet macros; cur.buffer().listMacroNames(macros); - Buffer::MacroNameSet::const_iterator it; + MacroNameSet::const_iterator it; for (it = macros.begin(); it != macros.end(); ++it) { if (cur.buffer().getMacro(*it, cur, false)) locals.push_back("\\" + *it); @@ -1782,8 +1782,8 @@ MathCompletionList::MathCompletionList(Cursor const & cur) globals.push_back(from_ascii("\\hphantom")); globals.push_back(from_ascii("\\phantom")); globals.push_back(from_ascii("\\vphantom")); - WordList const & words = mathedWordList(); - WordList::const_iterator it2; + MathWordList const & words = mathedWordList(); + MathWordList::const_iterator it2; lyxerr << "Globals completion commands: "; for (it2 = words.begin(); it2 != words.end(); ++it2) { globals.push_back("\\" + (*it2).first); diff --git a/src/mathed/MacroTable.h b/src/mathed/MacroTable.h index 594e1bebc8..57a0431dea 100644 --- a/src/mathed/MacroTable.h +++ b/src/mathed/MacroTable.h @@ -34,6 +34,9 @@ enum MacroType { MacroTypeDef }; +/// +class MacroNameSet : public std::set {}; + /// class MacroData { public: diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index 9e776cde75..d657478988 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -69,7 +69,7 @@ bool has_math_fonts; namespace { -WordList theWordList; +MathWordList theWordList; bool math_font_available(docstring & name) @@ -218,7 +218,7 @@ void initSymbols() } // namespace anon -WordList const & mathedWordList() +MathWordList const & mathedWordList() { return theWordList; } @@ -237,7 +237,7 @@ void initMath() latexkeys const * in_word_set(docstring const & str) { - WordList::iterator it = theWordList.find(str); + MathWordList::iterator it = theWordList.find(str); return it != theWordList.end() ? &(it->second) : 0; } diff --git a/src/mathed/MathFactory.h b/src/mathed/MathFactory.h index ab89328707..f62f22d980 100644 --- a/src/mathed/MathFactory.h +++ b/src/mathed/MathFactory.h @@ -35,8 +35,8 @@ MathAtom createInsetMath(char const * const); */ bool createInsetMath_fromDialogStr(docstring const &, MathData &); -typedef map WordList; -WordList const & mathedWordList(); +typedef map MathWordList; +MathWordList const & mathedWordList(); } // namespace lyx -- 2.39.2