lyx_mirror/src/mathed/math_atom.C
André Pönitz c649284611 several smallish changes/bugfixes/left overs from Porto
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4474 a592a061-630c-0410-9148-cb99ea01b6c8
2002-06-25 13:19:50 +00:00

70 lines
988 B
C

/*
* File: math_atom.C
* Purpose: Wrapper for MathInset *
* Author: André Pönitz
* Created: July 2001
*
* Copyright: 2001 The LyX team
*
* 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.
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "math_atom.h"
#include "math_inset.h"
#include <utility>
MathAtom::MathAtom()
: nucleus_(0)
{}
MathAtom::MathAtom(MathInset * p)
: nucleus_(p)
{}
MathAtom::MathAtom(MathAtom const & at)
: nucleus_(at.nucleus_ ? at.nucleus_->clone() : 0)
{}
void MathAtom::operator=(MathAtom const & at)
{
if (&at == this)
return;
MathAtom tmp(at);
std::swap(tmp.nucleus_, nucleus_);
}
void MathAtom::operator=(MathInset * p)
{
reset(p);
}
MathAtom::~MathAtom()
{
delete nucleus_;
}
void MathAtom::reset(MathInset * p)
{
if (p == nucleus_)
return;
delete nucleus_;
nucleus_ = p;
}