]> git.lyx.org Git - lyx.git/blob - src/mathed/math_atom.h
fix #1073
[lyx.git] / src / mathed / math_atom.h
1 // -*- C++ -*-
2
3 #ifndef MATH_ATOM_H
4 #define MATH_ATOM_H
5
6
7 /**
8  * Wrapper for MathInset * with copy-semantics
9  *
10  * \author André Pönitz
11  *
12  * Full author contact details are available in file CREDITS
13  */
14
15 /**
16 The 'atom' is the major blob in math typesetting.  And 'atom' consists
17 of a nucleus, an optional superscript, and an optional subscript.
18
19 Exactly where the subscript and superscript are drawn depends on the
20 size, and type, of the nucleus they are attached to.
21
22 Jules
23
24 --
25
26 Ok: Implementing it thusly is not feasible since cursor movement gets
27 hackish. We use MathAtom only as a wrapper around MathInset * with value
28 semantics.
29
30 The MathAtom owns the MathInset * and is responsible for proper cloning and
31 destruction. Every MathInset * should be put into a MathAtom after its
32 creation as soon as possible.
33
34 Andre'
35
36 */
37
38 class MathInset;
39
40 class MathAtom {
41 public:
42         /// default constructor, object is useless, but we need it to put it into
43         // std::containers
44         MathAtom();
45         /// the "real constructor"
46         explicit MathAtom(MathInset * p);
47         /// copy constructor, invokes nucleus_->clone()
48         MathAtom(MathAtom const &);
49         /// we really need to clean up
50         ~MathAtom();
51         /// assignment invokes nucleus_->clone()
52         void operator=(MathAtom const &);
53         /// access to the inset (checked with gprof)
54         MathInset       * nucleus()       { return nucleus_; }
55         /// access to the inset
56         MathInset const * operator->() const { return nucleus_; }
57
58 private:
59         ///
60         MathInset * nucleus_;
61 };
62
63 #endif