X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBullet.h;h=446f18b1e5ad5283d0af882e0e7274c800e340d5;hb=35cf7dcb2bdfdcda465b69c58465f657c77fd9d7;hp=f52794f20de47d7f6b68c75c3d7fb6a18de53c8b;hpb=9ce32d63e5ff1dbf4c04e3d8263b2649ef3ac595;p=lyx.git diff --git a/src/Bullet.h b/src/Bullet.h index f52794f20d..446f18b1e5 100644 --- a/src/Bullet.h +++ b/src/Bullet.h @@ -30,7 +30,7 @@ public: Bullet(int f = -1, int c = -1, int s = -1); /// - Bullet(string const &); + explicit Bullet(string const &); /// void setCharacter(int); @@ -47,11 +47,9 @@ public: /// int getSize() const; /// - string getText() const; + string const & getText() const; /// - string getText(); - /// - char const * c_str(); + char const * c_str() const; /// Bullet & operator = (Bullet 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() +inline +char const * Bullet::c_str() const { - return this->getText().c_str(); + return getText().c_str(); }