X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBullet.C;h=4104ee60f49fd8cfddf21c8d854ed2a7c3933b3f;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=d33b7ef662cb111896ec08a46f6907fcc5886af2;hpb=4fb18536e9db6c72df397fcdd4ecfbed7ed4052c;p=lyx.git diff --git a/src/Bullet.C b/src/Bullet.C index d33b7ef662..4104ee60f4 100644 --- a/src/Bullet.C +++ b/src/Bullet.C @@ -17,9 +17,13 @@ #include #include "Bullet.h" -#include "support/LAssert.h" -using namespace lyx::support; +#include + +namespace lyx { + +using std::string; + /** The four LaTeX itemize environment default bullets */ @@ -35,7 +39,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; @@ -52,8 +56,8 @@ Bullet::Bullet(int f, int c, int s) -Bullet::Bullet(string const & t) - : font(MIN), character(MIN), size(MIN), user_text(1), text(t) +Bullet::Bullet(docstring const & t) + : font(MIN), character(MIN), size(MIN), user_text(1), text(t) { testInvariant(); } @@ -95,7 +99,7 @@ void Bullet::setSize(int s) } -void Bullet::setText(string const & t) +void Bullet::setText(docstring const & t) { font = character = size = MIN; user_text = 1; @@ -135,7 +139,7 @@ Bullet & Bullet::operator=(Bullet const & b) } -string const & Bullet::getText() const +docstring const & Bullet::getText() const { if (user_text == 0) { generateText(); @@ -191,7 +195,7 @@ void Bullet::generateText() const } -string const Bullet::bulletSize(int s) +docstring const Bullet::bulletSize(int s) { // use a parameter rather than hard code `size' in here // in case some future function may want to retrieve @@ -203,11 +207,11 @@ string const Bullet::bulletSize(int s) "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge" }; - return BulletSize[s]; + return from_ascii(BulletSize[s]); } -string const Bullet::bulletEntry(int f, int c) +docstring const Bullet::bulletEntry(int f, int c) { // Despite how this may at first appear the static local variables // are only initialized once.. @@ -348,31 +352,34 @@ string const Bullet::bulletEntry(int f, int c) BulletPanel4, BulletPanel5 }; - return BulletPanels[f][c]; + return from_ascii(BulletPanels[f][c]); } void Bullet::testInvariant() const { #ifdef ENABLE_ASSERTIONS - 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 } + + +} // namespace lyx