X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBullet.C;h=91965f9706ba176b2dcf5fceed6f2509a7aa655a;hb=6c2e78e12855d8661eb289ded3dc8722748863b8;hp=648b42d317bc4bb82e529cfe19de177b925d7e59;hpb=0be0fcfd5907d448cd51addf83ed7032719a0692;p=lyx.git diff --git a/src/Bullet.C b/src/Bullet.C index 648b42d317..91965f9706 100644 --- a/src/Bullet.C +++ b/src/Bullet.C @@ -17,9 +17,11 @@ #include #include "Bullet.h" -#include "support/LAssert.h" -using namespace lyx::support; +#include + +using std::string; + /** The four LaTeX itemize environment default bullets */ @@ -35,7 +37,7 @@ Bullet const ITEMIZE_DEFAULTS[4] = { Bullet(0, 8),//"\\(\\bullet\\)" Bullet::Bullet(int f, int c, int s) - : font(f), character(c), size(s), user_text(0) + : font(f), character(c), size(s), user_text(0) { if (f < MIN || f >= FONTMAX) { font = MIN; @@ -47,19 +49,15 @@ Bullet::Bullet(int f, int c, int s) size = MIN; } generateText(); -#ifdef ENABLE_ASSERTIONS testInvariant(); -#endif } Bullet::Bullet(string const & t) - : font(MIN), character(MIN), size(MIN), user_text(1), text(t) + : font(MIN), character(MIN), size(MIN), user_text(1), text(t) { -#ifdef ENABLE_ASSERTIONS testInvariant(); -#endif } @@ -71,9 +69,7 @@ void Bullet::setCharacter(int c) character = c; } user_text = 0; -#ifdef ENABLE_ASSERTIONS testInvariant(); -#endif } @@ -85,9 +81,7 @@ void Bullet::setFont(int f) font = f; } user_text = 0; -#ifdef ENABLE_ASSERTIONS testInvariant(); -#endif } @@ -99,9 +93,7 @@ void Bullet::setSize(int s) size = s; } user_text = 0; -#ifdef ENABLE_ASSERTIONS testInvariant(); -#endif } @@ -110,9 +102,7 @@ void Bullet::setText(string const & t) font = character = size = MIN; user_text = 1; text = t; -#ifdef ENABLE_ASSERTIONS testInvariant(); -#endif } @@ -136,17 +126,13 @@ int Bullet::getSize() const Bullet & Bullet::operator=(Bullet const & b) { -#ifdef ENABLE_ASSERTIONS b.testInvariant(); -#endif font = b.font; character = b.character; size = b.size; user_text = b.user_text; text = b.text; -#ifdef ENABLE_ASSERTIONS this->testInvariant(); -#endif return *this; } @@ -367,27 +353,28 @@ string const Bullet::bulletEntry(int f, int c) return BulletPanels[f][c]; } +void Bullet::testInvariant() const +{ #ifdef ENABLE_ASSERTIONS -void Bullet::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); + BOOST_ASSERT(font >= MIN); + BOOST_ASSERT(font < FONTMAX); + BOOST_ASSERT(character >= MIN); + BOOST_ASSERT(character < CHARMAX); + BOOST_ASSERT(size >= MIN); + BOOST_ASSERT(size < SIZEMAX); + BOOST_ASSERT(user_text >= -1); + BOOST_ASSERT(user_text <= 1); // now some relational/operational tests if (user_text == 1) { - Assert(font == -1 && (character == -1 && size == -1)); - // Assert(!text.empty()); // this isn't necessarily an error + BOOST_ASSERT(font == -1 && (character == -1 && size == -1)); + // BOOST_ASSERT(!text.empty()); // this isn't necessarily an error } // else if (user_text == -1) { - // Assert(!text.empty()); // this also isn't necessarily an error + // BOOST_ASSERT(!text.empty()); // this also isn't necessarily an error // } // else { // // user_text == 0 - // Assert(text.empty()); // not usually true + // BOOST_ASSERT(text.empty()); // not usually true // } -} #endif +}