X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_atom.C;h=bd5cda75be3aec9bbe5a9d2be7819ba77e7e862a;hb=07cc9f67534474b167ca1ea727bda643fdd8d197;hp=a8e2815a0f146acfd65d18ebd5f2e069f4dfafcb;hpb=c649284611c4198c9d70be8a16d153cdf1ec0700;p=lyx.git diff --git a/src/mathed/math_atom.C b/src/mathed/math_atom.C index a8e2815a0f..bd5cda75be 100644 --- a/src/mathed/math_atom.C +++ b/src/mathed/math_atom.C @@ -1,27 +1,19 @@ -/* - * File: math_atom.C - * Purpose: Wrapper for MathInset * - * Author: André Pönitz - * Created: July 2001 +/** + * \file math_atom.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * Copyright: 2001 The LyX team + * \author André Pönitz * - * 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. + * Full author contact details are available in file CREDITS. */ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "math_atom.h" #include "math_inset.h" -#include +using std::swap; MathAtom::MathAtom() @@ -29,14 +21,17 @@ MathAtom::MathAtom() {} -MathAtom::MathAtom(MathInset * p) - : nucleus_(p) +MathAtom::MathAtom(InsetBase * p) + : nucleus_(static_cast(p)) {} MathAtom::MathAtom(MathAtom const & at) - : nucleus_(at.nucleus_ ? at.nucleus_->clone() : 0) -{} + : nucleus_(0) +{ + if (at.nucleus_) + nucleus_ = static_cast(at.nucleus_->clone().release()); +} void MathAtom::operator=(MathAtom const & at) @@ -44,13 +39,7 @@ 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); + swap(tmp.nucleus_, nucleus_); } @@ -58,12 +47,3 @@ MathAtom::~MathAtom() { delete nucleus_; } - - -void MathAtom::reset(MathInset * p) -{ - if (p == nucleus_) - return; - delete nucleus_; - nucleus_ = p; -}