Also add FormatList::empty().
29 files changed:
vector<docstring>::const_iterator it = pieces.begin();
vector<docstring>::const_iterator en = pieces.end();
for (; it != en; ++it) {
vector<docstring>::const_iterator it = pieces.begin();
vector<docstring>::const_iterator en = pieces.end();
for (; it != en; ++it) {
continue;
char_type const c = (*it)[0];
if (isLower(c))
continue;
char_type const c = (*it)[0];
if (isLower(c))
bool scanning_cmd = false;
bool scanning_math = false;
bool escaped = false; // used to catch \$, etc.
bool scanning_cmd = false;
bool scanning_math = false;
bool escaped = false; // used to catch \$, etc.
char_type const ch = val[0];
// if we're scanning math, we output everything until we
char_type const ch = val[0];
// if we're scanning math, we output everything until we
fmt = fmt.substr(2);
// we'll remove characters from the front of fmt as we
// deal with them
fmt = fmt.substr(2);
// we'll remove characters from the front of fmt as we
// deal with them
if (fmt[0] == ']' && fmt.size() > 1 && fmt[1] == ']') {
// that's the end
fmt = fmt.substr(2);
if (fmt[0] == ']' && fmt.size() > 1 && fmt[1] == ']') {
// that's the end
fmt = fmt.substr(2);
string fmt = format;
// we'll remove characters from the front of fmt as we
// deal with them
string fmt = format;
// we'll remove characters from the front of fmt as we
// deal with them
if (counter++ > max_passes) {
LYXERR0("Recursion limit reached while parsing `"
<< format << "'.");
if (counter++ > max_passes) {
LYXERR0("Recursion limit reached while parsing `"
<< format << "'.");
clearNewWordPosition();
else {
FontSpan nw = locateWord(WHOLE_WORD);
clearNewWordPosition();
else {
FontSpan nw = locateWord(WHOLE_WORD);
FontSpan ow = new_word_.locateWord(WHOLE_WORD);
if (nw.intersect(ow).empty())
clearNewWordPosition();
FontSpan ow = new_word_.locateWord(WHOLE_WORD);
if (nw.intersect(ow).empty())
clearNewWordPosition();
// we have to resolve the macro here manually and check its arity
// to put the selection behind it if arity > 0.
MacroData const * data = buffer()->getMacro(atomAsMacro->name());
// we have to resolve the macro here manually and check its arity
// to put the selection behind it if arity > 0.
MacroData const * data = buffer()->getMacro(atomAsMacro->name());
- if (selection.size() > 0 && data && data->numargs() - data->optionals() > 0) {
+ if (!selection.empty() && data && data->numargs() - data->optionals() > 0) {
macroArg = true;
atomAsMacro->setDisplayMode(MathMacro::DISPLAY_INTERACTIVE_INIT, 1);
} else
macroArg = true;
atomAsMacro->setDisplayMode(MathMacro::DISPLAY_INTERACTIVE_INIT, 1);
} else
///
const_iterator end() const { return formatlist.end(); }
///
///
const_iterator end() const { return formatlist.end(); }
///
+ bool empty() const { return formatlist.empty(); }
+ ///
FormatList::size_type size() const { return formatlist.size(); }
private:
///
FormatList::size_type size() const { return formatlist.size(); }
private:
///
- // empty sequence?
- if (sequence.size() == 0)
return 0;
// everything is fine
return 0;
// everything is fine
wl = WordLangTuple(word, lang);
wl = WordLangTuple(word, lang);
return result;
if (needsSpellCheck() || check_learned) {
return result;
if (needsSpellCheck() || check_learned) {
void Paragraph::spellCheck() const
{
SpellChecker * speller = theSpellChecker();
void Paragraph::spellCheck() const
{
SpellChecker * speller = theSpellChecker();
- if (!speller || !size() ||!needsSpellCheck())
+ if (!speller || empty() ||!needsSpellCheck())
return;
pos_type start;
pos_type endpos;
return;
pos_type start;
pos_type endpos;
int n(vector<docstring> const & arg)
{
int n(vector<docstring> const & arg)
{
cerr << "lyxclient: The option -n requires 1 argument."
<< endl;
return -1;
cerr << "lyxclient: The option -n requires 1 argument."
<< endl;
return -1;
int c(vector<docstring> const & arg)
{
int c(vector<docstring> const & arg)
{
cerr << "lyxclient: The option -c requires 1 argument."
<< endl;
return -1;
cerr << "lyxclient: The option -c requires 1 argument."
<< endl;
return -1;
int a(vector<docstring> const & arg)
{
int a(vector<docstring> const & arg)
{
cerr << "lyxclient: The option -a requires 1 argument."
<< endl;
return -1;
cerr << "lyxclient: The option -a requires 1 argument."
<< endl;
return -1;
int t(vector<docstring> const & arg)
{
int t(vector<docstring> const & arg)
{
cerr << "lyxclient: The option -t requires 1 argument."
<< endl;
return -1;
cerr << "lyxclient: The option -t requires 1 argument."
<< endl;
return -1;
int p(vector<docstring> const & arg)
{
int p(vector<docstring> const & arg)
{
cerr << "lyxclient: The option -p requires 1 argument."
<< endl;
return -1;
cerr << "lyxclient: The option -p requires 1 argument."
<< endl;
return -1;
void PrefConverters::updateButtons()
{
void PrefConverters::updateButtons()
{
- if (form_->formats().size() == 0)
+ if (form_->formats().empty())
return;
Format const & from = form_->formats().get(converterFromCO->currentIndex());
Format const & to = form_->formats().get(converterToCO->currentIndex());
return;
Format const & from = form_->formats().get(converterFromCO->currentIndex());
Format const & to = form_->formats().get(converterToCO->currentIndex());
void PrefFileformats::on_formatsCB_currentIndexChanged(int i)
{
void PrefFileformats::on_formatsCB_currentIndexChanged(int i)
{
- if (form_->formats().size() == 0)
+ if (form_->formats().empty())
return;
int const nr = formatsCB->itemData(i).toInt();
Format const f = form_->formats().get(nr);
return;
int const nr = formatsCB->itemData(i).toInt();
Format const f = form_->formats().get(nr);
// Get the keys bound to this action, but keep only the
// first one later
KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(item.func_);
// Get the keys bound to this action, but keep only the
// first one later
KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(item.func_);
text += " [" + toqstr(bindings.begin()->print(KeySequence::ForGui)) + "]";
Action * act = new Action(&owner_, getIcon(item.func_, false),
text += " [" + toqstr(bindings.begin()->print(KeySequence::ForGui)) + "]";
Action * act = new Action(&owner_, getIcon(item.func_, false),
// Get the keys bound to this action, but keep only the
// first one later
KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(func_);
// Get the keys bound to this action, but keep only the
// first one later
KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(func_);
return toqstr(bindings.begin()->print(KeySequence::ForGui));
LYXERR(Debug::KBMAP, "No binding for "
return toqstr(bindings.begin()->print(KeySequence::ForGui));
LYXERR(Debug::KBMAP, "No binding for "
if (cit == end)
LYXERR(Debug::GUI, "No table of contents.");
else {
if (cit == end)
LYXERR(Debug::GUI, "No table of contents.");
else {
- if (cit->second.size() > 0 )
+ if (!cit->second.empty())
expandToc2(cit->second, 0, cit->second.size(), 0);
else
add(MenuItem(MenuItem::Info, qt_("<Empty Table of Contents>")));
expandToc2(cit->second, 0, cit->second.size(), 0);
else
add(MenuItem(MenuItem::Info, qt_("<Empty Table of Contents>")));
void Menu::Impl::populate(QMenu & qMenu, MenuDefinition const & menu)
{
LYXERR(Debug::GUI, "populating menu " << menu.name());
void Menu::Impl::populate(QMenu & qMenu, MenuDefinition const & menu)
{
LYXERR(Debug::GUI, "populating menu " << menu.name());
- if (menu.size() == 0) {
LYXERR(Debug::GUI, "\tERROR: empty menu " << menu.name());
return;
}
LYXERR(Debug::GUI, "\tERROR: empty menu " << menu.name());
return;
}
{LFUN_LYX_QUIT, "", "Quit LyX", QAction::QuitRole}
};
const size_t num_entries = sizeof(entries) / sizeof(entries[0]);
{LFUN_LYX_QUIT, "", "Quit LyX", QAction::QuitRole}
};
const size_t num_entries = sizeof(entries) / sizeof(entries[0]);
- const bool first_call = mac_special_menu_.size() == 0;
+ const bool first_call = mac_special_menu_.empty();
// the special menu for Menus. Fill it up only once.
if (first_call) {
// the special menu for Menus. Fill it up only once.
if (first_call) {
LYXERR(Debug::GUI, "populating menu bar" << d->menubar_.name());
LYXERR(Debug::GUI, "populating menu bar" << d->menubar_.name());
- if (d->menubar_.size() == 0) {
+ if (d->menubar_.empty()) {
LYXERR(Debug::GUI, "\tERROR: empty menu bar"
<< d->menubar_.name());
return;
LYXERR(Debug::GUI, "\tERROR: empty menu bar"
<< d->menubar_.name());
return;
MenuDefinition cat_menu = d->getMenu(toqstr(menu_name));
//FIXME: 50 is a wild guess. We should take into account here
//the expansion of menu items, disabled optional items etc.
MenuDefinition cat_menu = d->getMenu(toqstr(menu_name));
//FIXME: 50 is a wild guess. We should take into account here
//the expansion of menu items, disabled optional items etc.
- bool const in_sub_menu = fromLyxMenu.size() > 0
+ bool const in_sub_menu = !fromLyxMenu.empty()
&& fromLyxMenu.size() + cat_menu.size() > 50 ;
if (in_sub_menu)
fromLyxMenu.catSub(menu_name);
&& fromLyxMenu.size() + cat_menu.size() > 50 ;
if (in_sub_menu)
fromLyxMenu.catSub(menu_name);
LYXERR(Debug::GRAPHICS, "LoaderQueue: "
<< cache_queue_.size() << " items in the queue");
int counter = s_numimages_;
LYXERR(Debug::GRAPHICS, "LoaderQueue: "
<< cache_queue_.size() << " items in the queue");
int counter = s_numimages_;
- while (cache_queue_.size() && counter--) {
+ while (!cache_queue_.empty() && counter--) {
Cache::ItemPtr ptr = cache_queue_.front();
cache_set_.erase(ptr);
cache_queue_.pop_front();
Cache::ItemPtr ptr = cache_queue_.front();
cache_set_.erase(ptr);
cache_queue_.pop_front();
else
t = lyx::to_utf8(s);
// Remove \n at begin
else
t = lyx::to_utf8(s);
// Remove \n at begin
- while (t.size() > 0 && t[0] == '\n')
+ while (!t.empty() && t[0] == '\n')
t = t.substr(1);
// Remove \n at end
t = t.substr(1);
// Remove \n at end
- while (t.size() > 0 && t[t.size() - 1] == '\n')
+ while (!t.empty() && t[t.size() - 1] == '\n')
t = t.substr(0, t.size() - 1);
size_t pos;
// Replace all other \n with spaces
t = t.substr(0, t.size() - 1);
size_t pos;
// Replace all other \n with spaces
ModeSpecifier specifier(os, currentMode(), lockedMode(), asciiOnly());
MathEnsurer ensurer(os, needs_math_mode_);
os << '\\' << name_;
ModeSpecifier specifier(os, currentMode(), lockedMode(), asciiOnly());
MathEnsurer ensurer(os, needs_math_mode_);
os << '\\' << name_;
os << '[' << cell(1) << ']';
os << '{' << cell(0) << '}';
}
os << '[' << cell(1) << ']';
os << '{' << cell(0) << '}';
}
{
ModeSpecifier specifier(os, TEXT_MODE);
os << (framebox_ ? "\\framebox" : "\\makebox");
{
ModeSpecifier specifier(os, TEXT_MODE);
os << (framebox_ ? "\\framebox" : "\\makebox");
- if (cell(0).size() || !os.latex()) {
+ if (!cell(0).empty() || !os.latex()) {
os << '[' << cell(0) << ']';
os << '[' << cell(0) << ']';
- if (cell(1).size() || !os.latex())
+ if (!cell(1).empty() || !os.latex())
os << '[' << cell(1) << ']';
}
os << '{' << cell(2) << '}';
os << '[' << cell(1) << ']';
}
os << '{' << cell(2) << '}';
void InsetMathExInt::maple(MapleStream & os) const
{
os << symbol_ << '(';
void InsetMathExInt::maple(MapleStream & os) const
{
os << symbol_ << '(';
os << cell(0);
else
os << '1';
os << cell(0);
else
os << '1';
else
os << symbol_ << '(';
else
os << symbol_ << '(';
os << cell(0) << ',';
else
os << '1' << ',';
os << cell(0) << ',';
else
os << '1' << ',';
else
os << symbol_ << '[';
else
os << symbol_ << '[';
os << cell(0) << ',';
else
os << '1' << ',';
os << cell(0) << ',';
else
os << '1' << ',';
// make sure an upcoming '[' does not break anything
if (row + 1 < nrows()) {
MathData const & c = cell(index(row + 1, 0));
// make sure an upcoming '[' does not break anything
if (row + 1 < nrows()) {
MathData const & c = cell(index(row + 1, 0));
- if (c.size() && c.front()->getChar() == '[')
+ if (!c.empty() && c.front()->getChar() == '[')
//eol += "[0pt]";
eol += "{}";
}
//eol += "[0pt]";
eol += "{}";
}
// try to delete entire sequence of ncols() empty cells if possible
for (idx_type i = idx; i < idx + ncols(); ++i)
// try to delete entire sequence of ncols() empty cells if possible
for (idx_type i = idx; i < idx + ncols(); ++i)
return false;
// move cells if necessary
return false;
// move cells if necessary
InsetMathGrid::addCol(2);
for (row_type row = 0; row < nrows(); ++row) {
idx_type const i = 3 * row + 1;
InsetMathGrid::addCol(2);
for (row_type row = 0; row < nrows(); ++row) {
idx_type const i = 3 * row + 1;
+ if (!cell(i).empty()) {
cell(i + 1) = MathData(buffer_, cell(i).begin() + 1, cell(i).end());
cell(i).erase(1, cell(i).size());
}
cell(i + 1) = MathData(buffer_, cell(i).begin() + 1, cell(i).end());
cell(i).erase(1, cell(i).size());
}
MathData ar;
if (cur.inMathed() && cur.selection()) {
asArray(grabAndEraseSelection(cur), ar);
MathData ar;
if (cur.inMathed() && cur.selection()) {
asArray(grabAndEraseSelection(cur), ar);
- } else if (pos == cur.cell().size()) {
+ } else if (!pos == cur.cell().empty()) {
ar = cur.cell();
lyxerr << "use whole cell: " << ar << endl;
} else {
ar = cur.cell();
lyxerr << "use whole cell: " << ar << endl;
} else {
{
int dasc = 0;
int slevel = 0;
{
int dasc = 0;
int slevel = 0;
- bool isCharBox = nuc().size() ? isAlphaSymbol(nuc().back()) : false;
+ bool isCharBox = !nuc().empty() ? isAlphaSymbol(nuc().back()) : false;
if (hasDown()) {
Dimension const & dimdown = down().dimension(bv);
dasc = dimdown.ascent();
if (hasDown()) {
Dimension const & dimdown = down().dimension(bv);
dasc = dimdown.ascent();
int InsetMathScript::nwid(BufferView const & bv) const
{
int InsetMathScript::nwid(BufferView const & bv) const
{
- return nuc().size() ? nuc().dimension(bv).width() : 2;
+ return !nuc().empty() ? nuc().dimension(bv).width() : 2;
}
int InsetMathScript::nasc(BufferView const & bv) const
{
}
int InsetMathScript::nasc(BufferView const & bv) const
{
- return nuc().size() ? nuc().dimension(bv).ascent() : 5;
+ return !nuc().empty() ? nuc().dimension(bv).ascent() : 5;
}
int InsetMathScript::ndes(BufferView const & bv) const
{
}
int InsetMathScript::ndes(BufferView const & bv) const
{
- return nuc().size() ? nuc().dimension(bv).descent() : 0;
+ return !nuc().empty() ? nuc().dimension(bv).descent() : 0;
}
int InsetMathScript::nker(BufferView const * bv) const
{
}
int InsetMathScript::nker(BufferView const * bv) const
{
int kerning = nuc().kerning(bv);
return kerning > 0 ? kerning : 0;
}
int kerning = nuc().kerning(bv);
return kerning > 0 ? kerning : 0;
}
void InsetMathScript::draw(PainterInfo & pi, int x, int y) const
{
BufferView & bv = *pi.base.bv;
void InsetMathScript::draw(PainterInfo & pi, int x, int y) const
{
BufferView & bv = *pi.base.bv;
nuc().draw(pi, x + dxx(bv), y);
else {
nuc().setXY(bv, x + dxx(bv), y);
nuc().draw(pi, x + dxx(bv), y);
else {
nuc().setXY(bv, x + dxx(bv), y);
void InsetMathScript::drawT(TextPainter & pain, int x, int y) const
{
// FIXME: BROKEN
void InsetMathScript::drawT(TextPainter & pain, int x, int y) const
{
// FIXME: BROKEN
nuc().drawT(pain, x + 1, y);
if (hasUp())
up().drawT(pain, x + 1, y - 1 /*dy1()*/);
nuc().drawT(pain, x + 1, y);
if (hasUp())
up().drawT(pain, x + 1, y - 1 /*dy1()*/);
return false;
// we can only display limits if the nucleus wants some
return false;
// we can only display limits if the nucleus wants some
return false;
if (!nuc().back()->isScriptable())
return false;
return false;
if (!nuc().back()->isScriptable())
return false;
{
MathEnsurer ensurer(os);
{
MathEnsurer ensurer(os);
os << nuc();
//if (nuc().back()->takesLimits()) {
if (limits_ == -1)
os << nuc();
//if (nuc().back()->takesLimits()) {
if (limits_ == -1)
- if (hasDown() /*&& down().size()*/)
+ if (hasDown() /*&& !down().empty()*/)
os << "_{" << down() << '}';
os << "_{" << down() << '}';
- if (hasUp() /*&& up().size()*/) {
+ if (hasUp() /*&& !up().empty()*/) {
// insert space if up() is empty or an empty brace inset
// (see bug 8305)
// insert space if up() is empty or an empty brace inset
// (see bug 8305)
- if (os.latex() && (up().size() == 0 ||
+ if (os.latex() && (up().empty() ||
(up().size() == 1 && up().back()->asBraceInset() &&
up().back()->asBraceInset()->cell(0).empty())))
os << "^ {}";
(up().size() == 1 && up().back()->asBraceInset() &&
up().back()->asBraceInset()->cell(0).empty())))
os << "^ {}";
void InsetMathScript::normalize(NormalStream & os) const
{
void InsetMathScript::normalize(NormalStream & os) const
{
- bool d = hasDown() && down().size();
- bool u = hasUp() && up().size();
+ bool d = hasDown() && !down().empty();
+ bool u = hasUp() && !up().empty();
if (u && d)
os << "[subsup ";
if (u && d)
os << "[subsup ";
else if (d)
os << "[sub ";
else if (d)
os << "[sub ";
os << nuc() << ' ';
else
os << "[par]";
os << nuc() << ' ';
else
os << "[par]";
void InsetMathScript::maple(MapleStream & os) const
{
void InsetMathScript::maple(MapleStream & os) const
{
- if (hasDown() && down().size())
+ if (hasDown() && !down().empty())
os << '[' << down() << ']';
os << '[' << down() << ']';
- if (hasUp() && up().size())
+ if (hasUp() && !up().empty())
os << "^(" << up() << ')';
}
void InsetMathScript::mathematica(MathematicaStream & os) const
{
os << "^(" << up() << ')';
}
void InsetMathScript::mathematica(MathematicaStream & os) const
{
- bool d = hasDown() && down().size();
- bool u = hasUp() && up().size();
+ bool d = hasDown() && !down().empty();
+ bool u = hasUp() && !up().empty();
if (d)
os << "Subscript[" << nuc();
else
if (d)
os << "Subscript[" << nuc();
else
if (u)
os << "^(" << up() << ')';
if (u)
os << "^(" << up() << ')';
if (d)
os << ',' << down() << ']';
}
if (d)
os << ',' << down() << ']';
}
// need to know if we're in a display formula.
void InsetMathScript::mathmlize(MathStream & os) const
{
// need to know if we're in a display formula.
void InsetMathScript::mathmlize(MathStream & os) const
{
- bool d = hasDown() && down().size();
- bool u = hasUp() && up().size();
+ bool d = hasDown() && !down().empty();
+ bool u = hasUp() && !up().empty();
if (u && d)
os << MTag("msubsup");
if (u && d)
os << MTag("msubsup");
else if (d)
os << MTag("msub");
else if (d)
os << MTag("msub");
os << MTag("mrow") << nuc() << ETag("mrow");
else
os << "<mrow />";
os << MTag("mrow") << nuc() << ETag("mrow");
else
os << "<mrow />";
void InsetMathScript::htmlize(HtmlStream & os) const
{
void InsetMathScript::htmlize(HtmlStream & os) const
{
- bool d = hasDown() && down().size();
- bool u = hasUp() && up().size();
+ bool d = hasDown() && !down().empty();
+ bool u = hasUp() && !up().empty();
void InsetMathScript::octave(OctaveStream & os) const
{
void InsetMathScript::octave(OctaveStream & os) const
{
- if (hasDown() && down().size())
+ if (hasDown() && !down().empty())
os << '[' << down() << ']';
os << '[' << down() << ']';
- if (hasUp() && up().size())
+ if (hasUp() && !up().empty())
os << "^(" << up() << ')';
}
os << "^(" << up() << ')';
}
{
MathEnsurer ensurer(os);
os << '\\' << name_;
{
MathEnsurer ensurer(os);
os << '\\' << name_;
os << '[' << cell(1) << ']';
os << '{' << cell(0) << '}';
}
os << '[' << cell(1) << ']';
os << '{' << cell(0) << '}';
}
{
MathEnsurer ensurer(os);
os << "\\ar";
{
MathEnsurer ensurer(os);
os << "\\ar";
os << '[' << cell(0) << ']';
os << '[' << cell(0) << ']';
os << (up_ ? '^' : '_') << '{' << cell(1) << '}';
os << " ";
}
os << (up_ ? '^' : '_') << '{' << cell(1) << '}';
os << " ";
}
string line;
ifstream is(file.toFilesystemEncoding().c_str());
while (getline(is, line)) {
string line;
ifstream is(file.toFilesystemEncoding().c_str());
while (getline(is, line)) {
- if (line.size() == 0 || line[0] == '#') {
+ if (line.empty() || line[0] == '#') {
//LYXERR(Debug::MATHED, "ignoring line '" << line << '\'');
continue;
}
//LYXERR(Debug::MATHED, "ignoring line '" << line << '\'');
continue;
}
docstring s1 = completion.substr(0, uniqueTo);
docstring s2 = completion.substr(uniqueTo);
docstring s1 = completion.substr(0, uniqueTo);
docstring s2 = completion.substr(uniqueTo);
f.setColor(Color_inlinecompletion);
pi.pain.text(x, y, s1, f);
x += mathed_string_width(f, s1);
}
f.setColor(Color_inlinecompletion);
pi.pain.text(x, y, s1, f);
x += mathed_string_width(f, s1);
}
f.setColor(Color_nonunique_inlinecompletion);
pi.pain.text(x, y, s2, f);
x += mathed_string_width(f, s2);
f.setColor(Color_nonunique_inlinecompletion);
pi.pain.text(x, y, s2, f);
x += mathed_string_width(f, s2);
continue;
// we must have a nucleus if we only have a superscript
continue;
// we must have a nucleus if we only have a superscript
- if (!script->hasDown() && script->nuc().size() == 0)
+ if (!script->hasDown() && script->nuc().empty())
continue;
if (script->nuc().size() == 1) {
continue;
if (script->nuc().size() == 1) {
return
testIntSymbol(at) ||
( at->asScriptInset()
return
testIntSymbol(at) ||
( at->asScriptInset()
- && at->asScriptInset()->nuc().size()
+ && !at->asScriptInset()->nuc().empty()
&& testIntSymbol(at->asScriptInset()->nuc().back()) );
}
&& testIntSymbol(at->asScriptInset()->nuc().back()) );
}
return
testSumSymbol(at) ||
( at->asScriptInset()
return
testSumSymbol(at) ||
( at->asScriptInset()
- && at->asScriptInset()->nuc().size()
+ && !at->asScriptInset()->nuc().empty()
&& testSumSymbol(at->asScriptInset()->nuc().back()) );
}
&& testSumSymbol(at->asScriptInset()->nuc().back()) );
}
bool testDiffArray(MathData const & ar)
{
bool testDiffArray(MathData const & ar)
{
- return ar.size() && testDiffItem(ar.front());
+ return !ar.empty() && testDiffItem(ar.front());
{
MathData ar = dat;
extractStructure(ar, MATHML);
{
MathData ar = dat;
extractStructure(ar, MATHML);
os << "<mrow/>";
else if (ar.size() == 1)
os << ar.front();
os << "<mrow/>";
else if (ar.size() == 1)
os << ar.front();
{
MathData ar = dat;
extractStructure(ar, HTML);
{
MathData ar = dat;
extractStructure(ar, HTML);
return;
if (ar.size() == 1) {
os << ar.front();
return;
if (ar.size() == 1) {
os << ar.front();
void MathMacro::drawSelection(PainterInfo & pi, int x, int y) const
{
// We may have 0 arguments, but InsetMathNest requires at least one.
void MathMacro::drawSelection(PainterInfo & pi, int x, int y) const
{
// We may have 0 arguments, but InsetMathNest requires at least one.
InsetMathNest::drawSelection(pi, x, y);
}
InsetMathNest::drawSelection(pi, x, y);
}
- // empty name?
- if (n.size() == 0)
return false;
// converting back and force doesn't swallow anything?
return false;
// converting back and force doesn't swallow anything?
commitEditChanges(cur, cur);
cur.recordUndoFullDocument();
size_t pos = numargs_;
commitEditChanges(cur, cur);
cur.recordUndoFullDocument();
size_t pos = numargs_;
pos = (size_t)convert<int>(arg) - 1; // it is checked for >=0 in getStatus
insertParameter(cur, cur, pos);
}
pos = (size_t)convert<int>(arg) - 1; // it is checked for >=0 in getStatus
insertParameter(cur, cur, pos);
}
commitEditChanges(cur, cur);
cur.recordUndoFullDocument();
size_t pos = numargs_ - 1;
commitEditChanges(cur, cur);
cur.recordUndoFullDocument();
size_t pos = numargs_ - 1;
pos = (size_t)convert<int>(arg) - 1; // it is checked for >=0 in getStatus
removeParameter(cur, cur, pos);
}
pos = (size_t)convert<int>(arg) - 1; // it is checked for >=0 in getStatus
removeParameter(cur, cur, pos);
}
switch (cmd.action()) {
case LFUN_MATH_MACRO_ADD_PARAM: {
int num = numargs_ + 1;
switch (cmd.action()) {
case LFUN_MATH_MACRO_ADD_PARAM: {
int num = numargs_ + 1;
num = convert<int>(arg);
bool on = (num >= optionals_
&& numargs_ < 9 && num <= numargs_ + 1);
num = convert<int>(arg);
bool on = (num >= optionals_
&& numargs_ < 9 && num <= numargs_ + 1);
case LFUN_MATH_MACRO_REMOVE_GREEDY_PARAM:
case LFUN_MATH_MACRO_REMOVE_PARAM: {
int num = numargs_;
case LFUN_MATH_MACRO_REMOVE_GREEDY_PARAM:
case LFUN_MATH_MACRO_REMOVE_PARAM: {
int num = numargs_;
num = convert<int>(arg);
flag.setEnabled(num >= 1 && num <= numargs_);
break;
num = convert<int>(arg);
flag.setEnabled(num >= 1 && num <= numargs_);
break;
- // empty name?
- if (n.size() == 0)
return false;
// converting back and force doesn't swallow anything?
return false;
// converting back and force doesn't swallow anything?
}
// now it should be valid if anything in the name survived
}
// now it should be valid if anything in the name survived
- return data.size() > 0;
///
char_type character() const { return char_; }
///
///
char_type character() const { return char_; }
///
- docstring asString() const { return cs_.size() ? cs_ : docstring(1, char_); }
+ docstring asString() const { return !cs_.empty() ? cs_ : docstring(1, char_); }
- docstring asInput() const { return cs_.size() ? '\\' + cs_ : docstring(1, char_); }
+ docstring asInput() const { return !cs_.empty() ? '\\' + cs_ : docstring(1, char_); }
ostream & operator<<(ostream & os, Token const & t)
{
ostream & operator<<(ostream & os, Token const & t)
{
docstring const & cs = t.cs();
// FIXME: For some strange reason, the stream operator instanciate
// a new Token before outputting the contents of t.cs().
docstring const & cs = t.cs();
// FIXME: For some strange reason, the stream operator instanciate
// a new Token before outputting the contents of t.cs().
bool up = (t.cat() == catSuper);
// we need no new script inset if the last thing was a scriptinset,
// which has that script already not the same script already
bool up = (t.cat() == catSuper);
// we need no new script inset if the last thing was a scriptinset,
// which has that script already not the same script already
cell->push_back(MathAtom(new InsetMathScript(buf, up)));
else if (cell->back()->asScriptInset() &&
!cell->back()->asScriptInset()->has(up))
cell->push_back(MathAtom(new InsetMathScript(buf, up)));
else if (cell->back()->asScriptInset() &&
!cell->back()->asScriptInset()->has(up))
//
else if (t.cs() == "lyxlock") {
//
else if (t.cs() == "lyxlock") {
cell->back().nucleus()->lock(true);
}
cell->back().nucleus()->lock(true);
}
else if (t.cs() == "sqrt") {
MathData ar;
parse(ar, FLAG_OPTION, mode);
else if (t.cs() == "sqrt") {
MathData ar;
parse(ar, FLAG_OPTION, mode);
cell->push_back(MathAtom(new InsetMathRoot(buf)));
cell->back().nucleus()->cell(0) = ar;
parse(cell->back().nucleus()->cell(1), FLAG_ITEM, mode);
cell->push_back(MathAtom(new InsetMathRoot(buf)));
cell->back().nucleus()->cell(0) = ar;
parse(cell->back().nucleus()->cell(1), FLAG_ITEM, mode);
// Allowed formats \unit[val]{unit}
MathData ar;
parse(ar, FLAG_OPTION, mode);
// Allowed formats \unit[val]{unit}
MathData ar;
parse(ar, FLAG_OPTION, mode);
cell->push_back(MathAtom(new InsetMathFrac(buf, InsetMathFrac::UNIT)));
cell->back().nucleus()->cell(0) = ar;
parse(cell->back().nucleus()->cell(1), FLAG_ITEM, mode);
cell->push_back(MathAtom(new InsetMathFrac(buf, InsetMathFrac::UNIT)));
cell->back().nucleus()->cell(0) = ar;
parse(cell->back().nucleus()->cell(1), FLAG_ITEM, mode);
// Here allowed formats are \unitfrac[val]{num}{denom}
MathData ar;
parse(ar, FLAG_OPTION, mode);
// Here allowed formats are \unitfrac[val]{num}{denom}
MathData ar;
parse(ar, FLAG_OPTION, mode);
cell->push_back(MathAtom(new InsetMathFrac(buf, InsetMathFrac::UNITFRAC, 3)));
cell->back().nucleus()->cell(2) = ar;
} else {
cell->push_back(MathAtom(new InsetMathFrac(buf, InsetMathFrac::UNITFRAC, 3)));
cell->back().nucleus()->cell(2) = ar;
} else {
rem.clear();
} else
cmd.clear();
rem.clear();
} else
cmd.clear();
+ } while (!cmd.empty());
- else if (t.cs().size()) {
+ else if (!t.cs().empty()) {
bool const no_mhchem =
(t.cs() == "ce" || t.cs() == "cf")
&& buf && buf->params().use_package("mhchem") ==
bool const no_mhchem =
(t.cs() == "ce" || t.cs() == "cf")
&& buf && buf->params().use_package("mhchem") ==
// this fails on \bigg[...\bigg]
//MathData opt;
//parse(opt, FLAG_OPTION, InsetMath::VERBATIM_MODE);
// this fails on \bigg[...\bigg]
//MathData opt;
//parse(opt, FLAG_OPTION, InsetMath::VERBATIM_MODE);
// start = 1;
// at.nucleus()->cell(0) = opt;
//}
// start = 1;
// at.nucleus()->cell(0) = opt;
//}
f.setColor(c1);
pi_.pain.text(int(x_), yo_, s1, f);
x_ += theFontMetrics(font).width(s1);
}
f.setColor(c1);
pi_.pain.text(int(x_), yo_, s1, f);
x_ += theFontMetrics(font).width(s1);
}
f.setColor(c2);
pi_.pain.text(int(x_), yo_, s2, f);
x_ += theFontMetrics(font).width(s2);
f.setColor(c2);
pi_.pain.text(int(x_), yo_, s2, f);
x_ += theFontMetrics(font).width(s2);
if (s.empty())
return string();
QByteArray const local = toqstr(s).toLocal8Bit();
if (s.empty())
return string();
QByteArray const local = toqstr(s).toLocal8Bit();
throw to_local8bit_failure();
return string(local.begin(), local.end());
}
throw to_local8bit_failure();
return string(local.begin(), local.end());
}
clear();
key_less = other.key_comp();
clear();
key_less = other.key_comp();
{
stats.leaves = stats.innernodes = 0;
root = copy_recursive(other.root);
{
stats.leaves = stats.innernodes = 0;
root = copy_recursive(other.root);
stats( other.stats ),
key_less( other.key_comp() )
{
stats( other.stats ),
key_less( other.key_comp() )
{
{
stats.leaves = stats.innernodes = 0;
root = copy_recursive(other.root);
{
stats.leaves = stats.innernodes = 0;
root = copy_recursive(other.root);
/*
string s = t.asInput();
string z = p.verbatim_item();
/*
string s = t.asInput();
string z = p.verbatim_item();
- while (p.good() && z != " " && z.size()) {
+ while (p.good() && z != " " && !z.empty()) {
//cerr << "read: " << z << endl;
s += z;
z = p.verbatim_item();
//cerr << "read: " << z << endl;
s += z;
z = p.verbatim_item();