X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_atom.h;h=04cf2a391d637599f9934cda7b319bcdcacc64e1;hb=46880e2b9b49632c56bab2377ce9a3c826cf8d1d;hp=543a861ecfe6ac427d7156a3418cb79aba596f6b;hpb=86c2cf6f65d126a73bff901f5dd8e6e711481fd3;p=lyx.git diff --git a/src/mathed/math_atom.h b/src/mathed/math_atom.h index 543a861ecf..04cf2a391d 100644 --- a/src/mathed/math_atom.h +++ b/src/mathed/math_atom.h @@ -7,12 +7,12 @@ #pragma interface #endif -/** +/** The 'atom' is the major blob in math typesetting. And 'atom' consists of a nucleus, an optional superscript, and an optional subscript. Exactly where the subscript and superscript are drawn depends on the -size, and type, of the nucleus they are attached to. +size, and type, of the nucleus they are attached to. Jules @@ -22,6 +22,10 @@ Ok: Implementing it thusly is not feasible since cursor movement gets hackish. We use MathAtom only as a wrapper around MathInset * with value semantics. +The MathAtom owns the MathInset * and is responsible for proper cloning and +destruction. Every MathInset * should be put into a MathAtom after its +creation as soon as possible. + Andre' */ @@ -29,34 +33,30 @@ Andre' class MathInset; class MathAtom { -public: - /// +public: + /// default constructor, object is useless, but we need it to put it into + // std::containers MathAtom(); - /// - MathAtom(MathAtom const &); - /// + /// the "real constructor" explicit MathAtom(MathInset * p); - /// - virtual ~MathAtom(); - /// + /// copy constructor, invokes nucleus_->clone() + MathAtom(MathAtom const &); + /// we really need to clean up + ~MathAtom(); + /// assignment invokes nucleus_->clone() void operator=(MathAtom const &); - /// + /// change inset under the hood + void operator=(MathInset * p); + /// change inset under the hood void reset(MathInset * p); - /// - bool hasNucleus() const; - /// - MathInset * nucleus() const; - /// - MathInset * operator->() const; + /// access to the inset (checked with gprof) + MathInset * nucleus() const { return nucleus_; } + /// access to the inset + MathInset * operator->() const { return nucleus_; } private: /// MathInset * nucleus_; - - /// raw copy - void copy(MathAtom const & p); - /// raw destruction - void done(); }; #endif