X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMacroTable.h;h=3a1fed4fa682bb89d833f54d4d4dc1cb6b51e215;hb=30d3fcd640c180407a8a1db7679cca42eaa9e0c1;hp=57a0431dea2074bec81ef43d460bcb8b05d05f4b;hpb=323e3b020742127d430a83a0dfa6d391a25f3cc8;p=lyx.git diff --git a/src/mathed/MacroTable.h b/src/mathed/MacroTable.h index 57a0431dea..3a1fed4fa6 100644 --- a/src/mathed/MacroTable.h +++ b/src/mathed/MacroTable.h @@ -16,7 +16,6 @@ #include "DocIterator.h" #include "support/docstring.h" -#include "support/types.h" #include #include @@ -31,21 +30,19 @@ class Paragraph; enum MacroType { MacroTypeNewcommand, + MacroTypeNewcommandx, MacroTypeDef }; - -/// -class MacroNameSet : public std::set {}; /// class MacroData { public: /// Constructor to make STL containers happy - MacroData(); + MacroData(Buffer * buf = 0); /// Create lazy MacroData which only queries the macro template when needed - MacroData(Buffer const & buf, DocIterator const & pos); + MacroData(Buffer * buf, DocIterator const & pos); /// Create non-lazy MacroData which directly queries the macro template - MacroData(MathMacroTemplate const & macro); + MacroData(Buffer * buf, MathMacroTemplate const & macro); /// docstring const & definition() const { updateData(); return definition_; } @@ -83,7 +80,7 @@ public: MacroType & type() { return type_; } /// output as TeX macro, only works for lazy MacroData!!! - void write(odocstream & os, bool overwriteRedefinition) const; + int write(odocstream & os, bool overwriteRedefinition) const; /// bool operator==(MacroData const & x) const { @@ -137,6 +134,12 @@ private: mutable MacroType type_; }; + +/// +class MacroNameSet : public std::set {}; +/// +class MacroSet : public std::set {}; + /// A lookup table of macro definitions. /** @@ -149,9 +152,9 @@ class MacroTable : public std::map { public: /// Parse full "\\def..." or "\\newcommand..." or ... - void insert(docstring const & definition, std::string const &); + iterator insert(Buffer * buf, docstring const & definition, std::string const &); /// Insert pre-digested macro definition - void insert(docstring const & name, MacroData const & data); + iterator insert(docstring const & name, MacroData const & data); /// MacroData const * get(docstring const & name) const; /// @@ -175,14 +178,14 @@ public: class MacroContext { public: /// construct context for the insets at pos - MacroContext(Buffer const & buf, DocIterator const & pos); + MacroContext(Buffer const * buf, DocIterator const & pos); /// Lookup macro MacroData const * get(docstring const & name) const; private: /// - Buffer const & buf_; + Buffer const * buf_; /// DocIterator const & pos_; };