* 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
This commit is contained in:
Stefan Schimanski 2008-02-23 18:11:35 +00:00
parent ee4dcf105a
commit 323e3b0207
7 changed files with 28 additions and 16 deletions

View File

@ -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

View File

@ -18,7 +18,6 @@
#include "support/types.h"
#include "support/SignalSlot.h"
#include <set>
#include <string>
#include <vector>
@ -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<docstring> 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<docstring> 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<docstring> words_;
};

View File

@ -19,6 +19,8 @@
#include "support/types.h"
#include <set>
namespace lyx {
class Buffer;
@ -29,6 +31,7 @@ class Dimension;
class ParagraphList;
class InsetTabular;
class WordList : public std::set<docstring> {};
/**
A text inset is like a TeX box to write full text

View File

@ -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);

View File

@ -34,6 +34,9 @@ enum MacroType {
MacroTypeDef
};
///
class MacroNameSet : public std::set<docstring> {};
///
class MacroData {
public:

View File

@ -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;
}

View File

@ -35,8 +35,8 @@ MathAtom createInsetMath(char const * const);
*/
bool createInsetMath_fromDialogStr(docstring const &, MathData &);
typedef map<docstring, latexkeys> WordList;
WordList const & mathedWordList();
typedef map<docstring, latexkeys> MathWordList;
MathWordList const & mathedWordList();
} // namespace lyx