+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * configure.ac (AH_BOTTOM): add blurb for BOOST_ASSERT
+
2003-09-08 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* README.MacOSX: new file.
dnl ;;
gtk)
XFORMS_DO_IT_ALL
- PKG_CHECK_MODULES(GTK_FRONTEND, gtkmm-2.0 libglademm-2.0)
+ PKG_CHECK_MODULES(GTK_FRONTEND, gtkmm-2.0 libglademm-2.0)
FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-gtk\$(EXEEXT)"
FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS xforms gtk"
RPM_FRONTEND="gtk"
#define USE_BOOST_FORMAT 0
#endif
+#if defined(ENABLE_ASSERTIONS)
+#define BOOST_ENABLE_ASSERT_HANDLER 1
+#else
+#define BOOST_DISABLE_ASSERTS 1
+#endif
+
#define BOOST_DISABLE_THREADS 1
#define BOOST_NO_WREGEX 1
#define BOOST_NO_WSTRING 1
/**
- * \file BranchList.C
+ * \file BranchList.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Martin Vermeer
- *
+ *
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "BranchList.h"
-#include "support/LAssert.h"
+
+#include <boost/assert.hpp>
#include <functional>
using std::bind2nd;
using std::binary_function;
-using namespace lyx::support;
string const Branch::getBranch() const
return it->getColor();
}
}
- Assert(false); // Always
+ BOOST_ASSERT(false); // Always
return string(); // never gets here
}
return;
}
}
- Assert(false);
+ BOOST_ASSERT(false);
}
}
if (j == string::npos)
break;
- i = j + 1;
+ i = j + 1;
}
}
struct match : public binary_function<Branch, string, bool> {
bool operator()(Branch const & br, string const & s) const {
return (br.getBranch() == s);
- }
+ }
};
} // namespace anon.
List::const_iterator it = list.begin();
List::const_iterator end = list.end();
for (; it != end; ++it) {
- if (s == it->getBranch())
+ if (s == it->getBranch())
return it->getSelected();
}
return false;
string BranchList::allSelected() const
-{
+{
List::const_iterator it = list.begin();
List::const_iterator end = list.end();
string ret;
for (; it != end; ++it) {
- if (it->getSelected())
+ if (it->getSelected())
ret += it->getBranch() + separator();
}
// remove final '|':
#include "insets/updatableinset.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
#include "support/lyxalgo.h" // lyx_count
//
// Moved from lyx_cb.C (Lgb)
{
- Assert(!filen.empty());
+ BOOST_ASSERT(!filen.empty());
string const fname = MakeAbsPath(filen);
#include <config.h>
#include "Bullet.h"
-#include "support/LAssert.h"
-using namespace lyx::support;
+#include <boost/assert.hpp>
+
/** The four LaTeX itemize environment default bullets
*/
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
}
+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * boost.C (emergencyCleanup): moved here from LAssert.c
+ (assertion_failed): new function, called by BOOST_ASSERT
+
+ * several files: change Assert to BOOST_ASSERT
+
2003-09-09 Angus Leeming <leeming@lyx.org>
- * buffer.[Ch]: Add an Impl class and move Buffer's member variables into it.
- As a result move several header files out of buffer.h.
+ * buffer.[Ch]: Add an Impl class and move Buffer's member
+ variables into it. As a result move several header files out of
+ buffer.h.
Add header files to lots of .C files all over the tree as a result.
2003-09-09 Angus Leeming <leeming@lyx.org>
- * buffer.[Ch]: make Buffer's member variables private. Add accessor functions.
+ * buffer.[Ch]: make Buffer's member variables private. Add
+ accessor functions.
Lots of changes all over the tree as a result.
* insets/insetminipage.C:
* insets/insetnote.C:
* insets/insetoptarg.C: add header files needed to compile again.
-
+
2003-09-06 Angus Leeming <leeming@lyx.org>
* RowList_fwd.h: new file, forward-declaring Row rather than
#include "insets/insetinclude.h"
#include "insets/insettabular.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
+
using std::for_each;
using std::make_pair;
using std::pair;
ParagraphList::iterator endpit,
int start, int end, textclass_type tc)
{
- Assert(0 <= start && start <= startpit->size());
- Assert(0 <= end && end <= endpit->size());
- Assert(startpit != endpit || start <= end);
+ BOOST_ASSERT(0 <= start && start <= startpit->size());
+ BOOST_ASSERT(0 <= end && end <= endpit->size());
+ BOOST_ASSERT(startpit != endpit || start <= end);
ParagraphList paragraphs;
if (!checkPastePossible())
return make_pair(PitPosPair(pit, pos), pit);
- Assert (pos <= pit->size());
+ BOOST_ASSERT (pos <= pit->size());
// Make a copy of the CaP paragraphs.
ParagraphList simple_cut_clone = cuts[cut_index].first;
ParagraphList & pars,
ErrorList & errorlist)
{
- Assert(!pars.empty());
+ BOOST_ASSERT(!pars.empty());
int ret = 0;
if (c1 == c2)
#include "debug.h"
#include "LColor.h"
-#include "support/LAssert.h"
#include "gettext.h"
#include "support/lstrings.h"
}
-void LColor::fill(LColor::color c,
+void LColor::fill(LColor::color c,
string const & lyxname,
- string const & x11name,
- string const & latexname,
- string const & guiname)
+ string const & x11name,
+ string const & latexname,
+ string const & guiname)
{
ColorEntry ce;
ce.lcolor = c;
- ce.guiname = guiname.c_str();
- ce.latexname = latexname.c_str();
- ce.x11name = x11name.c_str();
- ce.lyxname = lyxname.c_str();
+ ce.guiname = guiname.c_str();
+ ce.latexname = latexname.c_str();
+ ce.x11name = x11name.c_str();
+ ce.lyxname = lyxname.c_str();
pimpl_->fill(ce);
}
{
Pimpl::Transform::const_iterator ici = pimpl_->transform.find(s);
if (ici != pimpl_->transform.end()) {
- Pimpl::InfoTab::const_iterator
+ Pimpl::InfoTab::const_iterator
it = pimpl_->infotab.find(ici->second);
- if (it != pimpl_->infotab.end())
- return it->second.guiname;
+ if (it != pimpl_->infotab.end())
+ return it->second.guiname;
}
return "none";
}
{
Pimpl::Transform::const_iterator ici = pimpl_->transform.find(s);
if (ici != pimpl_->transform.end()) {
- Pimpl::InfoTab::const_iterator
+ Pimpl::InfoTab::const_iterator
it = pimpl_->infotab.find(ici->second);
- if (it != pimpl_->infotab.end())
+ if (it != pimpl_->infotab.end())
return it->second.x11name;
}
lyxerr << "LyX internal error: Missing color"
{
Pimpl::Transform::const_iterator ici = pimpl_->transform.find(s);
if (ici != pimpl_->transform.end()) {
- Pimpl::InfoTab::const_iterator
+ Pimpl::InfoTab::const_iterator
it = pimpl_->infotab.find(ici->second);
- if (it != pimpl_->infotab.end())
+ if (it != pimpl_->infotab.end())
return it->second.latexname;
}
return "black";
return;
}
lyxerr << "LyX internal error: color and such." << endl;
- Assert(false);
+ BOOST_ASSERT(false);
}
#include "frontends/LyXView.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
#include "support/lyxfunctional.h"
#include "support/lstrings.h"
#include "support/tostr.h"
lyx::compare_memfun(&Menu::name, name));
if (cit == end())
lyxerr << "No submenu named " << name << endl;
- Assert(cit != end());
+ BOOST_ASSERT(cit != end());
return (*cit);
}
MenuList::iterator it =
find_if(menulist_.begin(), menulist_.end(),
lyx::compare_memfun(&Menu::name, name));
- Assert(it != menulist_.end());
+ BOOST_ASSERT(it != menulist_.end());
return (*it);
}
#include "PrinterParams.h"
#include "support/lstrings.h"
-#include "support/LAssert.h"
+
+#include <boost/assert.hpp>
PrinterParams::PrinterParams(Target t,
#ifdef ENABLE_ASSERTIONS
switch (target) {
case PRINTER:
- //lyx::support::Assert(!printer_name.empty());
+ //BOOST_ASSERT(!printer_name.empty());
break;
case FILE:
- lyx::support::Assert(!file_name.empty());
+ BOOST_ASSERT(!file_name.empty());
break;
default:
- lyx::support::Assert(false);
+ BOOST_ASSERT(false);
break;
}
#endif
#ifdef USE_ASPELL
-#include "support/LAssert.h"
#include "debug.h"
#include <aspell.h>
AspellSpeller * m = it->second.speller;
int word_ok = aspell_speller_check(m, word.word().c_str(), -1);
- Assert(word_ok != -1);
+ BOOST_ASSERT(word_ok != -1);
if (word_ok) {
res = OK;
} else {
AspellWordList const * sugs =
aspell_speller_suggest(m, word.word().c_str(), -1);
- Assert(sugs != 0);
+ BOOST_ASSERT(sugs != 0);
els = aspell_word_list_elements(sugs);
if (aspell_word_list_empty(sugs))
res = UNKNOWN;
#include "author.h"
-#include "support/LAssert.h"
#include "support/std_istream.h"
#include "support/lstrings.h"
+#include <boost/assert.hpp>
+
+
using namespace lyx::support;
bool operator==(Author const & l, Author const & r)
void AuthorList::record(int id, Author const & a)
{
- Assert(unsigned(id) < authors_.size());
+ BOOST_ASSERT(unsigned(id) < authors_.size());
authors_[id] = a;
}
Author const & AuthorList::get(int id)
{
Authors::const_iterator it(authors_.find(id));
- Assert(it != authors_.end());
+ BOOST_ASSERT(it != authors_.end());
return it->second;
}
#include <config.h>
+#include "lyx_main.h"
#include "debug.h"
-#include "support/LAssert.h"
-#include <exception>
+#include <boost/assert.hpp>
-using namespace lyx::support;
+#include <exception>
using std::endl;
{
lyxerr << "Exception caught:\n"
<< e.what() << endl;
- Assert(false);
+ BOOST_ASSERT(false);
+}
+
+
+namespace {
+
+void emergencyCleanup()
+{
+ static bool didCleanup;
+ if (didCleanup)
+ return;
+
+ didCleanup = true;
+
+ LyX::emergencyCleanup();
+}
+
+}
+
+
+void assertion_failed(char const * expr, char const * function,
+ char const * file, long line)
+{
+ lyxerr << "Assertion triggered in " << function << " by \"" <<
+ expr << " in file " << file << ":" << line << endl;
+ emergencyCleanup();
+ assert(false);
}
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/gzstream.h"
-#include "support/LAssert.h"
#include "support/lyxlib.h"
#include "support/os.h"
#include "support/path.h"
typedef std::map<string, bool> DepClean;
-struct Buffer::Impl
+struct Buffer::Impl
{
Impl(Buffer & parent, string const & file, bool readonly);
bool Buffer::readFile(LyXLex & lex, string const & filename,
ParagraphList::iterator pit)
{
- Assert(!filename.empty());
+ BOOST_ASSERT(!filename.empty());
if (!lex.isOK()) {
Alert::error(_("Document could not be read"),
#include "frontends/Alert.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
#include "support/lyxfunctional.h"
#include <boost/bind.hpp>
void BufferList::release(Buffer * buf)
{
- Assert(buf);
+ BOOST_ASSERT(buf);
BufferStorage::iterator it = find(bstore.begin(), bstore.end(), buf);
if (it != bstore.end()) {
// Make sure that we don't store a LyXText in
bool BufferList::close(Buffer * buf, bool ask)
{
- Assert(buf);
+ BOOST_ASSERT(buf);
// FIXME: is the quitting check still necessary ?
if (!ask || buf->isClean() || quitting || buf->paragraphs().empty()) {
bool BufferList::isLoaded(Buffer const * b) const
{
- Assert(b);
-
+ BOOST_ASSERT(b);
+
BufferStorage::const_iterator cit =
find(bstore.begin(), bstore.end(), b);
return cit != bstore.end();
#include "frontends/Alert.h"
-#include "support/LAssert.h"
#include "support/lyxalgo.h" // for lyx::count
#include <boost/array.hpp>
Bullet & BufferParams::temp_bullet(lyx::size_type index)
{
- support::Assert(index < 4);
+ BOOST_ASSERT(index < 4);
return pimpl_->temp_bullets[index];
}
Bullet const & BufferParams::temp_bullet(lyx::size_type index) const
{
- support::Assert(index < 4);
+ BOOST_ASSERT(index < 4);
return pimpl_->temp_bullets[index];
}
Bullet & BufferParams::user_defined_bullet(lyx::size_type index)
{
- support::Assert(index < 4);
+ BOOST_ASSERT(index < 4);
return pimpl_->user_defined_bullets[index];
}
Bullet const & BufferParams::user_defined_bullet(lyx::size_type index) const
{
- support::Assert(index < 4);
+ BOOST_ASSERT(index < 4);
return pimpl_->user_defined_bullets[index];
}
string color = lex.getString();
branchlist().setColor(branch, color);
// Update also the LColor table:
- if (color == "none")
+ if (color == "none")
color = lcolor.getX11Name(LColor::background);
- lcolor.fill(static_cast<LColor::color>(lcolor.size()),
+ lcolor.fill(static_cast<LColor::color>(lcolor.size()),
branch, color);
}
}
std::list<Branch>::const_iterator end = branchlist().end();
for (; it != end; ++it) {
os << "\\branch " << it->getBranch()
- << "\n\\selected " << it->getSelected()
- << "\n\\color " << it->getColor()
- << "\n\\end_branch"
+ << "\n\\selected " << it->getSelected()
+ << "\n\\color " << it->getColor()
+ << "\n\\end_branch"
<< "\n";
}
#include "changes.h"
#include "debug.h"
-#include "support/LAssert.h"
+#include <boost/assert.hpp>
-using namespace lyx::support;
using std::endl;
using lyx::pos_type;
+
bool operator==(Change const & l, Change const & r)
{
return l.type == r.type && l.author == r.author
}
check();
- Assert(false);
+ BOOST_ASSERT(false);
return Change(Change::UNCHANGED);
}
}
check();
- Assert(0);
+ BOOST_ASSERT(0);
return Change::UNCHANGED;
}
if (lyxerr.debugging(Debug::CHANGES))
lyxerr[Debug::CHANGES] << "End" << endl;
- Assert(dont_assert);
+ BOOST_ASSERT(dont_assert);
}
#include "counters.h"
#include "debug.h"
-#include "support/std_sstream.h"
+#include "support/std_sstream.h"
#include "support/lstrings.h"
-#include "support/LAssert.h"
+
+#include <boost/assert.hpp>
using namespace lyx::support;
void Counters::reset(string const & match)
{
- Assert(!match.empty());
+ BOOST_ASSERT(!match.empty());
CounterList::iterator it = counterList.begin();
CounterList::iterator end = counterList.end();
+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * Timeout.C: change Assert to BOOST_ASSERT
+
2003-09-07 Angus Leeming <leeming@lyx.org>
* Alert.h: remove #include <algorithm>.
#include "Timeout.h"
-#include "support/LAssert.h"
-
-using namespace lyx::support;
-
Timeout::~Timeout()
{
Timeout & Timeout::setTimeout(unsigned int msec)
{
// Can't have a timeout of zero!
- Assert(msec);
+ BOOST_ASSERT(msec);
timeout_ms = msec;
return * this;
* Full author contact details are available in file CREDITS.
*/
-
#include <config.h>
+
#include "ButtonController.h"
#include "BCView.h"
-#include "support/LAssert.h"
-using namespace lyx::support;
BCView & ButtonController::view() const
{
- Assert(view_.get());
+ BOOST_ASSERT(view_.get());
return *view_.get();
}
ButtonPolicy & ButtonController::bp() const
{
- Assert(bp_.get());
+ BOOST_ASSERT(bp_.get());
return *bp_.get();
}
+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * several files: change Assert to BOOST_ASSERT
+
2003-09-08 Angus Leeming <leeming@lyx.org>
* ControlCommandBuffer.C:
#include "ButtonController.h"
#include "BCView.h"
#include "lyxrc.h"
-#include "support/LAssert.h"
-using namespace lyx::support;
ControlButtons::ControlButtons()
: emergency_exit_(false), is_closing_(false),
ButtonController & ControlButtons::bc()
{
- Assert(bc_ptr_.get());
+ BOOST_ASSERT(bc_ptr_.get());
return *bc_ptr_.get();
}
ViewBase & ControlButtons::view()
{
- Assert(view_ptr_);
+ BOOST_ASSERT(view_ptr_);
return *view_ptr_;
}
#include "frontends/LyXView.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
#include "support/path_defines.h"
using namespace lyx::support;
BufferParams & ControlDocument::params()
{
- Assert(bp_.get());
+ BOOST_ASSERT(bp_.get());
return *bp_;
}
#include "insets/ExternalTemplate.h"
-#include "support/LAssert.h"
using namespace lyx::support;
using std::vector;
void ControlExternal::setParams(InsetExternal::Params const & p)
{
- Assert(params_.get());
+ BOOST_ASSERT(params_.get());
*params_ = p;
}
InsetExternal::Params const & ControlExternal::params() const
{
- Assert(params_.get());
+ BOOST_ASSERT(params_.get());
return *params_;
}
void ControlExternal::editExternal()
{
- Assert(params_.get());
+ BOOST_ASSERT(params_.get());
dialog().view().apply();
string const lfun =
#include "debug.h"
#include "funcrequest.h"
-#include "support/LAssert.h"
#include "support/lyxalgo.h" // sorted
#include "support/lstrings.h"
#include "support/filetools.h"
{
XPMmap const * const begin = sorted_xpm_map;
XPMmap const * const end = begin + nr_sorted_xpm_map;
- Assert(lyx::sorted(begin, end));
+ BOOST_ASSERT(lyx::sorted(begin, end));
XPMmap const * const it =
std::find_if(begin, end, CompareKey(name));
#include "lyxlex.h"
#include "paragraph.h"
#include "ParagraphParameters.h"
-#include "support/LAssert.h"
#include "support/std_sstream.h"
-using namespace lyx::support;
-
using std::istringstream;
using std::ostringstream;
ParagraphParameters & ControlParagraph::params()
{
- Assert(params_.get());
+ BOOST_ASSERT(params_.get());
return *params_;
}
ParagraphParameters const & ControlParagraph::params() const
{
- Assert(params_.get());
+ BOOST_ASSERT(params_.get());
return *params_;
}
#include "support/tostr.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
#include "support/path.h"
#include "support/systemcall.h"
PrinterParams & ControlPrint::params() const
{
- Assert(params_);
+ BOOST_ASSERT(params_);
return *params_;
}
#include "lyxrc.h"
#include "paragraph.h"
#include "insets/insettabular.h"
-#include "support/LAssert.h"
-
-using namespace lyx::support;
ControlTabular::ControlTabular(Dialog & parent)
LyXTabular const & ControlTabular::tabular() const
{
- Assert(params_.get());
+ BOOST_ASSERT(params_.get());
return *params_.get();
}
#include "ButtonController.h"
#include "BCView.h"
-#include "support/LAssert.h"
-using namespace lyx::support;
Dialog::Dialog(LyXView & lv, string const & name)
: is_closing_(false), kernel_(lv), name_(name),
ButtonController & Dialog::bc() const
{
- Assert(bc_ptr_.get());
+ BOOST_ASSERT(bc_ptr_.get());
return *bc_ptr_.get();
}
void Dialog::setController(Controller * i)
{
- Assert(i && !controller_ptr_.get());
+ BOOST_ASSERT(i && !controller_ptr_.get());
controller_ptr_.reset(i);
}
void Dialog::setView(View * v)
{
- Assert(v && !view_ptr_.get());
+ BOOST_ASSERT(v && !view_ptr_.get());
view_ptr_.reset(v);
}
Dialog::Controller & Dialog::controller() const
{
- Assert(controller_ptr_.get());
+ BOOST_ASSERT(controller_ptr_.get());
return *controller_ptr_.get();
}
Dialog::View & Dialog::view() const
{
- Assert(view_ptr_.get());
+ BOOST_ASSERT(view_ptr_.get());
return *view_ptr_.get();
}
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
-#include "support/LAssert.h"
-
-using lyx::support::Assert;
Kernel::Kernel(LyXView & lyxview)
: lyxview_(lyxview)
Buffer & Kernel::buffer()
{
- Assert(lyxview_.buffer());
+ BOOST_ASSERT(lyxview_.buffer());
return *lyxview_.buffer();
}
Buffer const & Kernel::buffer() const
{
- Assert(lyxview_.buffer());
+ BOOST_ASSERT(lyxview_.buffer());
return *lyxview_.buffer();
}
#include "ViewBase.h"
#include "ControlButtons.h"
-#include "support/LAssert.h"
-using namespace lyx::support;
ViewBase::ViewBase(string const & t)
: controller_ptr_(0), title_(t)
ControlButtons & ViewBase::getController()
{
- Assert(controller_ptr_);
+ BOOST_ASSERT(controller_ptr_);
return *controller_ptr_;
}
ControlButtons const & ViewBase::getController() const
{
- Assert(controller_ptr_);
+ BOOST_ASSERT(controller_ptr_);
return *controller_ptr_;
}
#include "gettext.h" // for _()
#include "support/lstrings.h"
-#include "support/LAssert.h"
#include <boost/regex.hpp>
string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
{
- Assert(!map.empty());
+ BOOST_ASSERT(!map.empty());
InfoMap::const_iterator it = map.find(key);
if (it == map.end())
string const getYear(InfoMap const & map, string const & key)
{
- Assert(!map.empty());
+ BOOST_ASSERT(!map.empty());
InfoMap::const_iterator it = map.find(key);
if (it == map.end())
string const getInfo(InfoMap const & map, string const & key)
{
- Assert(!map.empty());
+ BOOST_ASSERT(!map.empty());
InfoMap::const_iterator it = map.find(key);
if (it == map.end())
+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * GView.C: change Assert to BOOST_ASSERT
+ * GnomeBase.C: ditto
+
2003-07-21 Angus Leeming <leeming@lyx.org>
* lyx_gui.C (reset): use namespace lyx::graphics rather than grfx
* Full author contact details are available in file CREDITS.
*/
-
#include <config.h>
+
#include "GView.h"
-#include "support/LAssert.h"
#include "debug.h"
#include "support/filetools.h"
#include "ControlButtons.h"
+
#include <glib.h>
#include <gtkmm/dialog.h>
if (file.empty()) {
lyxerr << "Cannot find glade file. Aborting." << endl;
- lyx::Assert(true);
+ BOOST_ASSERT(true);
}
lyxerr[Debug::GUI] << "Glade file to open is " << file << endl;
* Full author contact details are available in file CREDITS.
*/
-
#include <config.h>
+
#include "GnomeBase.h"
-#include "support/LAssert.h"
#include "debug.h"
#include "support/filetools.h"
#include "ControlButtons.h"
+
#include <glib.h>
#include <gtkmm/dialog.h>
+
GnomeBase::GnomeBase(string const & name)
: ViewBase(),
updating_(false),
if (file.empty()) {
lyxerr << "Cannot find glade file. Aborting." << std::endl;
- lyx::Assert(true);
+ BOOST_ASSERT(true);
}
lyxerr[Debug::GUI] << "Glade file to open is " << file << endl;
+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * GPainter.C: change Assert to BOOST_ASSERT
+
2003-09-08 Angus Leeming <leeming@lyx.org>
* GPainter.h: do not #include <config.h> in header files.
#include "frontends/font_metrics.h"
#include "codeConvert.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include <boost/scoped_array.hpp>
+
#include <X11/Xft/Xft.h>
+
#include <cmath>
string const & s, LyXFont const & f)
{
size_t size = s.length() + 1;
- wchar_t * wcs = (wchar_t *) alloca(size * sizeof(wchar_t));
- size = mbstowcs(wcs, s.c_str(), size);
+ wchar_t * wcs = (wchar_t *) alloca(size * sizeof(wchar_t));
+ size = mbstowcs(wcs, s.c_str(), size);
return text(x, y, wcs, size, f);
}
for(int i = 0; i < ls; ++i) {
c = lyx::support::uppercase(s[i]);
if(c != s[i]) {
- XftDrawString32(draw, xftClr, fontS, tmpx, y,
+ XftDrawString32(draw, xftClr, fontS, tmpx, y,
wcsToFcChar32StrFast(&c), 1);
tmpx += font_metrics::width(c, smallfont);
} else {
return *this;
}
-
+
Painter & GPainter::text(int x, int y,
char const * s, size_t ls,
LyXFont const & f)
*/
#include <config.h>
+
#include "qt_helpers.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
#include "QBrowseBox.h"
#include "BulletsModule.h"
case 1: pb = bullet2PB; co = bulletsize2CO; break;
case 2: pb = bullet3PB; co = bulletsize3CO; break;
case 3: pb = bullet4PB; co = bulletsize4CO; break;
- default: Assert(false); break;
+ default: BOOST_ASSERT(false); break;
}
setBullet(pb, co, bullet);
+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * BulletsModule.C: change Assert to BOOST_ASSERT
+ * panelstack.C: ditto
+ * QDocument.C: ditto
+
2003-09-08 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* QLToolbar.C: include <qtoolbar.h>
* QLPopupMenu.h: include <utility>
- * qt_helpers.C:
+ * qt_helpers.C:
* qfont_loader.C: include <algorithm>
2003-09-08 Angus Leeming <leeming@lyx.org>
2003-09-05 Angus Leeming <leeming@lyx.org>
- * QCitation.h:
- * QGraphics.h:
- * QPrefs.h:
- * qscreen.[Ch]:
+ * QCitation.h:
+ * QGraphics.h:
+ * QPrefs.h:
+ * qscreen.[Ch]:
ensure that the header files can be compiled stand-alone.
2003-09-05 Angus Leeming <leeming@lyx.org>
2003-08-05 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
- * QWorkArea.C (QWorkArea):
- (dragEnterEvent):
+ * QWorkArea.C (QWorkArea):
+ (dragEnterEvent):
(dropEvent): add support for drag and drop of URIs
2003-08-03 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
2003-08-02 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
- * ui/Makefile.am (INCLUDES):
- * moc/Makefile.am (INCLUDES):
+ * ui/Makefile.am (INCLUDES):
+ * moc/Makefile.am (INCLUDES):
* Makefile.am (INCLUDES): use QT_INCLUDES
* QLToolbar.C (clearLayoutList): call Toolbar::clearLayoutList
2003-07-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
- * qfont_loader.C:
- * QLPopupMenu.h: add includes needed by gcc 2.95.3
+ * qfont_loader.C:
+ * QLPopupMenu.h: add includes needed by gcc 2.95.3
2003-07-27 John Levon <levon@movementarian.org>
2003-07-26 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
- * QPrefs.C:
- * QDocumentDialog.C:
- * QDocument.C:
+ * QPrefs.C:
+ * QDocumentDialog.C:
+ * QDocument.C:
* QGraphics.C: adapt PAPER_* enums
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
- * QLMenubar.h:
+ * QLMenubar.h:
* QLMenubar.C: derives from Menubar (replaces Menubar::Pimpl)
* Menubar_pimpl.C:
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
- * QLToolbar.h:
+ * QLToolbar.h:
* QLToolbar.C: derives from Toolbar (replaces Toolbar::Pimpl)
* Toolbar_pimpl.C:
// paper
QComboBox * cb = dialog_->pageLayoutModule->papersizeCO;
cb->insertItem(qt_("Default"));
- cb->insertItem(qt_("Custom"));
- cb->insertItem(qt_("US letter"));
- cb->insertItem(qt_("US legal"));
+ cb->insertItem(qt_("Custom"));
+ cb->insertItem(qt_("US letter"));
+ cb->insertItem(qt_("US legal"));
cb->insertItem(qt_("US executive"));
cb->insertItem(qt_("A3"));
cb->insertItem(qt_("A4"));
#include "panelstack.h"
-#include "support/LAssert.h"
-
#include "qt_helpers.h"
#include <qwidgetstack.h>
if (!parent.empty()) {
PanelMap::iterator it = panel_map_.find(parent);
- Assert(it != panel_map_.end());
+ BOOST_ASSERT(it != panel_map_.end());
QListViewItem * before = it->second->firstChild();
if (before) {
void PanelStack::setCurrentPanel(string const & name)
{
PanelMap::const_iterator cit = panel_map_.find(name);
- Assert(cit != panel_map_.end());
+ BOOST_ASSERT(cit != panel_map_.end());
// force on first set
if (list_->currentItem() == cit->second)
+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * several files: change Assert to BOOST_ASSERT
+
2003-09-08 Angus Leeming <leeming@lyx.org>
* FormFiledialog.C (UserCache::add, GroupCache::add): convert
* Alert_pimpl.C: move #include "debug.h" out of the header file.
-2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
+2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
* FormDocument.C: fix crash on doc settings for non-branched doc
* FormShowFile.C (build): Remove redundant "LyX:" string from title.
-2003-08-21 Martin Vermeer <martin.vermeer@hut.fi>
+2003-08-21 Martin Vermeer <martin.vermeer@hut.fi>
* FormNote.C: cosmetic fix.
-2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
+2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
* FormDocument.C: make the layout file's "Other" class option
appear on the document panel as "Extra Options".
* form/form_tabular.fd: fix shortcut ("Middle|#m" => "Middle|#M")
-2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
+2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
* ColorHandler.[Ch]:
* Dialogs.C:
tab of the document settings dialog. Branches are user definable
and have a "display colour" to distinguish them on-screen.
- ColorHandler was somewhat cleaned up.
+ ColorHandler was somewhat cleaned up.
(1) make possible a dynamically growing LColor list by allowing
- the graphic context cache to grow along (vector);
+ the graphic context cache to grow along (vector);
(2) eliminate an IMHO unnecessary step in colour allocation.
2003-08-12 Michael Schmitt <michael.schmitt@teststep.org>
2003-08-06 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* .cvsignore: add lyx_forms.h-tmp, stamp-forms, lyx_xpm.h-tmp,
- stamp-xpm.
+ stamp-xpm.
2003-08-06 Martin Vermeer <martin.vermeer@hut.di>
* Color.[Ch]:
* FormPreferences.C: moved the RGB to hex string method
from FormPreferences to Color and added a hex string to RGB
- method.
+ method.
2003-08-04 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
#include "Color.h"
-#include "support/LAssert.h"
-
#include "lyx_forms.h"
#include "support/std_sstream.h"
#include <cmath>
#include <iomanip>
-namespace support = lyx::support;
#ifndef CXX_GLOBAL_CSTD
using std::floor;
RGBColor::RGBColor(string const & x11hexname)
- : r(0), g(0), b(0)
+ : r(0), g(0), b(0)
{
- support::Assert(x11hexname.size() == 7 && x11hexname[0] == '#');
+ BOOST_ASSERT(x11hexname.size() == 7 && x11hexname[0] == '#');
r = hexstrToInt(x11hexname.substr(1,2));
g = hexstrToInt(x11hexname.substr(3,2));
b = hexstrToInt(x11hexname.substr(5,2));
#include "controllers/ControlButtons.h"
#include "support/filetools.h" // LibFileSearch
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "lyx_forms.h"
{
// build() is/should be called from the controller, so form() should
// always exist.
- Assert(form());
+ BOOST_ASSERT(form());
// we use minw_ to flag whether the dialog has ever been shown.
// In turn, prepare_to_show() initialises various bits 'n' pieces
void FormBase::setPrehandler(FL_OBJECT * ob)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
fl_set_object_prehandler(ob, C_PrehandlerCB);
}
void FormBase::setMessageWidget(FL_OBJECT * ob)
{
- Assert(ob && ob->objclass == FL_TEXT);
+ BOOST_ASSERT(ob && ob->objclass == FL_TEXT);
message_widget_ = ob;
fl_set_object_lsize(message_widget_, FL_NORMAL_SIZE);
}
// preemptive handler for feedback messages
void FormBase::MessageCB(FL_OBJECT * ob, int event)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
switch (event) {
case FL_ENTER:
void FormBase::PrehandlerCB(FL_OBJECT * ob, int event, int key)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
if (ob->objclass == FL_INPUT && event == FL_PUSH && key == 2) {
// Trigger an input event when pasting in an xforms input object
void FormBase::clearMessage()
{
- Assert(message_widget_);
+ BOOST_ASSERT(message_widget_);
warning_posted_ = false;
void FormBase::postMessage(string const & message)
{
- Assert(message_widget_);
+ BOOST_ASSERT(message_widget_);
int const width = message_widget_->w - 10;
string const tmp = warning_posted_ ?
FormBase * GetForm(FL_OBJECT * ob)
{
- Assert(ob && ob->form && ob->form->u_vdata);
+ BOOST_ASSERT(ob && ob->form && ob->form->u_vdata);
FormBase * ptr = static_cast<FormBase *>(ob->form->u_vdata);
return ptr;
}
static int C_WMHideCB(FL_FORM * form, void *)
{
// Close the dialog cleanly, even if the WM is used to do so.
- Assert(form && form->u_vdata);
+ BOOST_ASSERT(form && form->u_vdata);
FormBase * ptr = static_cast<FormBase *>(form->u_vdata);
ptr->getController().CancelButton();
return FL_CANCEL;
{
// Note that the return value is important in the pre-emptive handler.
// Don't return anything other than 0.
- Assert(ob);
+ BOOST_ASSERT(ob);
// Don't Assert this one, as it can happen quite naturally when things
// are being deleted in the d-tor.
- //Assert(ob->form);
+ //BOOST_ASSERT(ob->form);
if (!ob->form) return 0;
FormBase * ptr = static_cast<FormBase *>(ob->form->u_vdata);
#include "lyxrc.h"
#include "support/filetools.h" // LibFileSearch
-#include "support/LAssert.h"
#include "support/tostr.h"
#include "lyx_forms.h"
void C_FormColorpickerInputCB(FL_OBJECT * ob, long d)
{
- lyx::support::Assert(ob && ob->form && ob->form->u_vdata);
+ BOOST_ASSERT(ob && ob->form && ob->form->u_vdata);
FormColorpicker * ptr =
static_cast<FormColorpicker *>(ob->form->u_vdata);
ptr->input(ob, d);
static int C_WMHideCB(FL_FORM * form, void *)
{
// Close the dialog cleanly, even if the WM is used to do so.
- lyx::support::Assert(form && form->u_vdata);
+ BOOST_ASSERT(form && form->u_vdata);
FormColorpicker * ptr = static_cast<FormColorpicker *>(form->u_vdata);
ptr->input(0, 0);
return FL_CANCEL;
#include "lyxrc.h"
#include "support/filetools.h" // LibFileSearch
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "lyx_forms.h"
void FormDialogView::setPrehandler(FL_OBJECT * ob)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
fl_set_object_prehandler(ob, C_PrehandlerCB);
}
void FormDialogView::setMessageWidget(FL_OBJECT * ob)
{
- Assert(ob && ob->objclass == FL_TEXT);
+ BOOST_ASSERT(ob && ob->objclass == FL_TEXT);
message_widget_ = ob;
fl_set_object_lsize(message_widget_, FL_NORMAL_SIZE);
}
// preemptive handler for feedback messages
void FormDialogView::MessageCB(FL_OBJECT * ob, int event)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
switch (event) {
case FL_ENTER:
void FormDialogView::PrehandlerCB(FL_OBJECT * ob, int event, int key)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
if (ob->objclass == FL_INPUT && event == FL_PUSH && key == 2) {
// Trigger an input event when pasting in an xforms input
void FormDialogView::clearMessage()
{
- Assert(message_widget_);
+ BOOST_ASSERT(message_widget_);
warning_posted_ = false;
void FormDialogView::postMessage(string const & message)
{
- Assert(message_widget_);
+ BOOST_ASSERT(message_widget_);
int const width = message_widget_->w - 10;
string const tmp = warning_posted_ ?
FormDialogView * GetForm(FL_OBJECT * ob)
{
- Assert(ob && ob->form && ob->form->u_vdata);
+ BOOST_ASSERT(ob && ob->form && ob->form->u_vdata);
FormDialogView * ptr =
static_cast<FormDialogView *>(ob->form->u_vdata);
return ptr;
static int C_WMHideCB(FL_FORM * form, void *)
{
// Close the dialog cleanly, even if the WM is used to do so.
- Assert(form && form->u_vdata);
+ BOOST_ASSERT(form && form->u_vdata);
FormDialogView * ptr = static_cast<FormDialogView *>(form->u_vdata);
ptr->dialog().CancelButton();
return FL_CANCEL;
{
// Note that the return value is important in the pre-emptive handler.
// Don't return anything other than 0.
- Assert(ob);
+ BOOST_ASSERT(ob);
// Don't Assert this one, as it can happen quite naturally when things
// are being deleted in the d-tor.
- //Assert(ob->form);
+ //BOOST_ASSERT(ob->form);
if (!ob->form) return 0;
FormDialogView * ptr =
#include "ControlMath.h"
-#include "support/LAssert.h"
-
-using namespace lyx::support;
using std::max;
using std::vector;
void FormMathsBitmap::build()
{
- Assert(bitmaps_.size() > 0);
+ BOOST_ASSERT(bitmaps_.size() > 0);
h_+= 42; // Allow room for a Close button
#include "controllers/ButtonController.h"
-#include "support/LAssert.h"
#include "support/lyxalgo.h" // lyx::count
#include "lyx_forms.h"
#include "support/std_sstream.h"
-using namespace lyx::support;
using std::ostringstream;
int C_FormMathsMatrixAlignFilter(FL_OBJECT * ob, char const *,
char const * cur, int c)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
FormMathsMatrix * pre =
static_cast<FormMathsMatrix *>(ob->u_vdata);
- Assert(pre);
+ BOOST_ASSERT(pre);
return pre->AlignFilter(cur, c);
}
#include "Spacing.h"
#include "vspace.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/tostr.h"
void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
{
// Paranoia check!
- Assert(choice_type && choice_type->objclass == FL_CHOICE &&
+ BOOST_ASSERT(choice_type && choice_type->objclass == FL_CHOICE &&
input_length && input_length->objclass == FL_INPUT);
if (fl_get_choice(choice_type) != 7)
FL_OBJECT * check_keep)
{
// Paranoia check!
- Assert(choice_type && choice_type->objclass == FL_CHOICE &&
+ BOOST_ASSERT(choice_type && choice_type->objclass == FL_CHOICE &&
input_length && input_length->objclass == FL_INPUT &&
choice_length && choice_length->objclass == FL_CHOICE &&
check_keep && check_keep->objclass == FL_CHECKBUTTON);
FL_OBJECT * check_keep)
{
// Paranoia check!
- Assert(choice_type && choice_type->objclass == FL_CHOICE &&
+ BOOST_ASSERT(choice_type && choice_type->objclass == FL_CHOICE &&
input_length && input_length->objclass == FL_INPUT &&
choice_length && choice_length->objclass == FL_CHOICE &&
check_keep && check_keep->objclass == FL_CHECKBUTTON);
#include "frnt_lang.h"
#include "lyxfont.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/tostr.h"
#include "support/path_defines.h"
string const FormPreferences::getFeedback(FL_OBJECT * ob)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
if (ob->form->fdui == colors_.dialog())
return colors_.feedback(ob);
ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
bool valid = true;
#include "debug.h"
-#include "support/LAssert.h"
#include "support/lyxfunctional.h"
#include "lyx_forms.h"
-using namespace lyx::support;
-
using std::endl;
{
// Object must be a ROUND3DBUTTON (let all radio buttons look the same)
// and of type RADIO_BUTTON (otherwise it ain't work).
- Assert(ob && ob->objclass == FL_ROUND3DBUTTON
+ BOOST_ASSERT(ob && ob->objclass == FL_ROUND3DBUTTON
&& ob->type == FL_RADIO_BUTTON);
map.push_back(ButtonValuePair(ob, value));
#include "xforms_helpers.h" // formatted
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "lyx_forms.h"
void Tooltips::init(FL_OBJECT * ob, string const & tip)
{
- Assert(ob && ob->form);
+ BOOST_ASSERT(ob && ob->form);
// Store the tooltip string
string const str = formatted(trim(tip), 400);
#include "lyxfunc.h"
#include "MenuBackend.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/tostr.h"
}
// Paranoia check
- Assert(item->kind() == MenuItem::Submenu);
+ BOOST_ASSERT(item->kind() == MenuItem::Submenu);
// set tabstop length
fl_set_tabstop(menu_tabstop);
#include "xforms_helpers.h"
#include "lyxgluelength.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "lyx_forms.h"
CheckedLyXLength::CheckedLyXLength(FL_OBJECT * input, FL_OBJECT * label)
: input_(input), label_(label ? label : input)
{
- Assert(input && input->objclass == FL_INPUT);
+ BOOST_ASSERT(input && input->objclass == FL_INPUT);
}
CheckedGlueLength::CheckedGlueLength(FL_OBJECT * input, FL_OBJECT * label)
: input_(input), label_(label ? label : input)
{
- Assert(input && input->objclass == FL_INPUT);
+ BOOST_ASSERT(input && input->objclass == FL_INPUT);
}
#include "Color.h"
#include "format.h"
#include "debug.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/lyxfunctional.h" // compare_memfun
#include "support/lyxlib.h"
int status_report(FL_IMAGE * ob, const char *s)
{
- Assert(ob && ob->u_vdata);
+ BOOST_ASSERT(ob && ob->u_vdata);
string const str = s ? rtrim(s) : string();
if (str.empty())
static void error_report(FL_IMAGE * ob, const char *s)
{
- Assert(ob && ob->u_vdata);
+ BOOST_ASSERT(ob && ob->u_vdata);
string const str = s ? rtrim(s) : string();
if (str.empty())
#include "support/FileInfo.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
#include "support/lstrings.h" // frontStrip, strip
#include "support/tostr.h"
}
break;
default:
- Assert(0);
+ BOOST_ASSERT(false);
}
return vec;
string const getString(FL_OBJECT * ob, int line)
{
// Negative line value does not make sense.
- Assert(line >= 0);
+ BOOST_ASSERT(line >= 0);
char const * tmp = 0;
switch (ob->objclass) {
break;
default:
- Assert(0);
+ BOOST_ASSERT(false);
}
return tmp ? trim(tmp) : string();
string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
{
// Paranoia check
- Assert(input && input->objclass == FL_INPUT &&
+ BOOST_ASSERT(input && input->objclass == FL_INPUT &&
choice && choice->objclass == FL_CHOICE);
string const length = trim(fl_get_input(input));
string const & default_unit)
{
// Paranoia check
- Assert(input && input->objclass == FL_INPUT &&
+ BOOST_ASSERT(input && input->objclass == FL_INPUT &&
choice && choice->objclass == FL_CHOICE);
if (len.empty()) {
#include "xforms_resize.h"
-#include "support/LAssert.h"
+
+#include <boost/assert.hpp>
+
#include <algorithm> // std::max. Use FL_max in .c code...
#include "lyx_forms.h"
-using namespace lyx::support;
namespace {
double get_tabfolder_scale_to_fit(FL_OBJECT * folder)
{
- Assert(folder && folder->objclass == FL_TABFOLDER);
+ BOOST_ASSERT(folder && folder->objclass == FL_TABFOLDER);
fl_freeze_form(folder->form);
int const saved_folder_id = fl_get_folder_number(folder);
void scale_tabfolder_horizontally(FL_OBJECT * folder, double factor)
{
- Assert(folder && folder->objclass == FL_TABFOLDER);
+ BOOST_ASSERT(folder && folder->objclass == FL_TABFOLDER);
fl_freeze_form(folder->form);
int const saved_folder_id = fl_get_folder_number(folder);
double get_scale_to_fit(FL_FORM * form)
{
- Assert(form);
+ BOOST_ASSERT(form);
double factor = get_scaling_factor(form);
for (FL_OBJECT * ob = form->first; ob; ob = ob->next) {
void scale_form_horizontally(FL_FORM * form, double factor)
{
- Assert(form);
+ BOOST_ASSERT(form);
if (factor <= 1.0)
return;
+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * GraphicsCacheItem.C: change Assert to BOOST_ASSERT
+ * Previews.C: ditto
+
2003-09-08 Angus Leeming <leeming@lyx.org>
* GraphicsImage.C:
2003-09-04 Angus Leeming <leeming@lyx.org>
- * LoaderQueue.C (get):
+ * LoaderQueue.C (get):
2003-09-04 Angus Leeming <leeming@lyx.org>
#include "support/filetools.h"
#include "support/FileMonitor.h"
-#include "support/LAssert.h"
#include "support/lyxlib.h"
#include <boost/bind.hpp>
namespace support = lyx::support;
-using support::Assert;
using support::ChangeExtension;
using support::FileMonitor;
using support::IsFileReadable;
FormatList const formats = lyx::graphics::Image::loadableFormats();
// There must be a format to load from.
- Assert(!formats.empty());
+ BOOST_ASSERT(!formats.empty());
// First ascertain if we can load directly with no conversion
FormatList::const_iterator it = formats.begin();
#include "insets/inset.h"
-#include "support/LAssert.h"
-
-namespace support = lyx::support;
-
namespace lyx {
namespace graphics {
+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * several files: change Assert to BOOST_ASSERT
+
2003-09-09 Martin Vermeer <martin.vermeer@hut.fi>
* insettext.[Ch]: remove drawText[XY]Offset
* insettabular.h: move #include "FuncStatus.h" out of the header file.
* insettoc.[Ch]: move #include "metricsinfo.h" out of the header file.
- * insetcollapsable.h:
- * insetbranch.C:
+ * insetcollapsable.h:
+ * insetbranch.C:
* insetnote.C: move #include "funcrequest.h" out of the header file.
2003-09-03 Angus Leeming <leeming@lyx.org>
#include "lyxlex.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/path.h"
#include "support/path_defines.h"
+#include <boost/assert.hpp>
+
#include <algorithm>
namespace support = lyx::support;
default:
lex.printError("ExternalTemplate::readTemplate: "
"Wrong tag: $$Token");
- support::Assert(false);
+ BOOST_ASSERT(false);
break;
}
}
#include "frontends/font_metrics.h"
#include "frontends/Painter.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/std_sstream.h"
else if (i2->lyxCode() == WRAP_CODE)
type = static_cast<InsetWrap *>(i2)->params().type;
else
- Assert(0);
+ BOOST_ASSERT(false);
FloatList const & floats =
pi.base.bv->buffer()->params().getLyXTextClass().floats();
#include "frontends/Painter.h"
#include "frontends/LyXView.h"
-#include "support/LAssert.h"
-
-using namespace lyx::support;
using namespace lyx::graphics;
using std::endl;
void InsetCollapsable::draw(PainterInfo & pi, int x, int y, bool inlined) const
{
- Assert(pi.base.bv);
+ BOOST_ASSERT(pi.base.bv);
cache(pi.base.bv);
Dimension dim_collapsed;
switch (cmd.action) {
case LFUN_EXTERNAL_EDIT: {
- support::Assert(cmd.view());
+ BOOST_ASSERT(cmd.view());
Buffer const & buffer = *cmd.view()->buffer();
InsetExternal::Params p;
}
case LFUN_INSET_MODIFY: {
- support::Assert(cmd.view());
+ BOOST_ASSERT(cmd.view());
Buffer const & buffer = *cmd.view()->buffer();
InsetExternal::Params p;
// Cannot proceed...
if (!support::copy(from_file, temp_file))
- return;
+ return;
from_file = temp_file;
}
// Yes if to_file does not exist or if from_file is newer than to_file
if (support::compare_timestamps(from_file, abs_to_file) < 0)
return;
-
+
string const to_filebase = support::ChangeExtension(to_file, string());
converters.convert(&buf, from_file, to_filebase, from_format, to_format);
}
#include "frontends/Alert.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
#include "support/lyxalgo.h" // lyx::count
#include "support/lyxlib.h" // float_equal
#include "support/os.h"
{
using support::rtrim;
- support::Assert(AbsolutePath(file_in));
+ BOOST_ASSERT(AbsolutePath(file_in));
string const only_path = support::OnlyPath(file_in);
if (rtrim(support::OnlyPath(file_in) , "/") == rtrim(dir, "/"))
mangled = FileName(file_in).mangledFilename();
string const file_out = support::MakeAbsPath(mangled, dir);
-
+
unsigned long const checksum_in = support::sum(file_in);
unsigned long const checksum_out = support::sum(file_out);
<< "\tunzipped to " << orig_file << endl;
}
}
-
+
string const from = getExtFromContents(orig_file);
string const to = findTargetFormat(from, runparams);
lyxerr[Debug::GRAPHICS]
if (button_.box().contains(cmd.x, cmd.y))
InsetIncludeMailer(*this).showDialog(cmd.view());
return DISPATCHED;
-
+
case LFUN_INSET_DIALOG_SHOW:
InsetIncludeMailer(*this).showDialog(cmd.view());
return DISPATCHED;
}
button_.metrics(mi, dim);
}
- int center_indent = (params_.flag == INPUT ? 0 :
+ int center_indent = (params_.flag == INPUT ? 0 :
(mi.base.textwidth - dim.wid) / 2);
Box b(center_indent, center_indent + dim.wid, -dim.asc, dim.des);
button_.setBox(b);
#include "frontends/font_metrics.h"
#include "frontends/Painter.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
using namespace lyx::support;
{
// How do we get the local language here??
lyx::pos_type curr_pos = ownerPar(buf, this).getPositionOfInset(this);
- Assert(curr_pos != -1);
+ BOOST_ASSERT(curr_pos != -1);
#warning FIXME. We _must_ find another way to get the language. (Lgb)
#if 0
#include "frontends/LyXView.h"
#include "frontends/Painter.h"
-#include "support/LAssert.h"
-
#include "support/std_sstream.h"
using namespace lyx::support;
BufferView * InsetTabular::view() const
{
- Assert(false);
+ BOOST_ASSERT(false);
return 0;
}
// mi.base.textwidth << "\n";
if (!mi.base.bv) {
lyxerr << "InsetTabular::metrics: need bv" << endl;
- Assert(0);
+ BOOST_ASSERT(false);
}
calculate_dimensions_of_cells(mi);
void InsetTabular::drawCellSelection(Painter & pain, int x, int y,
int row, int column, int cell) const
{
- Assert(hasSelection());
+ BOOST_ASSERT(hasSelection());
int cs = tabular.column_of_cell(sel_cell_start);
int ce = tabular.column_of_cell(sel_cell_end);
if (cs > ce) {
WordLangTuple InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
{
// when entering this function the inset should be ALWAYS locked!
- Assert(the_locking_inset);
+ BOOST_ASSERT(the_locking_inset);
WordLangTuple word(the_locking_inset->selectNextWordToSpellcheck(bv, value));
if (!word.word().empty())
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
-#include "support/LAssert.h"
-
-using namespace lyx::support;
-
void MailInset::showDialog(BufferView * bv) const
{
- Assert(bv);
+ BOOST_ASSERT(bv);
bv->owner()->getDialogs().show(name(), inset2string(*bv->buffer()),
&inset());
}
void MailInset::updateDialog(BufferView * bv) const
{
- Assert(bv);
+ BOOST_ASSERT(bv);
if(bv->owner()->getDialogs().visible(name()))
bv->owner()->getDialogs().update(name(),
inset2string(*bv->buffer()));
#include "graphics/GraphicsImage.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
using namespace lyx::support;
void ButtonRenderer::metrics(MetricsInfo & mi, Dimension & dim) const
{
- Assert(mi.base.bv);
+ BOOST_ASSERT(mi.base.bv);
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
void ButtonRenderer::draw(PainterInfo & pi, int x, int y) const
{
- Assert(pi.base.bv);
+ BOOST_ASSERT(pi.base.bv);
view_ = pi.base.bv->owner()->view();
// Draw it as a box with the LaTeX text
params_ = params;
if (!params_.filename.empty()) {
- Assert(AbsolutePath(params_.filename));
+ BOOST_ASSERT(AbsolutePath(params_.filename));
loader_.reset(params_.filename, params_);
}
}
void GraphicRenderer::draw(PainterInfo & pi, int x, int y) const
{
- Assert(pi.base.bv);
+ BOOST_ASSERT(pi.base.bv);
view_ = pi.base.bv->owner()->view();
#if 0
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/forkedcontr.h"
-#include "support/LAssert.h"
#include "support/path.h"
#include "support/path_defines.h"
#include "support/tostr.h"
disable = !inset;
if (!disable) {
code = inset->lyxCode();
- if (!(code == InsetOld::INCLUDE_CODE
- || code == InsetOld::BIBTEX_CODE
- || code == InsetOld::FLOAT_LIST_CODE
+ if (!(code == InsetOld::INCLUDE_CODE
+ || code == InsetOld::BIBTEX_CODE
+ || code == InsetOld::FLOAT_LIST_CODE
|| code == InsetOld::TOC_CODE))
disable = true;
}
FuncRequest cmd(view(), LFUN_INSET_DIALOG_SHOW);
inset->localDispatch(cmd);
}
- }
- break;
-
+ }
+ break;
+
case LFUN_DIALOG_UPDATE: {
string const & name = argument;
// Can only update a dialog connected to an existing inset
BufferView * LyXFunc::view() const
{
- Assert(owner);
+ BOOST_ASSERT(owner);
return owner->view().get();
}
#include "lyxtext.h"
#include "paragraph.h"
-#include "support/LAssert.h"
-
#include <boost/next_prior.hpp>
using lyx::pos_type;
-using lyx::support::Assert;
using std::max;
using std::min;
lyxerr << "broken row 1: end: " << rit->end() << " next: "
<< boost::next(rit)->pos() << endl;
lyxerr << endl;
- Assert(false);
+ BOOST_ASSERT(false);
}
#endif
return boost::next(rit) == par.rows.end();
lyxerr << "broken row 2: end: " << rit->end() << " next: "
<< boost::next(rit)->pos() << endl;
lyxerr << endl;
- Assert(false);
+ BOOST_ASSERT(false);
}
return boost::next(rit)->pos() - 1;
}
#include "FloatList.h"
#include "support/lstrings.h"
-#include "support/LAssert.h"
#include "support/filetools.h"
LyXLayout_ptr const & LyXTextClass::operator[](string const & name) const
{
- Assert(!name.empty());
+ BOOST_ASSERT(!name.empty());
LayoutList::const_iterator cit =
find_if(layoutlist_.begin(),
lyxerr << " " << it->get()->name() << endl;
// we require the name to exist
- Assert(false);
+ BOOST_ASSERT(false);
}
return (*cit);
#include "formulabase.h"
#include "support/std_sstream.h"
-#include "support/LAssert.h"
#include "formula.h"
#include "formulamacro.h"
#include "funcrequest.h"
mathcursor->normalize();
mathcursor->touch();
- Assert(mathcursor);
+ BOOST_ASSERT(mathcursor);
if (mathcursor->selection() || was_selection)
toggleInsetSelection(bv);
#include <config.h>
#include "lyxrc.h"
-#include "support/LAssert.h"
#include "support/limited_stack.h"
#include "debug.h"
#include "support/std_sstream.h"
//#define FILEDEBUG 1
-using namespace lyx::support;
-
using std::endl;
using std::isalpha;
using std::min;
MathAtom const & MathCursor::prevAtom() const
{
- Assert(pos() > 0);
+ BOOST_ASSERT(pos() > 0);
return array()[pos() - 1];
}
MathAtom & MathCursor::prevAtom()
{
- Assert(pos() > 0);
+ BOOST_ASSERT(pos() > 0);
return array()[pos() - 1];
}
MathAtom const & MathCursor::nextAtom() const
{
- Assert(pos() < size());
+ BOOST_ASSERT(pos() < size());
return array()[pos()];
}
MathAtom & MathCursor::nextAtom()
{
- Assert(pos() < size());
+ BOOST_ASSERT(pos() < size());
return array()[pos()];
}
CursorPos & MathCursor::cursor()
{
- Assert(depth());
+ BOOST_ASSERT(depth());
return Cursor_.back();
}
CursorPos const & MathCursor::cursor() const
{
- Assert(depth());
+ BOOST_ASSERT(depth());
return Cursor_.back();
}
Anchor_ = Cursor_;
lyxerr << "unusual Anchor size" << endl;
}
- //lyx::Assert(Anchor_.size() >= cursor.depth());
+ //lyx::BOOST_ASSERT(Anchor_.size() >= cursor.depth());
// use Anchor on the same level as Cursor
CursorPos normal = Anchor_[depth() - 1];
if (depth() < Anchor_.size() && !(normal < cursor())) {
#include "math_support.h"
#include "math_replace.h"
#include "debug.h"
-#include "support/LAssert.h"
#include "frontends/Painter.h"
-using namespace lyx::support;
-
using std::abs;
using std::endl;
using std::min;
MathAtom & MathArray::operator[](pos_type pos)
{
- Assert(pos < size());
+ BOOST_ASSERT(pos < size());
return base_type::operator[](pos);
}
MathAtom const & MathArray::operator[](pos_type pos) const
{
- Assert(pos < size());
+ BOOST_ASSERT(pos < size());
return base_type::operator[](pos);
}
void MathArray::insert(size_type pos, MathArray const & ar)
{
- Assert(pos <= size());
+ BOOST_ASSERT(pos <= size());
base_type::insert(begin() + pos, ar.begin(), ar.end());
}
#include "funcrequest.h"
#include "support/std_sstream.h"
#include "LaTeXFeatures.h"
-#include "support/LAssert.h"
#include "frontends/Alert.h"
#include "lyxrc.h"
string MathHullInset::label(row_type row) const
{
row_type n = nrows();
- Assert(row < n);
+ BOOST_ASSERT(row < n);
return label_[row];
}
void MathHullInset::check() const
{
- Assert(nonum_.size() == nrows());
- Assert(label_.size() == nrows());
+ BOOST_ASSERT(nonum_.size() == nrows());
+ BOOST_ASSERT(label_.size() == nrows());
}
#include "math_iterator.h"
#include "math_inset.h"
-#include "support/LAssert.h"
-using namespace lyx::support;
+#include <boost/assert.hpp>
+
MathIterator::MathIterator()
{}
void MathIterator::pop()
{
//lyxerr << "pop: " << endl;
- Assert(size());
+ BOOST_ASSERT(size());
pop_back();
}
void MathIterator::jump(difference_type i)
{
back().pos_ += i;
- //Assert(back().pos_ >= 0);
- Assert(back().pos_ <= cell().size());
+ //BOOST_ASSERT(back().pos_ >= 0);
+ BOOST_ASSERT(back().pos_ <= cell().size());
}
if (flags & FLAG_BRACE_LAST)
return;
error("found '}' unexpectedly");
- //lyx::Assert(0);
+ //BOOST_ASSERT(false);
//add(cell, '}', LM_TC_TEX);
}
#include "math_pos.h"
#include "math_inset.h"
#include "debug.h"
-#include "support/LAssert.h"
-using namespace lyx::support;
+#include <boost/assert.hpp>
using std::endl;
CursorPos::CursorPos(MathInset * p)
: inset_(p), idx_(0), pos_(0)
{
- Assert(inset_);
+ BOOST_ASSERT(inset_);
}
MathArray & CursorPos::cell(MathArray::idx_type idx) const
{
- Assert(inset_);
+ BOOST_ASSERT(inset_);
return inset_->cell(idx);
}
MathArray & CursorPos::cell() const
{
- Assert(inset_);
+ BOOST_ASSERT(inset_);
return inset_->cell(idx_);
}
#include "math_symbolinset.h"
#include "debug.h"
#include "funcrequest.h"
-#include "support/LAssert.h"
-
-using namespace lyx::support;
using std::max;
using std::auto_ptr;
int MathScriptInset::dx0() const
{
- Assert(hasDown());
+ BOOST_ASSERT(hasDown());
return hasLimits() ? (dim_.wid - down().width()) / 2 : nwid();
}
int MathScriptInset::dx1() const
{
- Assert(hasUp());
+ BOOST_ASSERT(hasUp());
return hasLimits() ? (dim_.wid - up().width()) / 2 : nwid();
}
#include "insets/insetoptarg.h"
#include "support/lstrings.h"
-#include "support/LAssert.h"
#include "support/textutils.h"
-
#include "support/std_sstream.h"
InsetOld * Paragraph::getInset(pos_type pos)
{
- Assert(pos < size());
+ BOOST_ASSERT(pos < size());
return insetlist.get(pos);
}
InsetOld const * Paragraph::getInset(pos_type pos) const
{
- Assert(pos < size());
+ BOOST_ASSERT(pos < size());
return insetlist.get(pos);
}
LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
pos_type pos) const
{
- Assert(pos <= size());
+ BOOST_ASSERT(pos <= size());
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
lyx::pos_type Paragraph::getEndPosOfFontSpan(lyx::pos_type pos) const
{
- Assert(pos <= size());
+ BOOST_ASSERT(pos <= size());
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
LyXFont const & outerfont) const
{
- Assert(pos >= 0);
+ BOOST_ASSERT(pos >= 0);
LyXLayout_ptr const & lout = layout();
void Paragraph::setFont(pos_type pos, LyXFont const & font)
{
- Assert(pos <= size());
+ BOOST_ASSERT(pos <= size());
// First, reduce font against layout/label font
// Update: The SetCharFont() routine in text2.C already
Change::Type Paragraph::lookupChange(lyx::pos_type pos) const
{
- Assert(!size() || pos < size());
+ BOOST_ASSERT(!size() || pos < size());
return pimpl_->lookupChange(pos);
}
Change const Paragraph::lookupChangeFull(lyx::pos_type pos) const
{
- Assert(!size() || pos < size());
+ BOOST_ASSERT(!size() || pos < size());
return pimpl_->lookupChangeFull(pos);
}
#include "insets/insetspecialchar.h"
#include "insets/insettabular.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
-
#include "support/std_sstream.h"
using namespace lyx::support;
return pit.outerPar();
}
lyxerr << "outerPar: should not happen" << endl;
- Assert(false);
+ BOOST_ASSERT(false);
return const_cast<Buffer &>(buf).paragraphs().end(); // shut up compiler
}
return *pit.pit();
}
lyxerr << "ownerPar: should not happen" << endl;
- Assert(false);
+ BOOST_ASSERT(false);
return buf.paragraphs().front(); // shut up compiler
}
#include "lyxrc.h"
#include "texrow.h"
-#include "support/LAssert.h"
-
-using namespace lyx::support;
using lyx::pos_type;
void Paragraph::Pimpl::markErased()
{
- Assert(tracking());
+ BOOST_ASSERT(tracking());
// FIXME: we should actually remove INSERTED chars.
// difficult because owning insettexts/tabulars need
// This is in the critical path for loading!
pos_type const siz = size();
- Assert(pos <= siz);
+ BOOST_ASSERT(pos <= siz);
if (pos == siz) {
lyxerr << "getChar() on pos " << pos << " in par id "
return text[pos];
#else
- Assert(pos < size());
+ BOOST_ASSERT(pos < size());
return text[pos];
#endif
}
void Paragraph::Pimpl::insertChar(pos_type pos, value_type c,
LyXFont const & font, Change change)
{
- Assert(pos <= size());
+ BOOST_ASSERT(pos <= size());
if (tracking()) {
changes_->record(change, pos);
void Paragraph::Pimpl::insertInset(pos_type pos,
InsetOld * inset, LyXFont const & font, Change change)
{
- Assert(inset);
- Assert(pos <= size());
+ BOOST_ASSERT(inset);
+ BOOST_ASSERT(pos <= size());
insertChar(pos, META_INSET, font, change);
- Assert(text[pos] == META_INSET);
+ BOOST_ASSERT(text[pos] == META_INSET);
// Add a new entry in the insetlist.
owner_->insetlist.insert(inset, pos);
bool Paragraph::Pimpl::erase(pos_type pos)
{
- Assert(pos < size());
+ BOOST_ASSERT(pos < size());
if (tracking()) {
Change::Type changetype(changes_->lookup(pos));
#ifdef USE_PSPELL
-#include "support/LAssert.h"
#include "debug.h"
#define USE_ORIGINAL_MANAGER_FUNCS 1
PspellManager * m = it->second.manager;
int word_ok = pspell_manager_check(m, word.word().c_str());
- Assert(word_ok != -1);
+ BOOST_ASSERT(word_ok != -1);
if (word_ok) {
res = OK;
} else {
PspellWordList const * sugs =
pspell_manager_suggest(m, word.word().c_str());
- Assert(sugs != 0);
+ BOOST_ASSERT(sugs != 0);
els = pspell_word_list_elements(sugs);
if (pspell_word_list_empty(sugs))
res = UNKNOWN;
#include "insets/insettext.h"
-#include "support/LAssert.h"
#include "support/textutils.h"
-using namespace lyx::support;
using std::max;
using lyx::pos_type;
{
InsetOld * inset = const_cast<InsetOld*>(pit_->getInset(pos));
- Assert(inset);
+ BOOST_ASSERT(inset);
PainterInfo pi(perv(bv_));
pi.base.font = getFont(pos);
+2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * Makefile.am (libsupport_la_SOURCES): remove LAssert.C and LAssert.h
+
+ * several files: change Assert to BOOST_ASSERT
+
+ * LAssert.C:
+ * LAssert.h: remove files
+
2003-09-08 Angus Leeming <leeming@lyx.org>
- * filename.C:
+ * filename.C:
* filetools.C: tell the world where to find author contact details.
2003-09-08 Angus Leeming <leeming@lyx.org>
2003-09-05 Angus Leeming <leeming@lyx.org>
- * lyxmanip.h:
- * textutils.h:
+ * lyxmanip.h:
+ * textutils.h:
ensure that the header file can be compiled stand-alone.
2003-09-04 Lars Gullik Bjønnes <larsbj@lyx.org>
#include <config.h>
-#include <cerrno>
#include "FileInfo.h"
-#include "LAssert.h"
+
+#include <boost/assert.hpp>
+
+#include <cerrno>
#if !S_IRUSR
# if S_IREAD
// should not be in FileInfo
char FileInfo::typeIndicator() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
if (S_ISDIR(buf_.st_mode))
return '/';
#ifdef S_ISLNK
mode_t FileInfo::getMode() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return buf_.st_mode;
}
// should not be in FileInfo
string FileInfo::modeString() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
char str[11];
str[0] = typeLetter(buf_.st_mode);
flagRWX((buf_.st_mode & 0700) << 0, &str[1]);
time_t FileInfo::getModificationTime() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return buf_.st_mtime;
}
time_t FileInfo::getAccessTime() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return buf_.st_atime;
}
time_t FileInfo::getStatusChangeTime() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return buf_.st_ctime;
}
nlink_t FileInfo::getNumberOfLinks() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return buf_.st_nlink;
}
uid_t FileInfo::getUid() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return buf_.st_uid;
}
gid_t FileInfo::getGid() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return buf_.st_gid;
}
off_t FileInfo::getSize() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return buf_.st_size;
}
bool FileInfo::isLink() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return S_ISLNK(buf_.st_mode);
}
bool FileInfo::isRegular() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return S_ISREG(buf_.st_mode);
}
bool FileInfo::isDir() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return S_ISDIR(buf_.st_mode);
}
bool FileInfo::isChar() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return S_ISCHR(buf_.st_mode);
}
bool FileInfo::isBlock() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return S_ISBLK(buf_.st_mode);
}
bool FileInfo::isFifo() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
return S_ISFIFO(buf_.st_mode);
}
bool FileInfo::isSocket() const
{
- Assert(isOK());
+ BOOST_ASSERT(isOK());
#ifdef S_ISSOCK
return S_ISSOCK(buf_.st_mode);
#else
+++ /dev/null
-/**
- * \file LAssert.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "LAssert.h"
-#include "support/lyxlib.h"
-
-#ifdef ENABLE_ASSERTIONS
-#include "lyx_main.h"
-#include "errorlist.h"
-
-namespace lyx {
-namespace support {
-
-namespace {
-
-void emergencyCleanup()
-{
- static bool didCleanup;
- if (didCleanup)
- return;
-
- didCleanup = true;
-
- LyX::emergencyCleanup();
-}
-
-} // namespace anon
-
-void Assert(bool assertion)
-{
- if (!assertion) {
- emergencyCleanup();
- lyx::support::abort();
- }
-}
-
-} // namespace support
-} // namespace lyx
-
-#endif
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file LAssert.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef LASSERT_H
-#define LASSERT_H
-
-namespace lyx {
-namespace support {
-
-#ifdef ENABLE_ASSERTIONS
-
-/** Live assertion.
- This is a debug tool to ensure that the assertion holds. If it don't hole
- we run #emergencyCleanup()# and then #lyx::abort".
- @param assertion this should evaluate to true unless you want an abort.
-*/
-void Assert(bool assertion);
-
-#else
-
-/** Dummy assertion.
- When compiling without assertions we use this no-op function.
-*/
-inline
-void Assert(bool /*assertion*/) {}
-
-#endif /* ENABLE_ASSERTIONS */
-
-} // namespace support
-} // namespace lyx
-
-#endif /* LASSERT_H */
FileInfo.h \
FileMonitor.h \
FileMonitor.C \
- LAssert.C \
- LAssert.h \
abort.C \
atoi.C \
boost-inst.C \
#include "filename.h"
-#include "LAssert.h"
#include "filetools.h"
#include "lstrings.h"
#include "os.h"
+#include <boost/assert.hpp>
+
namespace lyx {
namespace support {
FileName::FileName(string const & abs_filename, bool save_abs)
: name_(abs_filename), save_abs_path_(save_abs)
{
- Assert(AbsolutePath(name_));
+ BOOST_ASSERT(AbsolutePath(name_));
}
#include "debug.h"
#include "support/tostr.h"
#include "support/systemcall.h"
-#include "support/LAssert.h"
#include "filetools.h"
#include "lstrings.h"
#include "support/std_sstream.h"
+#include <boost/assert.hpp>
#include <boost/cregex.hpp>
+
#include <cctype>
#include <cstdlib>
#include <cstdio>
{
string temp(rtrim(os::slashify_path(path), "/"));
- Assert(!temp.empty());
+ BOOST_ASSERT(!temp.empty());
if (mkdir(temp, permission))
return false;
int compare_timestamps(string const & file1, string const & file2)
{
- Assert(AbsolutePath(file1) && AbsolutePath(file2));
+ BOOST_ASSERT(AbsolutePath(file1) && AbsolutePath(file2));
// If the original is newer than the copy, then copy the original
// to the new directory.
#include "support/std_string.h"
#include "lstrings.h"
-#include "LAssert.h"
#include "support/std_sstream.h"
#include "debug.h"
#include "BoostFormat.h"
string const trim(string const & a, char const * p)
{
- Assert(p);
+ BOOST_ASSERT(p);
if (a.empty() || !*p)
return a;
string const rtrim(string const & a, char const * p)
{
- Assert(p);
+ BOOST_ASSERT(p);
if (a.empty() || !*p)
return a;
string const ltrim(string const & a, char const * p)
{
- Assert(p);
+ BOOST_ASSERT(p);
if (a.empty() || !*p)
return a;
string bformat(string const & fmt, string const & arg1)
{
- Assert(contains(fmt, "%1$s"));
+ BOOST_ASSERT(contains(fmt, "%1$s"));
string const str = subst(fmt, "%1$s", arg1);
return subst(str, "%%", "%");
}
string bformat(string const & fmt, string const & arg1, string const & arg2)
{
- Assert(contains(fmt, "%1$s"));
- Assert(contains(fmt, "%2$s"));
+ BOOST_ASSERT(contains(fmt, "%1$s"));
+ BOOST_ASSERT(contains(fmt, "%2$s"));
string str = subst(fmt, "%1$s", arg1);
str = subst(str, "%2$s", arg2);
return subst(str, "%%", "%");
string bformat(string const & fmt, int arg1, int arg2)
{
- Assert(contains(fmt, "%1$d"));
- Assert(contains(fmt, "%2$d"));
+ BOOST_ASSERT(contains(fmt, "%1$d"));
+ BOOST_ASSERT(contains(fmt, "%2$d"));
string str = subst(fmt, "%1$d", tostr(arg1));
str = subst(str, "%2$d", tostr(arg2));
return subst(str, "%%", "%");
string bformat(string const & fmt, string const & arg1, string const & arg2,
string const & arg3)
{
- Assert(contains(fmt, "%1$s"));
- Assert(contains(fmt, "%2$s"));
- Assert(contains(fmt, "%3$s"));
+ BOOST_ASSERT(contains(fmt, "%1$s"));
+ BOOST_ASSERT(contains(fmt, "%2$s"));
+ BOOST_ASSERT(contains(fmt, "%3$s"));
string str = subst(fmt, "%1$s", arg1);
str = subst(str, "%2$s", arg2);
str = subst(str, "%3$s", arg3);
string bformat(string const & fmt, string const & arg1, string const & arg2,
string const & arg3, string const & arg4)
{
- Assert(contains(fmt, "%1$s"));
- Assert(contains(fmt, "%2$s"));
- Assert(contains(fmt, "%3$s"));
- Assert(contains(fmt, "%4$s"));
+ BOOST_ASSERT(contains(fmt, "%1$s"));
+ BOOST_ASSERT(contains(fmt, "%2$s"));
+ BOOST_ASSERT(contains(fmt, "%3$s"));
+ BOOST_ASSERT(contains(fmt, "%4$s"));
string str = subst(fmt, "%1$s", arg1);
str = subst(str, "%2$s", arg2);
str = subst(str, "%3$s", arg3);
string bformat(string const & fmt, string const & arg1, string const & arg2,
string const & arg3, string const & arg4, string const & arg5)
{
- Assert(contains(fmt, "%1$s"));
- Assert(contains(fmt, "%2$s"));
- Assert(contains(fmt, "%3$s"));
- Assert(contains(fmt, "%4$s"));
- Assert(contains(fmt, "%5$s"));
+ BOOST_ASSERT(contains(fmt, "%1$s"));
+ BOOST_ASSERT(contains(fmt, "%2$s"));
+ BOOST_ASSERT(contains(fmt, "%3$s"));
+ BOOST_ASSERT(contains(fmt, "%4$s"));
+ BOOST_ASSERT(contains(fmt, "%5$s"));
string str = subst(fmt, "%1$s", arg1);
str = subst(str, "%2$s", arg2);
str = subst(str, "%3$s", arg3);
#include "lyxstring.h"
-#include "LAssert.h"
-
#include "debug.h"
#include <iostream>
namespace lyx {
-using support::Assert;
+using support::BOOST_ASSERT;
///////////////////////////////////////
// The internal string representation
// test every last little thing we *know* should be true.
// I may have missed a test or two, so feel free to fill
// in the gaps. ARRae.
- Assert(object);
- Assert(object->rep);
- Assert(object->rep->s); // s is never 0
- Assert(object->rep->res); // res cannot be 0
- Assert(object->rep->sz <= object->rep->res);
- Assert(object->rep->ref >= 1); // its in use so it must be referenced
- Assert(object->rep->ref < 1UL << (8UL * sizeof(object->rep->ref) - 1));
+ BOOST_ASSERT(object);
+ BOOST_ASSERT(object->rep);
+ BOOST_ASSERT(object->rep->s); // s is never 0
+ BOOST_ASSERT(object->rep->res); // res cannot be 0
+ BOOST_ASSERT(object->rep->sz <= object->rep->res);
+ BOOST_ASSERT(object->rep->ref >= 1); // its in use so it must be referenced
+ BOOST_ASSERT(object->rep->ref < 1UL << (8UL * sizeof(object->rep->ref) - 1));
// if it does ever == then we should be generating a new copy
// and starting again. (Is char always 8-bits?)
}
string::string(string const & x, size_type pos, size_type n)
{
- Assert(pos <= x.rep->sz); // STD!
+ BOOST_ASSERT(pos <= x.rep->sz); // STD!
if (pos == 0 && n >= x.length()) { // this is the default
x.rep->ref++;
rep = x.rep;
string::string(value_type const * s, size_type n)
{
- Assert(s && n < npos); // STD!
+ BOOST_ASSERT(s && n < npos); // STD!
static Srep empty_rep(0, "");
if (n) { // n > 0
rep = new Srep(n, s);
string::string(value_type const * s)
{
- Assert(s); // STD!
+ BOOST_ASSERT(s); // STD!
static Srep empty_rep(0, "");
if (*s) { // s is not empty string
rep = new Srep(strlen(s), s);
string::string(size_type n, value_type c)
{
- Assert(n < npos); // STD!
+ BOOST_ASSERT(n < npos); // STD!
rep = new Srep(n, c);
}
void string::resize(size_type n, value_type c)
{
- Assert(n <= npos); // STD!
+ BOOST_ASSERT(n <= npos); // STD!
TeststringInvariant(this);
// This resets sz to res_arg
string & string::operator=(value_type const * s)
{
- Assert(s); // OURS!
+ BOOST_ASSERT(s); // OURS!
TeststringInvariant(this);
// printf("string::operator= (value_type const *)\n");
string & string::assign(string const & x, size_type pos, size_type n)
{
- Assert(pos <= x.rep->sz); // STD!
+ BOOST_ASSERT(pos <= x.rep->sz); // STD!
TeststringInvariant(this);
return assign(x.substr(pos, n));
string & string::assign(value_type const * s, size_type n)
{
- Assert(s && n < npos); // STD!
+ BOOST_ASSERT(s && n < npos); // STD!
TeststringInvariant(this);
if (rep->ref == 1) // recycle rep
string & string::assign(value_type const * s)
{
- Assert(s); // OURS!
+ BOOST_ASSERT(s); // OURS!
TeststringInvariant(this);
return assign(s, strlen(s));
{
#if 0
// This is actually what the standard requires,
- Assert(pos <= rep->sz); // OURS!
+ BOOST_ASSERT(pos <= rep->sz); // OURS!
static char const helper = '\0';
return pos == rep->sz ? helper : rep->s[pos];
#else
// but we use this one since it is stricter
// and more according to the real intent of std::string.
- Assert(pos < rep->sz); // OURS!
+ BOOST_ASSERT(pos < rep->sz); // OURS!
return rep->s[pos];
#endif
}
string::reference string::operator[](size_type pos)
{
- Assert(pos < rep->sz); // OURS!
+ BOOST_ASSERT(pos < rep->sz); // OURS!
TeststringInvariant(this);
rep = rep->get_own_copy();
string::const_reference string::at(size_type n) const
{
- Assert(n < rep->sz); // STD!
+ BOOST_ASSERT(n < rep->sz); // STD!
return rep->s[n];
}
string::reference string::at(size_type n)
{
- Assert(n < rep->sz); // STD!
+ BOOST_ASSERT(n < rep->sz); // STD!
TeststringInvariant(this);
rep = rep->get_own_copy();
string & string::operator+=(value_type const * x)
{
- Assert(x); // OURS!
+ BOOST_ASSERT(x); // OURS!
TeststringInvariant(this);
return append(x);
string & string::append(string const & x, size_type pos, size_type n)
{
- Assert(pos <= x.rep->sz); // STD!
+ BOOST_ASSERT(pos <= x.rep->sz); // STD!
TeststringInvariant(this);
return append(x.substr(pos, n));
string & string::append(value_type const * p, size_type n)
{
- Assert(p); // OURS!
+ BOOST_ASSERT(p); // OURS!
TeststringInvariant(this);
if (!*p || !n) return *this;
string & string::append(value_type const * p)
{
- Assert(p); // OURS!
+ BOOST_ASSERT(p); // OURS!
return append(p, strlen(p));
}
string & string::insert(size_type pos, string const & x,
size_type pos2, size_type n)
{
- Assert(pos <= rep->sz && pos2 <= x.rep->sz); // STD!
+ BOOST_ASSERT(pos <= rep->sz && pos2 <= x.rep->sz); // STD!
TeststringInvariant(this);
rep = rep->get_own_copy();
string & string::insert(size_type pos, value_type const * p, size_type n)
{
- Assert(p); // OURS!
+ BOOST_ASSERT(p); // OURS!
TeststringInvariant(this);
if (*p && n) {
string & string::insert(size_type pos, value_type const * p)
{
- Assert(p); // OURS!
+ BOOST_ASSERT(p); // OURS!
return insert(pos, p, strlen(p));
}
string::size_type string::find(value_type const * ptr, size_type i,
size_type n) const
{
- Assert(ptr); // OURS!
+ BOOST_ASSERT(ptr); // OURS!
if (!rep->sz || !*ptr || i >= rep->sz) return npos;
TeststringInvariant(this);
string::size_type string::find(value_type const * s, size_type i) const
{
- Assert(s); // OURS!
+ BOOST_ASSERT(s); // OURS!
if (!rep->sz || i >= rep->sz) return npos;
TeststringInvariant(this);
string::size_type string::rfind(value_type const * ptr, size_type i,
size_type n) const
{
- Assert(ptr); // OURS!
+ BOOST_ASSERT(ptr); // OURS!
TeststringInvariant(this);
n = min(n, strlen(ptr));
string::size_type string::rfind(value_type const * ptr,
size_type i) const
{
- Assert(ptr); // OURS!
+ BOOST_ASSERT(ptr); // OURS!
if (!ptr || !*ptr) return npos;
return rfind(ptr, i, strlen(ptr));
string::size_type string::find_first_of(string const & a,
size_type i) const
{
- Assert(i <= rep->sz); // OURS!
+ BOOST_ASSERT(i <= rep->sz); // OURS!
TeststringInvariant(this);
for (size_type t = i; t < rep->sz; ++t) {
size_type i,
size_type n) const
{
- Assert(ptr && i <= rep->sz); // OURS!
+ BOOST_ASSERT(ptr && i <= rep->sz); // OURS!
TeststringInvariant(this);
if (!n) return npos;
string::size_type string::find_first_of(value_type const * ptr,
size_type i) const
{
- Assert(ptr && i <= rep->sz); // OURS!
+ BOOST_ASSERT(ptr && i <= rep->sz); // OURS!
TeststringInvariant(this);
for (size_type t = i; t < rep->sz; ++t) {
string::size_type string::find_first_of(value_type c, size_type i) const
{
- Assert(i <= rep->sz); // OURS!
+ BOOST_ASSERT(i <= rep->sz); // OURS!
TeststringInvariant(this);
for (size_type t = i; t < rep->sz; ++t) {
size_type i,
size_type n) const
{
- Assert(ptr); // OURS!
+ BOOST_ASSERT(ptr); // OURS!
TeststringInvariant(this);
if (!n) return npos;
string::size_type string::find_last_of(value_type const * ptr,
size_type i) const
{
- Assert(ptr); // OURS!
+ BOOST_ASSERT(ptr); // OURS!
TeststringInvariant(this);
size_type ii = min(rep->sz - 1, i);
TeststringInvariant(this);
if (!rep->sz) return npos;
- Assert(i <= rep->sz);
+ BOOST_ASSERT(i <= rep->sz);
for (size_type t = i; t < rep->sz; ++t) {
if (a.find(rep->s[t]) == npos) return t;
}
size_type i,
size_type n) const
{
- Assert(ptr && i <= rep->sz); // OURS!
+ BOOST_ASSERT(ptr && i <= rep->sz); // OURS!
TeststringInvariant(this);
if (!n) return (i < rep->sz) ? i : npos;
string::size_type string::find_first_not_of(value_type const * ptr,
size_type i) const
{
- Assert(ptr && i <= rep->sz); // OURS!
+ BOOST_ASSERT(ptr && i <= rep->sz); // OURS!
TeststringInvariant(this);
for (size_type t = i; t < rep->sz; ++t) {
size_type i) const
{
if (!rep->sz) return npos;
- Assert(i <= rep->sz); // OURS!
+ BOOST_ASSERT(i <= rep->sz); // OURS!
TeststringInvariant(this);
for (size_type t = i; t < rep->sz; ++t) {
size_type i,
size_type n) const
{
- Assert(ptr); // OURS!
+ BOOST_ASSERT(ptr); // OURS!
TeststringInvariant(this);
if (!n) return npos;
string::size_type string::find_last_not_of(value_type const * ptr,
size_type i) const
{
- Assert(ptr); // OURS!
+ BOOST_ASSERT(ptr); // OURS!
TeststringInvariant(this);
size_type ii = min(rep->sz - 1, i);
string & string::replace(size_type i, size_type n, string const & x)
{
- Assert(i <= rep->sz); // OURS!
+ BOOST_ASSERT(i <= rep->sz); // OURS!
TeststringInvariant(this);
return replace(i, n, x, 0, x.rep->sz);
string & string::replace(size_type i, size_type n, string const & x,
size_type i2, size_type n2)
{
- Assert(i <= rep->sz && i2 <= x.rep->sz); // STD!
+ BOOST_ASSERT(i <= rep->sz && i2 <= x.rep->sz); // STD!
TeststringInvariant(this);
rep = rep->get_own_copy();
string & string::replace(size_type i, size_type n,
value_type const * p, size_type n2)
{
- Assert(p && i <= rep->sz); // OURS!
+ BOOST_ASSERT(p && i <= rep->sz); // OURS!
TeststringInvariant(this);
rep = rep->get_own_copy();
string & string::replace(size_type i, size_type n, value_type const * p)
{
- Assert(p && i <= rep->sz); // OURS!
+ BOOST_ASSERT(p && i <= rep->sz); // OURS!
TeststringInvariant(this);
return replace(i, min(n, rep->sz), p, (!p) ? 0 : strlen(p));
string & string::replace(size_type i, size_type n,
size_type n2, value_type c)
{
- Assert(i <= rep->sz); // OURS!
+ BOOST_ASSERT(i <= rep->sz); // OURS!
TeststringInvariant(this);
rep = rep->get_own_copy();
string & string::replace(iterator i, iterator i2,
value_type const * p, size_type n)
{
- Assert(p); // OURS!
+ BOOST_ASSERT(p); // OURS!
TeststringInvariant(this);
return replace(i - begin(), i2 - i, p, n);
string & string::replace(iterator i, iterator i2, value_type const * p)
{
- Assert(p); // OURS!
+ BOOST_ASSERT(p); // OURS!
TeststringInvariant(this);
return replace(i - begin(), i2 - i, p);
string & string::erase(size_type i, size_type n)
{
- Assert(i <= rep->sz); // STD!
+ BOOST_ASSERT(i <= rep->sz); // STD!
TeststringInvariant(this);
rep = rep->get_own_copy();
string::size_type string::copy(value_type * buf, size_type len,
size_type pos) const
{
- Assert(buf); // OURS!
- Assert(pos <= rep->sz); // STD!
+ BOOST_ASSERT(buf); // OURS!
+ BOOST_ASSERT(pos <= rep->sz); // STD!
TeststringInvariant(this);
register int nn = min(len, length() - pos);
int string::compare(value_type const * s) const
{
- Assert(s); //OURS!
+ BOOST_ASSERT(s); //OURS!
TeststringInvariant(this);
int n = (!s) ? 0 : strlen(s);
return internal_compare(0, rep->sz, s, n, n);
int string::compare(size_type pos, size_type n,
string const & str) const
{
- Assert(pos <= rep->sz); // OURS!
+ BOOST_ASSERT(pos <= rep->sz); // OURS!
TeststringInvariant(this);
return internal_compare(pos, n, str.rep->s, str.rep->sz, str.rep->sz);
}
int string::compare(size_type pos, size_type n, string const & str,
size_type pos2, size_type n2) const
{
- Assert(pos <= rep->sz); // OURS!
- Assert(pos2 <= str.rep->sz); // OURS!
+ BOOST_ASSERT(pos <= rep->sz); // OURS!
+ BOOST_ASSERT(pos2 <= str.rep->sz); // OURS!
TeststringInvariant(this);
return internal_compare(pos, n,
str.rep->s + pos2,
int string::compare(size_type pos, size_type n, value_type const * s,
size_type n2) const
{
- Assert(s && pos <= rep->sz); // OURS!
+ BOOST_ASSERT(s && pos <= rep->sz); // OURS!
TeststringInvariant(this);
return internal_compare(pos, n, s, (!s) ? 0 : strlen(s), n2);
}
// i = index, n = length
string string::substr(size_type i, size_type n) const
{
- Assert(i <= rep->sz); // STD!
+ BOOST_ASSERT(i <= rep->sz); // STD!
TeststringInvariant(this);
return string(*this, i, n);
bool operator==(string::value_type const * a, string const & b)
{
- Assert(a); // OURS!
+ BOOST_ASSERT(a); // OURS!
return b.compare(a) == 0;
}
bool operator==(string const & a, string::value_type const * b)
{
- Assert(b); // OURS!
+ BOOST_ASSERT(b); // OURS!
return a.compare(b) == 0;
}
bool operator!=(string::value_type const * a, string const & b)
{
- Assert(a); // OURS!
+ BOOST_ASSERT(a); // OURS!
return b.compare(a) != 0;
}
bool operator!=(string const & a, string::value_type const * b)
{
- Assert(b); // OURS!
+ BOOST_ASSERT(b); // OURS!
return a.compare(b) != 0;
}
bool operator>(string::value_type const * a, string const & b)
{
- Assert(a); // OURS!
+ BOOST_ASSERT(a); // OURS!
return b.compare(a) < 0; // since we reverse the parameters
}
bool operator>(string const & a, string::value_type const * b)
{
- Assert(b); // OURS!
+ BOOST_ASSERT(b); // OURS!
return a.compare(b) > 0;
}
bool operator<(string::value_type const * a, string const & b)
{
- Assert(a); // OURS!
+ BOOST_ASSERT(a); // OURS!
return b.compare(a) > 0; // since we reverse the parameters
}
bool operator<(string const & a, string::value_type const * b)
{
- Assert(b); // OURS!
+ BOOST_ASSERT(b); // OURS!
return a.compare(b) < 0;
}
bool operator>=(string::value_type const * a, string const & b)
{
- Assert(a); // OURS!
+ BOOST_ASSERT(a); // OURS!
return b.compare(a) <= 0; // since we reverse the parameters
}
bool operator>=(string const & a, string::value_type const * b)
{
- Assert(b); // OURS!
+ BOOST_ASSERT(b); // OURS!
return a.compare(b) >= 0;
}
bool operator<=(string::value_type const * a, string const & b)
{
- Assert(a); // OURS!
+ BOOST_ASSERT(a); // OURS!
return b.compare(a) >= 0; // since we reverse the parameters
}
bool operator<=(string const & a, string::value_type const * b)
{
- Assert(b); // OURS!
+ BOOST_ASSERT(b); // OURS!
return a.compare(b) <= 0;
}
string operator+(string::value_type const * a, string const & b)
{
- Assert(a); // OURS!
+ BOOST_ASSERT(a); // OURS!
string tmp(a);
tmp += b;
return tmp;
string operator+(string const & a, string::value_type const * b)
{
- Assert(b); // OURS!
+ BOOST_ASSERT(b); // OURS!
string tmp(a);
tmp += b;
return tmp;
#include <algorithm>
#include <functional>
-#include "support/LAssert.h"
#include "support/lyxfunctional.h"
/**
* This class template is used to translate between two elements, specifically
/// Find the mapping for the first argument
T2 const & find(T1 const & first) const {
- lyx::support::Assert(!map.empty());
+ BOOST_ASSERT(!map.empty());
// For explanation see the next find() function.
typename Map::const_iterator it =
/// Find the mapping for the second argument
T1 const & find(T2 const & second) const {
- lyx::support::Assert(!map.empty());
+ BOOST_ASSERT(!map.empty());
// The idea is as follows:
// find_if() will try to compare the data in the vector with
#include <config.h>
#include "userinfo.h"
-#include "LAssert.h"
#include "filetools.h"
+#include <boost/assert.hpp>
+
#include <pwd.h>
#include <unistd.h>
#include <sys/types.h>
string const user_name()
{
struct passwd * pw(getpwuid(geteuid()));
- Assert(pw);
+ BOOST_ASSERT(pw);
string name = pw->pw_gecos;
if (name.empty())
#include "insets/insettabular.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/tostr.h"
l_getline(is, line);
if (!prefixIs(line, "<lyxtabular ")
&& !prefixIs(line, "<LyXTabular ")) {
- Assert(false);
+ BOOST_ASSERT(false);
return;
}
int version;
if (!getTokenValue(line, "version", version))
return;
- Assert(version >= 2);
+ BOOST_ASSERT(version >= 2);
int rows_arg;
if (!getTokenValue(line, "rows", rows_arg))
int LyXTabular::getCellNumber(int row, int column) const
{
- Assert(column >= 0 || column < columns_ || row >= 0 || row < rows_);
+ BOOST_ASSERT(column >= 0 || column < columns_ || row >= 0 || row < rows_);
return cell_info[row][column].cellno;
}
string const trim(string const & a, char const * p)
{
- // lyx::Assert(p);
+ // BOOST_ASSERT(p);
if (a.empty() || !*p)
return a;
#include "insets/insettext.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/textutils.h"
BufferView * LyXText::bv()
{
- Assert(bv_owner != 0);
+ BOOST_ASSERT(bv_owner != 0);
return bv_owner;
}
BufferView * LyXText::bv() const
{
- Assert(bv_owner != 0);
+ BOOST_ASSERT(bv_owner != 0);
return bv_owner;
}
{
if (pos >= pit->size()) {
lyxerr << "in singleWidth(), pos: " << pos << endl;
- Assert(false);
+ BOOST_ASSERT(false);
return 0;
}
if (c == Paragraph::META_INSET) {
InsetOld * tmpinset = pit->getInset(pos);
- Assert(tmpinset);
+ BOOST_ASSERT(tmpinset);
if (tmpinset->lyxCode() == InsetOld::HFILL_CODE) {
// Because of the representation as vertical lines
return 3;
{
pos_type last = pit->beginningOfBody();
- Assert(last > 0);
+ BOOST_ASSERT(last > 0);
// -1 because a label ends either with a space that is in the label,
// or with the beginning of a footnote that is outside the label.
if (rit != pit->rows.begin())
--rit;
else {
- Assert(pit != ownerParagraphs().begin());
+ BOOST_ASSERT(pit != ownerParagraphs().begin());
--pit;
rit = boost::prior(pit->rows.end());
}
#include "insets/insetfloat.h"
#include "insets/insetwrap.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/textutils.h"
// smaller. (Asger)
LyXFont LyXText::getFont(ParagraphList::iterator pit, pos_type pos) const
{
- Assert(pos >= 0);
+ BOOST_ASSERT(pos >= 0);
LyXLayout_ptr const & layout = pit->layout();
#warning broken?
{
//lyxerr << "LyXText::metrics: width: " << mi.base.textwidth
// << " workWidth: " << workWidth() << endl;
- //Assert(mi.base.textwidth);
+ //BOOST_ASSERT(mi.base.textwidth);
// rebuild row cache
width = 0;
else if (in->lyxCode() == InsetOld::WRAP_CODE)
type = static_cast<InsetWrap*>(in)->params().type;
else
- Assert(0);
+ BOOST_ASSERT(false);
Floating const & fl = textclass.floats().getType(type);
void LyXText::setCursor(LyXCursor & cur, ParagraphList::iterator pit,
pos_type pos, bool boundary)
{
- Assert(pit != ownerParagraphs().end());
+ BOOST_ASSERT(pit != ownerParagraphs().end());
cur.par(pit);
cur.pos(pos);
#include "insets/insetspecialchar.h"
#include "insets/insettext.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/tostr.h"
return 0;
// get inset dimensions
- Assert(par->getInset(pos));
+ BOOST_ASSERT(par->getInset(pos));
LyXFont const & font = text.getFont(par, pos);
}
case LFUN_INSET_SETTINGS:
- Assert(bv->theLockingInset());
+ BOOST_ASSERT(bv->theLockingInset());
bv->theLockingInset()->getLockingInset()->showInsetDialog(bv);
break;