mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 22:17:41 +00:00
MacroData refactoring
This commit is contained in:
parent
5a54ccfa87
commit
01e673635b
@ -3802,7 +3802,7 @@ void Buffer::Impl::updateMacros(DocIterator & it, DocIterator & scope)
|
||||
// FIXME (Abdel), I don't understand why we pass 'it' here
|
||||
// instead of 'macroTemplate' defined above... is this correct?
|
||||
macros[macroTemplate.name()][it] =
|
||||
Impl::ScopeMacro(scope, MacroData(const_cast<Buffer *>(owner_), it));
|
||||
Impl::ScopeMacro(scope, MacroData(owner_, it));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -41,23 +41,18 @@ namespace lyx {
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
MacroData::MacroData(Buffer * buf)
|
||||
: buffer_(buf), queried_(true), numargs_(0), sym_(0), optionals_(0),
|
||||
lockCount_(0), redefinition_(false), type_(MacroTypeNewcommand)
|
||||
MacroData::MacroData(const Buffer * buf)
|
||||
: buffer_(buf), queried_(true)
|
||||
{}
|
||||
|
||||
|
||||
MacroData::MacroData(Buffer * buf, DocIterator const & pos)
|
||||
: buffer_(buf), pos_(pos), queried_(false), numargs_(0), sym_(0),
|
||||
optionals_(0), lockCount_(0), redefinition_(false),
|
||||
type_(MacroTypeNewcommand)
|
||||
{
|
||||
}
|
||||
MacroData::MacroData(Buffer const * buf, DocIterator const & pos)
|
||||
: buffer_(buf), pos_(pos)
|
||||
{}
|
||||
|
||||
|
||||
MacroData::MacroData(Buffer * buf, InsetMathMacroTemplate const & macro)
|
||||
: buffer_(buf), queried_(false), numargs_(0), sym_(0), optionals_(0),
|
||||
lockCount_(0), redefinition_(false), type_(MacroTypeNewcommand)
|
||||
MacroData::MacroData(Buffer const * buf, InsetMathMacroTemplate const & macro)
|
||||
: buffer_(buf)
|
||||
{
|
||||
queryData(macro);
|
||||
}
|
||||
|
@ -38,11 +38,11 @@ enum MacroType {
|
||||
class MacroData {
|
||||
public:
|
||||
/// Constructor to make STL containers happy
|
||||
explicit MacroData(Buffer * buf = 0);
|
||||
explicit MacroData(Buffer const * buf = 0);
|
||||
/// Create lazy MacroData which only queries the macro template when needed
|
||||
MacroData(Buffer * buf, DocIterator const & pos);
|
||||
MacroData(Buffer const * buf, DocIterator const & pos);
|
||||
/// Create non-lazy MacroData which directly queries the macro template
|
||||
MacroData(Buffer * buf, InsetMathMacroTemplate const & macro);
|
||||
MacroData(Buffer const * buf, InsetMathMacroTemplate const & macro);
|
||||
|
||||
///
|
||||
docstring const & definition() const { updateData(); return definition_; }
|
||||
@ -122,25 +122,25 @@ private:
|
||||
/// macros.
|
||||
mutable DocIterator pos_;
|
||||
///
|
||||
mutable bool queried_;
|
||||
mutable bool queried_ = false;
|
||||
///
|
||||
mutable docstring definition_;
|
||||
///
|
||||
mutable size_t numargs_;
|
||||
mutable size_t numargs_ = 0;
|
||||
///
|
||||
mutable docstring display_;
|
||||
///
|
||||
latexkeys const * sym_;
|
||||
latexkeys const * sym_ = nullptr;
|
||||
///
|
||||
mutable size_t optionals_;
|
||||
mutable size_t optionals_ = 0;
|
||||
///
|
||||
mutable std::vector<docstring> defaults_;
|
||||
///
|
||||
mutable int lockCount_;
|
||||
mutable int lockCount_ = 0;
|
||||
///
|
||||
mutable bool redefinition_;
|
||||
mutable bool redefinition_ = false;
|
||||
///
|
||||
mutable MacroType type_;
|
||||
mutable MacroType type_ = MacroTypeNewcommand;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user