#include "support/gettext.h"
#include "support/lstrings.h"
-#include <boost/assert.hpp>
+#include "support/lassert.h"
using namespace std;
using namespace lyx::support;
case TOC_CODE:
return InsetTOC::findInfo(cmdName);
default:
- BOOST_ASSERT(false);
+ LASSERT(false, /**/);
}
static const ParamInfo pi;
return pi; // to silence the warning
ParamInfo::ParamData const &
ParamInfo::operator[](std::string const & name) const
{
- BOOST_ASSERT(hasParam(name));
+ LASSERT(hasParam(name), /**/);
const_iterator it = begin();
const_iterator last = end();
for (; it != last; ++it) {
case TOC_CODE:
return InsetTOC::defaultCommand();
default:
- BOOST_ASSERT(false);
+ LASSERT(false, /**/);
}
return string(); // silence the warning
}
case TOC_CODE:
return InsetTOC::isCompatibleCommand(s);
default:
- BOOST_ASSERT(false);
+ LASSERT(false, /**/);
}
return false; // silence the warning
}
void InsetCommandParams::read(Lexer & lex)
{
- if (lex.isOK()) {
- lex.next();
- string const insetType = lex.getString();
- InsetCode const code = insetCode(insetType);
- if (code != insetCode_) {
- lex.printError("InsetCommandParams: Attempt to change type of inset.");
- throw ExceptionMessage(WarningException, _("InsetCommandParams Error: "),
- _("Attempt to change type of parameters."));
- }
- }
-
- if (lex.isOK()) {
- lex.next();
- string const test = lex.getString();
- if (test != "LatexCommand") {
- lex.printError("InsetCommandParams: No LatexCommand line found.");
- throw ExceptionMessage(WarningException, _("InsetCommandParams error: "),
- _("Can't find LatexCommand line."));
- }
- }
- lex.next();
- cmdName_ = lex.getString();
- if (!isCompatibleCommand(insetCode_, cmdName_)){
- lex.printError("InsetCommandParams: Incompatible command name " + cmdName_ + ".");
+ lex.setContext("InsetCommandParams::read");
+ lex >> insetName(insetCode_).c_str();
+ lex >> "LatexCommand";
+ lex >> cmdName_;
+ if (!isCompatibleCommand(insetCode_, cmdName_)) {
+ lex.printError("Incompatible command name " + cmdName_ + ".");
throw ExceptionMessage(WarningException, _("InsetCommandParams Error: "),
_("Incompatible command name."));
}
bool InsetCommandParams::writeEmptyOptional(ParamInfo::const_iterator ci) const
{
if (!ci->isOptional())
- BOOST_ASSERT(false);
+ LASSERT(false, /**/);
++ci; // we want to start with the next one
ParamInfo::const_iterator end = info_.end();
for (; ci != end; ++ci) {
find_if(info_.begin(), info_.end(),
not1(mem_fun_ref(&ParamInfo::ParamData::isOptional)));
if (it == info_.end())
- BOOST_ASSERT(false);
+ LASSERT(false, return docstring());
return (*this)[it->name()];
}
docstring const & InsetCommandParams::operator[](string const & name) const
{
static const docstring dummy; //so we don't return a ref to temporary
- BOOST_ASSERT(info_.hasParam(name));
+ LASSERT(info_.hasParam(name), return dummy);
ParamMap::const_iterator data = params_.find(name);
if (data == params_.end() || data->second.empty())
return dummy;
docstring & InsetCommandParams::operator[](string const & name)
{
- BOOST_ASSERT(info_.hasParam(name));
+ LASSERT(info_.hasParam(name), /**/);
return params_[name];
}