2001-09-11 10:58:17 +00:00
|
|
|
|
/*
|
2001-12-11 07:38:02 +00:00
|
|
|
|
* File: math_atom.C
|
|
|
|
|
* Purpose: Wrapper for MathInset *
|
|
|
|
|
* Author: Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
* Created: July 2001
|
2001-09-11 10:58:17 +00:00
|
|
|
|
*
|
2001-12-11 07:38:02 +00:00
|
|
|
|
* Copyright: 2001 The LyX team
|
2001-09-11 10:58:17 +00:00
|
|
|
|
*
|
2001-12-11 07:38:02 +00:00
|
|
|
|
* Version: 1.2.0
|
2001-09-11 10:58:17 +00:00
|
|
|
|
*
|
|
|
|
|
* You are free to use and modify this code under the terms of
|
|
|
|
|
* the GNU General Public Licence version 2 or later.
|
|
|
|
|
*/
|
|
|
|
|
|
2001-12-18 03:16:46 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma implementation
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "math_atom.h"
|
2001-10-12 12:02:49 +00:00
|
|
|
|
#include "math_inset.h"
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|
2001-12-11 07:38:02 +00:00
|
|
|
|
#include <utility>
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
|
MathAtom::MathAtom()
|
2001-10-12 12:02:49 +00:00
|
|
|
|
: nucleus_(0)
|
|
|
|
|
{}
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MathAtom::MathAtom(MathInset * p)
|
2001-10-12 12:02:49 +00:00
|
|
|
|
: nucleus_(p)
|
|
|
|
|
{}
|
2001-09-24 16:25:06 +00:00
|
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|
|
|
|
|
MathAtom::MathAtom(MathAtom const & p)
|
2001-12-11 07:38:02 +00:00
|
|
|
|
: nucleus_(p.nucleus_ ? p.nucleus_->clone() : 0)
|
|
|
|
|
{}
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathAtom::operator=(MathAtom const & p)
|
|
|
|
|
{
|
2001-12-11 07:38:02 +00:00
|
|
|
|
if (&p == this)
|
2001-11-15 09:51:57 +00:00
|
|
|
|
return;
|
2001-12-11 07:38:02 +00:00
|
|
|
|
MathAtom tmp(p);
|
2002-03-12 14:59:08 +00:00
|
|
|
|
std::swap(tmp.nucleus_, nucleus_);
|
2001-09-11 10:58:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MathAtom::~MathAtom()
|
|
|
|
|
{
|
2001-12-11 07:38:02 +00:00
|
|
|
|
delete nucleus_;
|
2001-09-11 10:58:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
|
void MathAtom::reset(MathInset * p)
|
|
|
|
|
{
|
2001-12-11 07:38:02 +00:00
|
|
|
|
if (p == nucleus_)
|
|
|
|
|
return;
|
2001-09-11 10:58:17 +00:00
|
|
|
|
delete nucleus_;
|
2001-12-11 07:38:02 +00:00
|
|
|
|
nucleus_ = p;
|
2001-09-11 10:58:17 +00:00
|
|
|
|
}
|