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