]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_atom.C
rename commandtags.h to lfuns.h and renumber/cleanup. Rebuild the tree !
[lyx.git] / src / mathed / math_atom.C
index 8c1c6ed85cd10b42d61c31b8112ea187134f8902..bbc127517920824510c783c6c9089723f7fdda4f 100644 (file)
@@ -1,27 +1,24 @@
 /*
- *  File:        math_inset.C
- *  Purpose:     Implementation of insets for mathed
- *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
- *  Created:     January 1996
- *  Description: 
+ *  File:        math_atom.C
+ *  Purpose:     Wrapper for MathInset *
+ *  Author:      André Pönitz
+ *  Created:     July 2001
  *
- *  Dependencies: Xlib, XForms
+ *  Copyright: 2001 The LyX team
  *
- *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
- *
- *   Version: 0.8beta.
+ *   Version: 1.2.0
  *
  *   You are free to use and modify this code under the terms of
  *   the GNU General Public Licence version 2 or later.
  */
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
+#include <config.h>
+
 
 #include "math_atom.h"
 #include "math_inset.h"
-#include "support/LAssert.h"
+
+#include <utility>
 
 
 MathAtom::MathAtom()
@@ -34,60 +31,21 @@ MathAtom::MathAtom(MathInset * p)
 {}
 
 
-MathAtom::MathAtom(MathAtom const & p)
-{
-       copy(p);
-}
+MathAtom::MathAtom(MathAtom const & at)
+       : nucleus_(at.nucleus_ ? at.nucleus_->clone() : 0)
+{}
 
 
-void MathAtom::operator=(MathAtom const & p)
+void MathAtom::operator=(MathAtom const & at)
 {
-       if (this != &p) {
-               done();
-               copy(p);
-       }
+       if (&at == this)
+               return;
+       MathAtom tmp(at);
+       std::swap(tmp.nucleus_, nucleus_);
 }
 
 
 MathAtom::~MathAtom()
-{
-       done();
-}
-
-
-void MathAtom::done()
 {
        delete nucleus_;
 }
-
-
-void MathAtom::copy(MathAtom const & p)
-{
-       //cerr << "calling MathAtom::copy\n";
-       nucleus_   = p.nucleus_;
-       if (nucleus_)
-               nucleus_ = nucleus_->clone();
-}
-
-
-MathInset * MathAtom::nucleus() const
-{
-       lyx::Assert(nucleus_);
-       return nucleus_;
-}
-
-
-MathInset * MathAtom::operator->() const
-{
-       return nucleus();
-}
-
-/*
-void MathAtom::userSetSize(MathStyles sz)
-{
-       if (sz >= 0) {
-               size_ = sz;      
-               flag = flag & ~LMPF_FIXED_SIZE;
-       }
-}
-*/