]> git.lyx.org Git - lyx.git/blobdiff - src/Bullet.h
NEW_INSETS changes, + some small things in insettabular.C
[lyx.git] / src / Bullet.h
index 4ad38431cd687db4afd959e60b84fa6201e65f9c..446f18b1e5ad5283d0af882e0e7274c800e340d5 100644 (file)
 class Bullet {
 public:
        ///
-       Bullet(const int f = -1, const int c = -1, const int s = -1);
+       Bullet(int f = -1, int c = -1, int s = -1);
 
        ///
-       Bullet(string const &);
+       explicit Bullet(string const &);
 
        ///
        void setCharacter(int);
@@ -47,9 +47,7 @@ public:
        ///
        int getSize() const;
        ///
-       string getText() const;
-       ///
-       string getText();
+       string const & getText() const;
        ///
        char const * c_str() const;
        ///
@@ -106,7 +104,7 @@ private:
        };
        
        ///
-       void generateText();
+       void generateText() const;
        ///
        static string bulletSize(short int);
        ///
@@ -126,7 +124,7 @@ private:
            or if I can use it to generate strings (0)
            or have already (-1)
        */
-       short user_text; 
+       mutable short user_text; 
        
        //NOTE: Arranging these four shorts above to be together
        //      like this should ensure they are in a single cache line
@@ -135,13 +133,14 @@ private:
            or one generated internally from the font, character
            and size settings.
        */
-       string text;
+       mutable string text;
 };
 
 
 /*----------------Inline Bullet Member Functions------------------*/
 
-inline Bullet::Bullet(string const & t) 
+inline
+Bullet::Bullet(string const & t) 
        :  font(MIN), character(MIN), size(MIN), user_text(1), text(t)
 {
 #ifdef ENABLE_ASSERTIONS
@@ -150,7 +149,8 @@ inline Bullet::Bullet(string const & t)
 }
 
 
-inline void Bullet::setCharacter(int c)
+inline
+void Bullet::setCharacter(int c)
 {
        if (c < MIN || c >= CHARMAX) {
                character = MIN;
@@ -164,7 +164,8 @@ inline void Bullet::setCharacter(int c)
 }
 
 
-inline void Bullet::setFont(int f)
+inline
+void Bullet::setFont(int f)
 {
        if (f < MIN || f >= FONTMAX) {
                font = MIN;
@@ -178,7 +179,8 @@ inline void Bullet::setFont(int f)
 }
 
 
-inline void Bullet::setSize(int s)
+inline
+void Bullet::setSize(int s)
 {
        if (s < MIN || s >= SIZEMAX) {
                size = MIN;
@@ -192,7 +194,8 @@ inline void Bullet::setSize(int s)
 }
 
 
-inline void Bullet::setText(string const & t)
+inline
+void Bullet::setText(string const & t)
 {
        font = character = size = MIN;
        user_text = 1;
@@ -203,31 +206,29 @@ inline void Bullet::setText(string const & t)
 }
 
 
-inline int Bullet::getCharacter() const
+inline
+int Bullet::getCharacter() const
 {
        return character;
 }
 
 
-inline int Bullet::getFont() const
+inline
+int Bullet::getFont() const
 {
        return font;
 }
 
 
-inline int Bullet::getSize() const
+inline
+int Bullet::getSize() const
 {
        return size;
 }
 
 
-inline string Bullet::getText() const
-{
-       return text;
-}
-
-
-inline Bullet & Bullet::operator=(Bullet const & b)
+inline
+Bullet & Bullet::operator=(Bullet const & b)
 {
 #ifdef ENABLE_ASSERTIONS
        b.testInvariant();
@@ -244,9 +245,10 @@ inline Bullet & Bullet::operator=(Bullet const & b)
 }
 
 
-inline char const * Bullet::c_str() const
+inline
+char const * Bullet::c_str() const
 {
-       return this->getText().c_str();
+       return getText().c_str();
 }