]> git.lyx.org Git - lyx.git/blob - src/Bullet.h
a0ac36c773caa8c77053847e1ad8c36cc3cf675c
[lyx.git] / src / Bullet.h
1 // -*- C++ -*-
2 /**
3  * \file Bullet.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Allan Rae
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef BULLET_H
14 #define BULLET_H
15
16 #include "LString.h"
17
18 ///
19 class Bullet {
20 public:
21         ///
22         Bullet(int f = -1, int c = -1, int s = -1);
23
24         ///
25         explicit Bullet(string const &);
26
27         ///
28         void setCharacter(int);
29         ///
30         void setFont(int);
31         ///
32         void setSize(int);
33         ///
34         void setText(string const &);
35         ///
36         int getCharacter() const;
37         ///
38         int getFont() const;
39         ///
40         int getSize() const;
41         ///
42         string const & getText() const;
43         ///
44         Bullet & operator=(Bullet const &);
45         ///
46         friend bool operator==(Bullet const &, Bullet const &);
47 protected:
48 #ifdef ENABLE_ASSERTIONS
49         ///
50         void testInvariant() const;
51 #endif
52 private:
53         /**
54            This enum makes adding additional panels or changing panel sizes
55            easier. Since you only need change these values for all tests to
56            be correct for the new values.
57
58            Note: MAX means the size of the array so to test you need:
59            (x < MAX)  *not* (x <= MAX)
60         */
61         enum {
62                 ///
63                 MIN = -1,
64                 ///
65                 FONTMAX = 6,
66                 ///
67                 CHARMAX = 36,
68                 ///
69                 SIZEMAX = 10
70         };
71
72         ///
73         void generateText() const;
74         ///
75         static string const bulletSize(int);
76         ///
77         static string const bulletEntry(int, int);
78
79         ///
80         int font;
81         ///
82         int character;
83         ///
84         int size;
85
86         // size, character and font are array indices to access
87         // the predefined arrays of LaTeX equivalent strings.
88
89         /** flag indicates if user has control of text (1)
90             or if I can use it to generate strings (0)
91             or have already (-1)
92         */
93         mutable short user_text;
94
95         //NOTE: Arranging these four shorts above to be together
96         //      like this should ensure they are in a single cache line
97
98         /** text may contain a user-defined LaTeX symbol command
99             or one generated internally from the font, character
100             and size settings.
101         */
102         mutable string text;
103 };
104
105
106 inline
107 bool operator!=(Bullet const & b1, Bullet const & b2)
108 {
109         return !(b1 == b2);
110 }
111
112 ///
113 extern
114 Bullet const ITEMIZE_DEFAULTS[];
115
116 #endif /* BULLET_H_ */