]> git.lyx.org Git - lyx.git/blobdiff - src/Bullet.h
Fix crash when running lyx -dbg insets -e ...
[lyx.git] / src / Bullet.h
index c4c8203f8bb423c61d4c7a8f618fd2234457da33..455809973ef57fafc97d440ea60c00ee7a8d6dc3 100644 (file)
@@ -6,7 +6,7 @@
  *           LyX, The Document Processor
  *
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
+ *           Copyright 1995-2001 The LyX Team.
  *
  *           This file Copyright 1997-1999
  *           Allan Rae
@@ -47,33 +47,26 @@ public:
        ///
        int getSize() const;
        ///
-       string getText() const;
+       string const & getText() const;
        ///
-       string getText();
-       ///
-       char const * c_str() const;
-       ///
-       Bullet & operator = (Bullet const &);
+       Bullet & operator=(Bullet const &);
        ///
        friend bool operator==(Bullet const &, Bullet const &);
-       ///
-       friend bool operator!=(Bullet const & b1, Bullet const & b2) {
-               return !(b1 == b2);
-       }
 protected:
 #ifdef ENABLE_ASSERTIONS
+       ///
        void testInvariant() const {
-               Assert(font >= MIN);
-               Assert(font < FONTMAX);
-               Assert(character >= MIN);
-               Assert(character < CHARMAX);
-               Assert(size >= MIN);
-               Assert(size < SIZEMAX);
-               Assert(user_text >= -1);
-               Assert(user_text <= 1);
+               lyx::Assert(font >= MIN);
+               lyx::Assert(font < FONTMAX);
+               lyx::Assert(character >= MIN);
+               lyx::Assert(character < CHARMAX);
+               lyx::Assert(size >= MIN);
+               lyx::Assert(size < SIZEMAX);
+               lyx::Assert(user_text >= -1);
+               lyx::Assert(user_text <= 1);
                // now some relational/operational tests
                if (user_text == 1) {
-                       Assert(font == -1 && (character == -1 && size == -1));
+                       lyx::Assert(font == -1 && (character == -1 && size == -1));
                        //        Assert(!text.empty()); // this isn't necessarily an error
                }
                //      else if (user_text == -1) {
@@ -106,18 +99,18 @@ private:
        };
        
        ///
-       void generateText();
+       void generateText() const;
        ///
-       static string bulletSize(short int);
+       static string const bulletSize(short int);
        ///
-       static string bulletEntry(short int, short int);
+       static string const bulletEntry(short int, short int);
        
        ///
-       short font;
+       int font;
        ///
-       short character;
+       int character;
        ///
-       short size;
+       int size;
        
        // size, character and font are array indices to access 
        // the predefined arrays of LaTeX equivalent strings.
@@ -126,7 +119,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,7 +128,7 @@ private:
            or one generated internally from the font, character
            and size settings.
        */
-       string text;
+       mutable string text;
 };
 
 
@@ -229,13 +222,6 @@ int Bullet::getSize() const
 }
 
 
-inline
-string Bullet::getText() const
-{
-       return text;
-}
-
-
 inline
 Bullet & Bullet::operator=(Bullet const & b)
 {
@@ -253,16 +239,15 @@ Bullet & Bullet::operator=(Bullet const & b)
        return *this;
 }
 
+/*-----------------End Bullet Member Functions-----------------*/
 
 inline
-char const * Bullet::c_str() const
+bool operator!=(Bullet const & b1, Bullet const & b2)
 {
-       return this->getText().c_str();
+       return !(b1 == b2);
 }
 
-
-/*-----------------End Bullet Member Functions-----------------*/
-
+///
 extern
 Bullet const ITEMIZE_DEFAULTS[];