X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathMacroArgument.h;h=bb9fa1dc304f8742229caf04065f5460b89445f6;hb=faeb1997932dd60909ebe7c7883a5c8fbfe81e8c;hp=bb5b058f67c3f0ec65624300dc8ae83ffaa32fa3;hpb=e89625ef28143545a511cdabc67dee8b7be1b216;p=lyx.git diff --git a/src/mathed/MathMacroArgument.h b/src/mathed/MathMacroArgument.h index bb5b058f67..bb9fa1dc30 100644 --- a/src/mathed/MathMacroArgument.h +++ b/src/mathed/MathMacroArgument.h @@ -5,7 +5,7 @@ * Licence details can be found in the file COPYING. * * \author Alejandro Aguilar Sierra - * \author André Pönitz + * \author André Pönitz * * Full author contact details are available in file CREDITS. */ @@ -13,34 +13,58 @@ #ifndef MATHMACROARGUMENT_H #define MATHMACROARGUMENT_H -#include "InsetMathDim.h" +#include "InsetMath.h" +#include "support/docstring.h" -/// A macro argument. -class MathMacroArgument : public InsetMathDim { + +namespace lyx { + + +// A # that failed to parse +class InsetMathHash : public InsetMath { public: - /// - explicit MathMacroArgument(std::size_t); + InsetMathHash(docstring const & str = docstring()) : str_('#' + str) {}; /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// void draw(PainterInfo &, int x, int y) const; /// - std::size_t number() const { return number_; } + void normalize(NormalStream &) const; /// - InsetBase::Code lyxCode() const { return MATHMACROARG_CODE; } + void write(WriteStream & os) const; + +private: + Inset * clone() const; +protected: /// - void normalize(NormalStream &) const; + docstring str_; +}; + + +/// A macro argument. +class MathMacroArgument : public InsetMathHash { +public: + /// Assumes 0 < number <= 9 + explicit MathMacroArgument(int number); /// - void write(WriteStream & os) const; + int number() const { return number_; } + /// Assumes 0 < n <= 9 + void setNumber(int n); + /// + InsetCode lyxCode() const { return MATH_MACROARG_CODE; } + + /// + void normalize(NormalStream &) const; private: - virtual std::auto_ptr doClone() const; + Inset * clone() const; /// A number between 1 and 9 - std::size_t number_; - /// - char str_[3]; + int number_; }; + +} // namespace lyx + #endif