]> git.lyx.org Git - lyx.git/blob - src/mathed/math_atom.h
code that's not there cannot be wrong...
[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 The 'atom' is the major blob in math typesetting.  And 'atom' consists
12 of a nucleus, an optional superscript, and an optional subscript.
13
14 Exactly where the subscript and superscript are drawn depends on the
15 size, and type, of the nucleus they are attached to.
16
17 Jules
18
19 --
20
21 Ok: Implementing it thusly is not feasible since cursor movement gets
22 hackish. We use MathAtom only as a wrapper around MathInset * with value
23 semantics.
24
25 The MathAtom owns the MathInset * and is responsible for proper cloning and
26 destruction. Every MathInset * should be put into a MathAtom after its
27 creation as soon as possible.
28
29 Andre'
30
31 */
32
33 class MathInset;
34
35 class MathAtom {
36 public:
37         /// default constructor, object is useless, but we need it to put it into
38         // std::containers
39         MathAtom();
40         /// the "real constructor"
41         explicit MathAtom(MathInset * p);
42         /// copy constructor, invokes nucleus_->clone()
43         MathAtom(MathAtom const &);
44         /// we really need to clean up
45         ~MathAtom();
46         /// assignment invokes nucleus_->clone()
47         void operator=(MathAtom const &);
48         /// access to the inset (checked with gprof)
49         MathInset const * nucleus() const { return nucleus_; }
50         MathInset       * nucleus()       { return nucleus_; }
51         /// access to the inset
52         MathInset * operator->() const { return nucleus_; }
53
54 private:
55         ///
56         MathInset * nucleus_;
57 };
58
59 #endif