A bit more re-organization.
[lyx.git] / src / mathed / MathAtom.h
blob7c00794e80f5d1b42e0ee2f3e3707243f9c0ead0
1 // -*- C++ -*-
2 /**
3 * \file MathAtom.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author André Pönitz
9 * Full author contact details are available in file CREDITS.
12 #ifndef MATH_ATOM_H
13 #define MATH_ATOM_H
16 /**
17 Wrapper for InsetMath * with copy-semantics
21 The 'atom' is the major blob in math typesetting. And 'atom' consists
22 of a nucleus, an optional superscript, and an optional subscript.
24 Exactly where the subscript and superscript are drawn depends on the
25 size, and type, of the nucleus they are attached to.
27 Jules
31 Ok: Implementing it thusly is not feasible since cursor movement gets
32 hackish. We use MathAtom only as a wrapper around InsetMath * with value
33 semantics.
35 The MathAtom owns the InsetMath * and is responsible for proper cloning and
36 destruction. Every InsetMath * should be put into a MathAtom after its
37 creation as soon as possible.
39 Andre'
43 namespace lyx {
45 class Inset;
46 class InsetMath;
48 class MathAtom {
49 public:
50 /// default constructor, object is useless, but we need it to put it into
51 // std::containers
52 MathAtom();
53 /// the "real constructor"
54 explicit MathAtom(Inset * p);
55 /// copy constructor, invokes nucleus_->clone()
56 MathAtom(MathAtom const &);
57 /// we really need to clean up
58 ~MathAtom();
59 /// assignment invokes nucleus_->clone()
60 MathAtom & operator=(MathAtom const &);
61 /// access to the inset (checked with gprof)
62 InsetMath * nucleus() { return nucleus_; }
63 InsetMath const * nucleus() const { return nucleus_; }
64 /// access to the inset
65 InsetMath const * operator->() const { return nucleus_; }
67 private:
68 ///
69 InsetMath * nucleus_;
73 } // namespace lyx
75 #endif