]> git.lyx.org Git - lyx.git/blob - src/mathed/math_atom.C
Tweaking of the math panel dialogs from Martin...
[lyx.git] / src / mathed / math_atom.C
1 /*
2  *  File:        math_atom.C
3  *  Purpose:     Wrapper for MathInset * 
4  *  Author:      André Pönitz
5  *  Created:     July 2001
6  *
7  *  Copyright: 2001 The LyX team
8  *
9  *   Version: 1.2.0
10  *
11  *   You are free to use and modify this code under the terms of
12  *   the GNU General Public Licence version 2 or later.
13  */
14
15 #include <config.h>
16
17 #ifdef __GNUG__
18 #pragma implementation
19 #endif
20
21 #include "math_atom.h"
22 #include "math_inset.h"
23 #include "support/LAssert.h"
24
25 #include <utility>
26
27
28 using std::swap;
29
30
31 MathAtom::MathAtom()
32         : nucleus_(0)
33 {}
34
35
36 MathAtom::MathAtom(MathInset * p)
37         : nucleus_(p)
38 {}
39
40
41 MathAtom::MathAtom(MathAtom const & p)
42         : nucleus_(p.nucleus_ ? p.nucleus_->clone() : 0)
43 {}
44
45
46 void MathAtom::operator=(MathAtom const & p)
47 {
48         if (&p == this)
49                 return;
50         MathAtom tmp(p);
51         swap(tmp.nucleus_, nucleus_);
52 }
53
54
55 MathAtom::~MathAtom()
56 {
57         delete nucleus_;
58 }
59
60
61 void MathAtom::reset(MathInset * p)
62 {
63         if (p == nucleus_)
64                 return;
65         delete nucleus_;
66         nucleus_ = p;
67 }
68
69
70 MathInset * MathAtom::nucleus() const
71 {
72         lyx::Assert(nucleus_);
73         return nucleus_;
74 }
75
76
77 MathInset * MathAtom::operator->() const
78 {
79         return nucleus();
80 }