]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathAtom.h
Force a Buffer * argument to math insets constructor
[lyx.git] / src / mathed / MathAtom.h
index 5a0adf8672488ba5110d3e38b8fe018fe3101776..aa6e317f899b0196891e65f7f4dd42f1cb7014a1 100644 (file)
@@ -4,7 +4,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -40,36 +40,29 @@ Andre'
 
 */
 
+#include "support/unique_ptr.h"
+
 namespace lyx {
 
-class Inset;
 class InsetMath;
 
 class MathAtom {
 public:
-       /// default constructor, object is useless, but we need it to put it into
-       // std::containers
-       MathAtom();
+       MathAtom() = default;
+       MathAtom(MathAtom &&) = default;
+       MathAtom & operator=(MathAtom &&) = default;
        /// the "real constructor"
-       explicit MathAtom(Inset * p);
-       /// copy constructor, invokes nucleus_->clone()
+       explicit MathAtom(InsetMath * p);
+       /// copy constructor, invokes clone()
        MathAtom(MathAtom const &);
-       /// we really need to clean up
-       ~MathAtom();
-       /// assignment invokes nucleus_->clone()
        MathAtom & operator=(MathAtom const &);
-       /// access to the inset (checked with gprof)
-       InsetMath       * nucleus()       { return nucleus_; }
-       InsetMath const * nucleus() const { return nucleus_; }
        /// access to the inset
-       InsetMath const * operator->() const { return nucleus_; }
-
-       /// width cache. Not nice...
-       //mutable int width_;
-
+       InsetMath * nucleus() { return nucleus_.get(); }
+       InsetMath const * nucleus() const { return nucleus_.get(); }
+       InsetMath * operator->() { return nucleus_.get(); }
+       InsetMath const * operator->() const { return nucleus_.get(); }
 private:
-       ///
-       InsetMath * nucleus_;
+       std::unique_ptr<InsetMath> nucleus_;
 };