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