]> git.lyx.org Git - lyx.git/blob - src/mathed/math_atom.C
Reduce Michael's buglist.
[lyx.git] / src / mathed / math_atom.C
1 /*
2  *  File:        math_inset.C
3  *  Purpose:     Implementation of insets for mathed
4  *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
5  *  Created:     January 1996
6  *  Description: 
7  *
8  *  Dependencies: Xlib, XForms
9  *
10  *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
11  *
12  *   Version: 0.8beta.
13  *
14  *   You are free to use and modify this code under the terms of
15  *   the GNU General Public Licence version 2 or later.
16  */
17
18 #ifdef __GNUG__
19 #pragma implementation
20 #endif
21
22 #include "math_atom.h"
23 #include "math_inset.h"
24 #include "support/LAssert.h"
25
26
27 MathAtom::MathAtom()
28         : nucleus_(0)
29 {}
30
31
32 MathAtom::MathAtom(MathInset * p)
33         : nucleus_(p)
34 {}
35
36
37 MathAtom::MathAtom(MathAtom const & p)
38 {
39         copy(p);
40 }
41
42
43 void MathAtom::operator=(MathAtom const & p)
44 {
45         if (this == &p)
46                 return;
47         done();
48         copy(p);
49 }
50
51
52 MathAtom::~MathAtom()
53 {
54         done();
55 }
56
57
58 void MathAtom::reset(MathInset * p)
59 {
60         done();
61         nucleus_ = p;
62 }
63
64
65
66 void MathAtom::done()
67 {
68         delete nucleus_;
69 }
70
71
72 void MathAtom::copy(MathAtom const & p)
73 {
74         //cerr << "calling MathAtom::copy\n";
75         nucleus_   = p.nucleus_;
76         if (nucleus_)
77                 nucleus_ = nucleus_->clone();
78 }
79
80
81 MathInset * MathAtom::nucleus() const
82 {
83         lyx::Assert(nucleus_);
84         return nucleus_;
85 }
86
87
88 MathInset * MathAtom::operator->() const
89 {
90         return nucleus();
91 }