+2002-07-29 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * many files: strip,frontStrip -> trim,ltrim,rtrim
+
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
* PrinterParams.h: remove extern containsOnly, and include
regex reg4("\\\\@input\\{([^}]+)\\}");
while (getline(ifs, token)) {
- token = strip(token, "\r");
+ token = rtrim(token, "\r");
smatch sub;
if (regex_match(token, sub, reg1)) {
string data = sub[1];
string foundfile;
string token;
getline(ifs, token);
- token = strip(token, "\r");
+ token = rtrim(token, "\r");
if (token.empty()) continue;
smatch sub;
// Returns an action tag from a string.
int LyXAction::LookupFunc(string const & func) const
{
- string const func2 = frontStrip(strip(func));
+ string const func2 = trim(func);
if (func2.empty()) return LFUN_NOACTION;
// split action and arg
params.footskip = lex.getString();
} else if (token == "\\paperfontsize") {
lex.nextToken();
- params.fontsize = strip(lex.getString());
+ params.fontsize = rtrim(lex.getString());
} else if (token == "\\papercolumns") {
lex.nextToken();
params.columns = lex.getInteger();
}
} else if (token == "\\paperpagestyle") {
lex.nextToken();
- params.pagestyle = strip(lex.getString());
+ params.pagestyle = rtrim(lex.getString());
} else if (token == "\\bullet") {
lex.nextToken();
int const index = lex.getInteger();
params.tocdepth = lex.getInteger();
} else if (token == "\\spacing") {
lex.next();
- string const tmp = strip(lex.getString());
+ string const tmp = rtrim(lex.getString());
Spacing::Space tmp_space = Spacing::Default;
float tmp_val = 0.0;
if (tmp == "single") {
}
} else if (token == "\\paragraph_spacing") {
lex.next();
- string const tmp = strip(lex.getString());
+ string const tmp = rtrim(lex.getString());
if (tmp == "single") {
par->params().spacing(Spacing(Spacing::Single));
} else if (tmp == "onehalf") {
string strOptions(options.str().c_str());
if (!strOptions.empty()) {
- strOptions = strip(strOptions, ",");
+ strOptions = rtrim(strOptions, ",");
os << '[' << strOptions << ']';
}
{
// Split command string into command and argument
string cmd;
- string line = frontStrip(command);
- string const arg = strip(frontStrip(split(line, cmd, ' ')));
+ string line = ltrim(command);
+ string const arg = trim(split(line, cmd, ' '));
return dispatch(lyxaction.LookupFunc(cmd), arg, result);
}
// then the the preamble
if (!preamble.empty()) {
// remove '\n' from the end of preamble
- string const tmppreamble = strip(preamble, "\n");
+ string const tmppreamble = rtrim(preamble, "\n");
os << "\\begin_preamble\n"
<< tmppreamble
<< "\n\\end_preamble\n";
+2002-07-29 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * several files: strip,frontStrip -> trim,ltrim,rtrim
+
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
* biblio.C (parseBibTeX): modify because of strip changes
void ControlSendto::setCommand(string const & cmd)
{
- command_ = strip(frontStrip(cmd));
+ command_ = trim(cmd);
}
// "F. Surname"
string::size_type idx = fname.find(",");
if (idx != string::npos)
- return frontStrip(fname.substr(0,idx));
+ return ltrim(fname.substr(0, idx));
idx = fname.rfind(".");
if (idx != string::npos)
- fname = frontStrip(fname.substr(idx+1));
+ fname = ltrim(fname.substr(idx + 1));
// test if we have a LaTeX Space in front
if (fname[0] == '\\')
return fname.substr(2);
return string();
}
- string const opt =
- strip(frontStrip(it->second.substr(0, pos-1)));
+ string const opt = trim(it->second.substr(0, pos - 1));
if (opt.empty())
return string();
for (vector<string>::iterator it = authors.begin();
it != authors.end(); ++it) {
- *it = familyName(strip(*it));
+ *it = familyName(rtrim(*it));
}
author = authors[0];
}
string const opt =
- strip(frontStrip(it->second.substr(0, pos-1)));
+ trim(it->second.substr(0, pos - 1));
if (opt.empty())
return string();
string::size_type const pos = it->second.find(separator);
if (pos != string::npos) {
string::size_type const pos2 = pos + separator.size();
- string const info = strip(frontStrip(it->second.substr(pos2)));
+ string const info = trim(it->second.substr(pos2));
return info;
}
if (!year.empty())
result << ", " << year;
- string const result_str = strip(result.str().c_str());
+ string const result_str = rtrim(result.str().c_str());
if (!result_str.empty())
return result_str;
if (start < keys.begin() || start >= keys.end())
return keys.end();
- string search_expr = frontStrip(strip(expr));
+ string search_expr = trim(expr);
if (search_expr.empty())
return keys.end();
string dummy = token(data,'\n', Entries);
while (!dummy.empty()) {
dummy = subst(dummy, '\t', ' '); // no tabs
- dummy = frontStrip(dummy); // no leading spaces
+ dummy = ltrim(dummy); // no leading spaces
// ignore lines with a beginning '%' or ignore all right of %
string::size_type const idx =
dummy.empty() ? string::npos : dummy.find('%');
// Clean-up.
// 1. Spaces
- data = strip(data);
+ data = rtrim(data);
// 2. if there is no opening '{' then a closing '{' is probably cruft.
if (!contains(data, '{'))
- data = strip(data, "}");
+ data = rtrim(data, "}");
// happens, when last keyword
string::size_type const idx =
!data.empty() ? data.find('=') : string::npos;
if (idx == string::npos)
return string();
- data = data.substr(idx);
- data = frontStrip(strip(data));
+ data = trim(data.substr(idx));
if (data.length() < 2 || data[0] != '=') { // a valid entry?
return string();
} else {
// delete '=' and the following spaces
- data = frontStrip(frontStrip(data, "="));
+ data = ltrim(data, " =");
if (data.length() < 2) {
return data; // not long enough to find delimiters
} else {
} else {
// no {} and no "", pure data but with a
// possible ',' at the end
- return strip(data, ",");
+ return rtrim(data, ",");
}
string tmp = data.substr(keypos);
while (tmp.find('{') != string::npos &&
+2002-07-29 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * several file: strip,frontStrip -> trim,ltrim,rtrim
+
2002-07-25 John Levon <levon@movementarian.org>
* Toolbar_pimpl.C: fix tooltips
-
+
2002-07-25 John Levon <levon@movementarian.org>
* QCommandEdit.C:
* Toolbar_pimpl.C: make Tab work in the content pane
-
+
2002-07-25 John Levon <levon@movementarian.org>
* Menubar_pimpl.C: split create/fill of menus into
two functions
-
+
2002-07-25 John Levon <moz@compsoc.man.ac.uk>
* Menubar_pimpl.C: make it compile again
-
+
2002-07-24 John Levon <moz@compsoc.man.ac.uk>
* Menubar_pimpl.C: make it compile again
-
+
2002-07-24 Angus Leeming <leeming@lyx.org>
* FileDialog_private.C (done): add a false to the arguments passed to
* ui/QCitationDialog.ui: layout fix
* ui/QExternalDialog.ui: idem
* TODO: update
-
+
2002-07-23 John Levon <moz@compsoc.man.ac.uk>
* QCommandBuffer.C: real compile fix
-
+
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* QLyXKeySym.C: return 0 when text_ is empty
- for getISOEncoded()
+ for getISOEncoded()
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* QtView.C:
* Toolbar_pimpl.h:
* Toolbar_pimpl.C: remove dead code
-
+
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.C: add exit() so we don't busy loop !
-
+
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* QCommandEdit.C: complete if right at end of line
-
+
* QLyXKeySym.C: cleanup comments
-
+
* QtView.C: prefer const int
-
+
* qlkey.h: fix some transliteration errors...
-
+
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* Toolbar_pimpl.h:
* Toolbar_pimpl.C: remove ->push()
-
+
2002-07-22 Edwin Leuven <leuven@fee.uva.nl>
* QCitationDialog.C: fix loop search and info update after selecting
* ui/QBibtexDialog.ui: style browser
* QBibtex.C: idem
* QBibtexDialog.C: idem
-
+
* ui/QRefDialog.ui: document combo
* QRef.C: idem
-
+
* QInclude.C: new layout
* ui/QIncludeDialog.ui: new layout
-
+
* ui/QCitationDialog.ui: new layout
-
+
* ui/QExternalDialog.ui: new layout
-
+
* QGraphics.C: Compile fix
-
- * TODO:
+
+ * TODO:
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* Menubar_pimpl.h:
* Menubar_pimpl.C: implement check/disable, submenus
-
+
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* Toolbar_pimpl.h:
* Toolbar_pimpl.C: implement getLayoutList()
-
+
2002-07-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* Toolbar_pimpl.C: use BufferParams::getLyXTextClass
* QToc.h:
* QToc.C: compile fixes, default to depth_(1)
-
+
2002-07-21 John Levon <moz@compsoc.man.ac.uk>
* Menubar_pimpl.C: change for removed menubar stuff
-
+
2002-07-21 John Levon <moz@compsoc.man.ac.uk>
* QtView.C: reset idle timer on message()
-
+
2002-07-20 John Levon <moz@compsoc.man.ac.uk>
* QLImage.C: various fixes
-
- * QWorkArea.C: set focus proxy
-
+
+ * QWorkArea.C: set focus proxy
+
* qscreen.C: don't show cursor when in command buffer
-
+
* Makefile.am:
* moc/Makefile.am:
* QMiniBuffer.h:
- * QMiniBuffer.C:
+ * QMiniBuffer.C:
* QCommandBuffer.h:
* QCommandBuffer.C:
* QCommandEdit.h:
2002-07-19 John Levon <moz@compsoc.man.ac.uk>
* QWorkArea.C: remove unnecessary include
-
+
2002-07-18 John Levon <moz@compsoc.man.ac.uk>
* QtView.C:
* Toolbar_pimpl.C:
* lyx_gui.C: verboseDispatch() is now dispatch()
-
+
2002-07-07 Edwin Leuven <leuven@fee.uva.nl>
* QParagraph.[Ch]: Add paragraph dialog
- * QParagraphDialog.[Ch]:
- * ui/QParagraphDialog.[Ch]:
+ * QParagraphDialog.[Ch]:
+ * ui/QParagraphDialog.[Ch]:
* Makefile.am:
* Makefile.dialogs:
* guiapi.C:
2002-07-17 John Levon <moz@compsoc.man.ac.uk>
* QtView.C: basic statusbar show
-
+
2002-07-17 John Levon <moz@compsoc.man.ac.uk>
* QLImage.C: add using std
-
+
2002-07-15 John Levon <moz@compsoc.man.ac.uk>
* QLImage.h:
* QLImage.C: remove getPixmap() add isDrawable()
-
+
2002-07-14 John Levon <moz@compsoc.man.ac.uk>
* io_callback.h:
* lyx_gui.C: make set_read_callback() work
-
+
2002-07-14 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.C: add set_read_callback()
-
- * Makefile.am:
+
+ * Makefile.am:
* xforms/*: remove
-
+
2002-07-13 John Levon <moz@compsoc.man.ac.uk>
* QtView.C: add a status bar
-
- * Toolbar_pimpl.C: minor fixes
- * lyx_gui.C: implement hexname()
+ * Toolbar_pimpl.C: minor fixes
+
+ * lyx_gui.C: implement hexname()
2002-07-12 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.C: move init_graphics() to parse_init()
-
+
2002-07-12 John Levon <moz@compsoc.man.ac.uk>
* Toolbar_pimpl.h:
* Toolbar_pimpl.C: remove unused (de)activate()
-
+
2002-07-12 John Levon <moz@compsoc.man.ac.uk>
- * lyx_gui.C: implement update_fonts(), font_available()
-
+ * lyx_gui.C: implement update_fonts(), font_available()
+
2002-07-12 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.C: add un-needed update_color()
* QtView.h:
* QtView.C: remove unused methods
-
+
2002-07-12 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am:
* QLPainter.C: draw images
* QWorkArea.C: implement clipboard as much as possible
-
+
2002-07-11 John Levon <moz@compsoc.man.ac.uk>
* dialog files: add unused Dialogs paramater to allow compile
-
+
* QtView.C:
* QMiniBuffer.h:
* QMiniBuffer.C:
* Makefile.am: add QMiniBuffer (placeholder)
-
+
* TODO: add
-
+
* Toolbar_pimpl.h:
* Toolbar_pimpl.C: compile fix
* lyx_gui.C: add hexname() place holder
-
+
2002-07-04 André Pönitz <poenitz@lyx.org>
* xforms/Makefile.am: replace XFORMSGIMAGE by XFORMSIMAGE
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* qfont_metrics.C: fix variable names
-
+
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* QWorkArea.C: remove dead splash code
-
+
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* QContentPane.C: restore calls to workAreaResize()
- * QLyXKeySym.h: tidy
+ * QLyXKeySym.h: tidy
+
+ * QWorkArea.h: remove redraw()
- * QWorkArea.h: remove redraw()
-
* QWorkArea.C: remove resize()
-
+
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* guiapi.C: createIndex() changed
-
+
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* QWorkArea.h: remove unused resize(...)
-
+
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* QWorkArea.h: remove unused stuff
-
+
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* QContentPane.h:
* QContentPane.C: remove focus/unfocus events
-
+
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* QWorkArea.h: remove unused methods
-
+
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* LyXKeySymFactory.C: add
* QLyXKeySym.h:
* QLyXKeySym.C: get keyboard partly working
- * qfont_metrics.C: fix compile
-
+ * qfont_metrics.C: fix compile
+
2002-06-19 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am: add the new files ...
-
+
* Dialogs.C:
* guiapi.C:
* all dialogs: implement new dialog stuff, fix compile
* QContentPane.h:
* QContentPane.C: new widget for containing a lyx document
-
+
* QLPainter.h:
* QLPainter.C: qt painter object
-
+
* QWorkArea.h:
* QWorkArea.C: Qt version of the work area
-
+
* QtView.h:
* QtView.C: Qt version of LyXView
* Toolbar_pimpl.C:
* Menubar_pimpl.h:
* Menubar_pimpl.C: initial Qt versions
-
+
* WorkAreaFactory.C: generate a QWorkArea
-
- * emptytable.C: add a resize grippie
-
+
+ * emptytable.C: add a resize grippie
+
* qfont_loader.h:
* qfont_loader.C: font loader for Qt
-
+
* qfont_metrics.h:
* qfont_metrics.C: font metrics for Qt
-
+
* qlkey.h: convert Qt key symbol into a name
-
+
* qscreen.h:
* qscreen.C: Qt version of screen
-
+
* moc/Makefile.am: add new files
-
+
* xforms/Makefile.am: remove all xforms dialogs
-
+
2002-06-10 Lars Gullik Bjønnes <larsbj@birdstep.com>
* Qt2BC.C: do not include ButtonController.tmpl
2002-05-23 John Levon <moz@compsoc.man.ac.uk>
* QtLyXView.h: moved into frontends/
-
+
2002-05-22 Lars Gullik Bjønnes <larsbj@birdstep.com>
* QDocument.h: use more specific smart_ptr header.
while (!bibs.empty()) {
bibs = split(bibs, bib, ',');
- bib = frontStrip(strip(bib));
+ bib = trim(bib);
if (!bib.empty())
dialog_->databaseLB->inSort(bib.c_str());
}
bibstyle = "";
} else
dialog_->bibtocCB->setChecked(false);
-
+
vector<string> const str = getVectorFromString(
controller().getBibStyles(),"\n");
for (vector<string>::const_iterator it = keys.begin();
it < keys.end(); ++it) {
- string const key = frontStrip(strip(*it));
+ string const key = trim(*it);
// FIXME: why the .empty() test ?
if (!key.empty())
browser->insertItem(key.c_str());
using std::remove_if;
typedef Qt2CB<ControlParagraph, Qt2DB<QParagraphDialog> > base_class;
-
+
QParagraph::QParagraph(ControlParagraph & c, Dialogs &)
: base_class(c, _("Paragraph Layout"))
{}
vector<string>::iterator del = remove_if(units_.begin(), units_.end(),
bind2nd(contains_functor(), "%"));
units_.erase(del, units_.end());
-
+
for (vector<string>::const_iterator it = units_.begin();
it != units_.end(); ++it) {
dialog_->unitAbove->insertItem(it->c_str());
dialog_->unitBelow->insertItem(it->c_str());
}
-
+
// Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
break;
case 6:
string s;
- string const length = strip(frontStrip(value));
+ string const length = trim(value);
if (isValidGlueLength(length)) {
s = length;
} else if (!length.empty()){
- string u = strip(frontStrip(unit));
+ string u = trim(unit);
u = subst(u, "%%", "%");
s = length + u;
}
// If a vspace kind is "Length" but there's no text in
// the input field, reset the kind to "None".
if (dialog_->spacingAbove->currentItem()==5
- && dialog_->valueAbove->text().isEmpty())
+ && dialog_->valueAbove->text().isEmpty())
dialog_->spacingAbove->setCurrentItem(0);
-
+
VSpace const space_top =
setVSpaceFromWidgets(dialog_->spacingAbove->currentItem(),
string(dialog_->valueAbove->text()),
string(dialog_->unitAbove->currentText()),
dialog_->keepAbove->isChecked());
-
+
controller().params().spaceTop(space_top);
/* SPACING BELOW */
if (dialog_->spacingBelow->currentItem()==5
- && dialog_->valueBelow->text().isEmpty())
+ && dialog_->valueBelow->text().isEmpty())
dialog_->spacingBelow->setCurrentItem(0);
VSpace const space_bottom =
string(dialog_->valueBelow->text()),
string(dialog_->unitBelow->currentText()),
dialog_->keepBelow->isChecked());
-
+
controller().params().spaceBottom(space_bottom);
/* alignment */
align = LYX_ALIGN_BLOCK;
}
controller().params().align(align);
-
+
/* get spacing */
Spacing::Space linespacing = Spacing::Default;
string other;
Spacing const spacing(linespacing, other);
controller().params().spacing(spacing);
-
+
/* lines and pagebreaks */
controller().params().lineTop(dialog_->lineAbove->isChecked());
controller().params().lineBottom(dialog_->lineBelow->isChecked());
case VSpace::VFILL:
item = 5;
break;
- case VSpace::LENGTH:
+ case VSpace::LENGTH:
item = 6;
value->setEnabled(true);
unit->setEnabled(true);
break;
}
dialog_->align->setCurrentItem(i);
-
+
//LyXAlignment alignpos = controller().alignPossible();
/* no indent */
dialog_->noindent->setChecked(controller().params().noindent());
}
-
-
-
-
+2002-07-29 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * several files: strip,frontStrip -> trim,ltrim,rtrim
+
2002-07-25 John Levon <levon@movementarian.org>
* lyx_gui.C:
- * XWorkArea.C: using dec
+ * XWorkArea.C: using dec
2002-07-25 Juergen Spitzmueller <j.spitzmueller@gmx.de>
2002-07-25 John Levon <levon@movementarian.org>
* forms/form_float.fd: "Span columns"
-
+
2002-07-25 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* FormFloat.C:
2002-07-24 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* Menubar_pimpl.C (create_submenu): updates due to changes in
- menubackend.
+ menubackend.
2002-07-22 Lars Gullik Bjønnes <larsbj@birdstep.com>
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
- * XFormsView.C: don't call toolbar_->set()
+ * XFormsView.C: don't call toolbar_->set()
* Toolbar_pimpl.h:
* Toolbar_pimpl.C: rationalise code, remove half-working
update stuff into simple add()
-
+
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* lyx_gui.C: add lyx_gui::exit()
for (vector<string>::const_iterator it = keys.begin();
it < keys.end(); ++it) {
- string key = frontStrip(strip(*it));
+ string key = trim(*it);
if (!key.empty())
fl_add_browser_line(browser, key.c_str());
}
bool const metric = (paperchoice == 1 && lyxrc.default_papersize > 3)
|| paperchoice == 2 || paperchoice > 5;
int const default_unit = metric ? 8 : 9;
- if (strip(fl_get_input(class_->input_doc_skip)).empty())
+ if (rtrim(fl_get_input(class_->input_doc_skip)).empty())
fl_set_choice(class_->choice_default_skip_units,
default_unit);
}
bool const metric = (defsize && lyxrc.default_papersize > 3)
|| paperchoice == 2 || paperchoice > 5;
int const default_unit = metric ? 8 : 9;
- if (strip(fl_get_input(paper_->input_custom_width)).empty())
+ if (rtrim(fl_get_input(paper_->input_custom_width)).empty())
fl_set_choice(paper_->choice_custom_width_units,
default_unit);
- if (strip(fl_get_input(paper_->input_custom_height)).empty())
+ if (rtrim(fl_get_input(paper_->input_custom_height)).empty())
fl_set_choice(paper_->choice_custom_height_units,
default_unit);
- if (strip(fl_get_input(paper_->input_top_margin)).empty())
+ if (rtrim(fl_get_input(paper_->input_top_margin)).empty())
fl_set_choice(paper_->choice_top_margin_units,
default_unit);
- if (strip(fl_get_input(paper_->input_bottom_margin)).empty())
+ if (rtrim(fl_get_input(paper_->input_bottom_margin)).empty())
fl_set_choice(paper_->choice_bottom_margin_units,
default_unit);
- if (strip(fl_get_input(paper_->input_inner_margin)).empty())
+ if (rtrim(fl_get_input(paper_->input_inner_margin)).empty())
fl_set_choice(paper_->choice_inner_margin_units,
default_unit);
- if (strip(fl_get_input(paper_->input_outer_margin)).empty())
+ if (rtrim(fl_get_input(paper_->input_outer_margin)).empty())
fl_set_choice(paper_->choice_outer_margin_units,
default_unit);
- if (strip(fl_get_input(paper_->input_head_height)).empty())
+ if (rtrim(fl_get_input(paper_->input_head_height)).empty())
fl_set_choice(paper_->choice_head_height_units,
default_unit);
- if (strip(fl_get_input(paper_->input_head_sep)).empty())
+ if (rtrim(fl_get_input(paper_->input_head_sep)).empty())
fl_set_choice(paper_->choice_head_sep_units,
default_unit);
- if (strip(fl_get_input(paper_->input_foot_skip)).empty())
+ if (rtrim(fl_get_input(paper_->input_foot_skip)).empty())
fl_set_choice(paper_->choice_foot_skip_units,
default_unit);
}
if (!filename.empty()) {
for (int i = 0; i < fl_get_browser_maxline(file_dlg_form_->List); ++i) {
string s = fl_get_browser_line(file_dlg_form_->List, i + 1);
- s = strip(frontStrip(s));
+ s = trim(s);
if (s == filename) {
sel = i + 1;
break;
} else if (ob == dialog_->button_load) {
string const in_name = fl_get_input(dialog_->input_filename);
- if (!strip(in_name).empty() && controller().fileExists(in_name)) {
+ if (!rtrim(in_name).empty() && controller().fileExists(in_name)) {
// ApplyButton();
OKButton();
- controller().load(strip(in_name));
+ controller().load(rtrim(in_name));
action = ButtonPolicy::SMI_NOOP;
}
} else if (ob == dialog_->input_filename) {
string const in_name = fl_get_input(dialog_->input_filename);
- if (strip(in_name).empty())
+ if (rtrim(in_name).empty())
action = ButtonPolicy::SMI_INVALID;
}
// If a vspace kind is "Length" but there's no text in
// the input field, reset the kind to "None".
- string const input = strip(getString(input_length));
+ string const input = rtrim(getString(input_length));
if (input.empty())
fl_set_choice(choice_type, 1);
}
string const length = getString(input_length);
- if (strip(length).empty()) {
+ if (rtrim(length).empty()) {
bool const metric = lyxrc.default_papersize > 3;
int const default_unit = metric ? 8 : 9;
string const
FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
{
- if (ob == dialog_->browser_lyx_objs)
+ if (ob == dialog_->browser_lyx_objs)
return _("LyX objects that can be assigned a color.");
- if (ob == dialog_->button_modify)
+ if (ob == dialog_->button_modify)
return _("Modify the LyX object's color. Note: you must then \"Apply\" the change.");
if (ob == dialog_->dial_hue ||
ob == dialog_->slider_blue)
return _("Find a new color.");
- if (ob == dialog_->radio_rgb || ob == dialog_->radio_hsv)
+ if (ob == dialog_->radio_rgb || ob == dialog_->radio_hsv)
return _("Toggle between RGB and HSV color spaces.");
return string();
string const
FormPreferences::Converters::feedback(FL_OBJECT const * const ob) const
{
- if (ob == dialog_->browser_all)
+ if (ob == dialog_->browser_all)
return _("All the currently defined converters known to LyX.");
if (ob == dialog_->choice_from)
if (ob == dialog_->input_converter)
return _("The conversion command. $$i is the input file name, "
- "$$b is the file name without its extension and $$o is "
- "the name of the output file. $$s can be used as path to "
- "LyX's own collection of conversion scripts.");
+ "$$b is the file name without its extension and $$o is "
+ "the name of the output file. $$s can be used as path to "
+ "LyX's own collection of conversion scripts.");
if (ob == dialog_->input_flags)
return _("Extra information for the Converter class, whether and "
- "how to parse the result, and various other things.");
+ "how to parse the result, and various other things.");
if (ob == dialog_->button_delete)
return _("Remove the current converter from the list of available "
- "converters. Note: you must then \"Apply\" the change.");
+ "converters. Note: you must then \"Apply\" the change.");
if (ob == dialog_->button_add) {
if (string(ob->label) == _("Add"))
return _("Add the current converter to the list of available "
- "converters. Note: you must then \"Apply\" the change.");
+ "converters. Note: you must then \"Apply\" the change.");
else
return _("Modify the contents of the current converter. "
- "Note: you must then \"Apply\" the change.");
+ "Note: you must then \"Apply\" the change.");
}
return string();
|| ob == dialog_->input_flags)
return Input();
- if (ob == dialog_->button_add)
+ if (ob == dialog_->button_add)
return Add();
- if (ob == dialog_->button_delete)
+ if (ob == dialog_->button_delete)
return erase();
return true;
setEnabled(dialog_->button_delete, true);
}
- string const command = strip(fl_get_input(dialog_->input_converter));
+ string const command = rtrim(fl_get_input(dialog_->input_converter));
bool const enable = !(command.empty() || from == to);
setEnabled(dialog_->button_add, enable);
string const
FormPreferences::Formats::feedback(FL_OBJECT const * const ob) const
{
- if (ob == dialog_->browser_all)
+ if (ob == dialog_->browser_all)
return _("All the currently defined formats known to LyX.");
if (ob == dialog_->input_format)
if (ob == dialog_->input_shrtcut)
return _("The keyboard accelerator. Use a letter in the GUI name. "
- "Case sensitive.");
+ "Case sensitive.");
if (ob == dialog_->input_extension)
return _("Used to recognize the file. E.g., ps, pdf, tex.");
if (ob == dialog_->button_delete)
return _("Remove the current format from the list of available "
- "formats. Note: you must then \"Apply\" the change.");
+ "formats. Note: you must then \"Apply\" the change.");
- if (ob == dialog_->button_add) {
+ if (ob == dialog_->button_add) {
if (string(ob->label) == _("Add"))
return _("Add the current format to the list of available "
- "formats. Note: you must then \"Apply\" the change.");
+ "formats. Note: you must then \"Apply\" the change.");
else
return _("Modify the contents of the current format. Note: "
- "you must then \"Apply\" the change.");
+ "you must then \"Apply\" the change.");
}
return string();
bool FormPreferences::Formats::input(FL_OBJECT const * const ob)
{
- if (ob == dialog_->browser_all)
+ if (ob == dialog_->browser_all)
return Browser();
if (ob == dialog_->input_format
|| ob == dialog_->input_viewer)
return Input();
- if (ob == dialog_->button_add)
+ if (ob == dialog_->button_add)
return Add();
- if (ob == dialog_->button_delete)
+ if (ob == dialog_->button_delete)
return erase();
return false;
if (local_converters.formatIsUsed(name)) {
parent_.postWarning(_("Cannot remove a Format used by a Converter. "
- "Remove the converter first."));
+ "Remove the converter first."));
setEnabled(dialog_->button_delete, false);
return false;
}
{
string choice = fl_get_choice_text(dialog_->choice_spell_command);
- choice = strip(frontStrip(choice));
+ choice = trim(choice);
lyxrc.isp_command = choice;
return ButtonPolicy::SMI_INVALID;
string cmd = getString(dialog_->input_command);
- cmd = strip(frontStrip(cmd));
+ cmd = trim(cmd);
if (cmd.empty())
return ButtonPolicy::SMI_INVALID;
ButtonPolicy::SMInput FormThesaurus::input(FL_OBJECT * obj, long)
{
if (obj == dialog_->input_entry) {
- string s = strip(frontStrip(fl_get_input(dialog_->input_entry)));
+ string s = trim(fl_get_input(dialog_->input_entry));
updateMeanings(s);
int const line = fl_get_browser(obj);
if (line > 0) {
setReplace(fl_get_input(dialog_->input_entry),
- strip(frontStrip(fl_get_browser_line(obj, line))));
+ trim(fl_get_browser_line(obj, line)));
}
if (clickline_ == fl_get_browser(obj)) {
if (it != tooltipsMap.end())
return;
- string const str = strip(frontStrip(tip));
+ string const str = trim(tip);
if (str.empty())
return;
if (it != tooltipsMap.end())
return;
- string const str = strip(frontStrip(tip));
+ string const str = trim(tip);
if (str.empty())
return;
width,
height,
fl_get_visual_depth());
-
+
workAreaResize();
}
code below. */
string pages = subst(fl_get_input(fd_form_print->input_pages), ';',',');
- pages = subst(pages, '+',',');
- pages = frontStrip(strip(pages)) ;
+ pages = trim(subst(pages, '+', ','));
+
while (!pages.empty()) { // a page range was given
string piece ;
pages = split (pages, piece, ',') ;
- piece = strip(piece) ;
- piece = frontStrip(piece) ;
+ piece = trim(piece);
if (!stringOnlyContains (piece, "0123456789-")) {
Alert::alert(_("ERROR! Unable to print!"),
_("Check 'range of pages'!"));
return pixmap_;
}
-
+
Pixmap xformsImage::getPixmap() const
{
if (!pixmap_status_ == PIXMAP_SUCCESS)
{
lyx::Assert(ob && ob->u_vdata);
- string const str = s ? strip(s) : string();
+ string const str = s ? rtrim(s) : string();
if (str.empty())
return 0;
{
lyx::Assert(ob && ob->u_vdata);
- string const str = s ? strip(s) : string();
+ string const str = s ? rtrim(s) : string();
if (str.empty())
return;
vector<string> const getVector(FL_OBJECT * ob)
{
vector <string> vec;
-
+
switch (ob->objclass) {
case FL_CHOICE:
for(int i = 0; i < fl_get_choice_maxitems(ob); ++i) {
string const text = fl_get_choice_item_text(ob, i+1);
- vec.push_back(strip(frontStrip(text)));
+ vec.push_back(trim(text));
}
break;
case FL_BROWSER:
for(int i = 0; i < fl_get_browser_maxline(ob); ++i) {
string const text = fl_get_browser_line(ob, i+1);
- vec.push_back(strip(frontStrip(text)));
+ vec.push_back(trim(text));
}
break;
default:
lyx::Assert(0);
}
-
+
return vec;
}
case FL_BROWSER:
if (line == -1)
line = fl_get_browser(ob);
-
+
if (line >= 1 && line <= fl_get_browser_maxline(ob))
tmp = fl_get_browser_line(ob, line);
break;
-
+
case FL_CHOICE:
if (line == -1)
line = fl_get_choice(ob);
-
+
if (line >= 1 && line <= fl_get_choice_maxitems(ob))
tmp = fl_get_choice_item_text(ob, line);
break;
-
+
default:
lyx::Assert(0);
- }
+ }
- return (tmp) ? frontStrip(strip(tmp)) : string();
+ return (tmp) ? trim(tmp) : string();
}
-
+
string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
{
// Paranoia check
lyx::Assert(input && input->objclass == FL_INPUT &&
choice && choice->objclass == FL_CHOICE);
- string const length = strip(frontStrip(fl_get_input(input)));
+ string const length = trim(fl_get_input(input));
if (length.empty())
return string();
if (isValidGlueLength(length))
return length;
- string unit = strip(frontStrip(fl_get_choice_text(choice)));
+ string unit = trim(fl_get_choice_text(choice));
unit = subst(unit, "%%", "%");
return length + unit;
+2002-07-29 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * PreviewLoader.C (setFontScalingFactor): strip,frontStrip ->
+ trim,ltrim,rtrim
+ (setAscentFractions): ditto
+
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
* PreviewLoader.C (setAscentFractions): modify because of strip
getline(ifs, str);
// To get the default font size, look for a line like
// "\ExecuteOptions{letterpaper,10pt,oneside,onecolumn,final}"
- if (!prefixIs(frontStrip(str), "\\ExecuteOptions"))
+ if (!prefixIs(ltrim(str), "\\ExecuteOptions"))
continue;
// str contains just the options of \ExecuteOptions
if (!ifs.good() ||
page != "%%Page" ||
- !isStrUnsignedInt(strip(page_id, ":"))) {
+ !isStrUnsignedInt(rtrim(page_id, ":"))) {
lyxerr[Debug::GRAPHICS] << "setAscentFractions("
<< metrics_file << ")\n"
<< "Error reading file!"
+2002-07-29 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * several files: strip,frontStrip -> trim,ltrim,rtrim
+
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
* insetbib.C (latex): modify because of strip changes
db_out += ',';
db_in= split(db_in, adb,',');
}
- db_out = strip(db_out, ",");
+ db_out = rtrim(db_out, ",");
os << "\\bibliography{" << db_out << "}\n";
return 2;
}
ifstream ifs(it->c_str());
string linebuf0;
while (getline(ifs, linebuf0)) {
- string linebuf = frontStrip(strip(linebuf0));
+ string linebuf = trim(linebuf0);
if (linebuf.empty()) continue;
if (prefixIs(linebuf, "@")) {
linebuf = subst(linebuf, '{', '(');
if (!prefixIs(tmp, "@string")
&& !prefixIs(tmp, "@preamble")) {
linebuf = split(linebuf, tmp, ',');
- tmp = frontStrip(tmp);
- tmp = frontStrip(tmp,"\t");
+ tmp = ltrim(tmp, " \t");
if (!tmp.empty()) {
keys.push_back(pair<string,string>(tmp,string()));
}
label += year + sep_str;
}
}
- label = strip(strip(label), sep);
+ label = rtrim(rtrim(label), sep);
if (!after_str.empty()) {
if (cite_type == "citet") {
if (contains(keys, ",")) {
// Final comma allows while loop to cover all keys
- keys = frontStrip(split(keys, label, ',')) + ",";
+ keys = ltrim(split(keys, label, ',')) + ",";
while (contains(keys, ",")) {
string key;
- keys = frontStrip(split(keys, key, ','));
+ keys = ltrim(split(keys, key, ','));
label += ", " + key;
}
} else
InsetGraphics::Cache::Cache(InsetGraphics & p)
: old_ascent(0), checksum(0), parent_(p)
{
- loader.connect(boost::bind(&InsetGraphics::statusChanged, &parent_));
+ loader.connect(boost::bind(&InsetGraphics::statusChanged, &parent_));
}
// before writing it to the output stream.
ostringstream options;
if (!params().bb.empty())
- options << " bb=" << strip(params().bb) << ",\n";
+ options << " bb=" << rtrim(params().bb) << ",\n";
if (params().draft)
options << " draft,\n";
if (params().clip)
unsigned long const new_checksum = cache_->loader.checksum();
bool const file_has_changed = cache_->checksum != new_checksum;
if (file_has_changed)
- cache_->checksum = new_checksum;
+ cache_->checksum = new_checksum;
// temp_file will contain the file for LaTeX to act on if, for example,
// we move it to a temp dir or uncompress it.
{
pair<bool, string> result = Alert::askForText(_("Enter label:"), getContents());
if (result.first) {
- string new_contents = frontStrip(strip(result.second));
+ string new_contents = trim(result.second);
if (!new_contents.empty() &&
getContents() != new_contents) {
bv->buffer()->markDirty();
// REMOVE IN 0.13
// Dirty Hack for backward compability. remove in 0.13 (Lgb)
- contents = frontStrip(strip(contents));
+ contents = trim(contents);
if (!contains(contents, "{") && !contains(contents, "}")) {
if (contents.length() == 2) {
string tmp;
max = font_metrics::ascent('a', font);
else
max = font_metrics::ascent(ic, font);
- if (plusasc)
+ if (plusasc)
max += (font_metrics::maxAscent(font) + 3) / 3;
} else
max = font_metrics::maxAscent(font) + 4;
{
int max;
if (candisp) {
- if (ic == ' ')
+ if (ic == ' ')
max = font_metrics::descent('a', font);
- else
- max = font_metrics::descent(ic, font);
- if (plusdesc)
- max += 3;
+ else
+ max = font_metrics::descent(ic, font);
+ if (plusdesc)
+ max += 3;
} else
max = font_metrics::maxDescent(font) + 4;
return max;
{
if (candisp)
return font_metrics::width(ic, font);
- else
- return font_metrics::width(contents, font) + 4;
+ else
+ return font_metrics::width(contents, font) + 4;
}
// now the rest - draw within (x, y, x+wid, y+hg)
switch (modtype) {
case ACUTE: // acute 0xB4
- {
+ {
pain.text(int(x2 - (font_metrics::rbearing(0xB4, font) - font_metrics::lbearing(0xB4, font)) / 2),
baseline - font_metrics::ascent(ic, font) - font_metrics::descent(0xB4, font) - (font_metrics::ascent(0xB4, font) + font_metrics::descent(0xB4, font)) / 2,
char(0xB4), font);
font.setLanguage(default_language);
lyx::pos_type pos = 0;
- buf->insertStringAsLines(par, pos, font, strip(contents, "\n"));
+ buf->insertStringAsLines(par, pos, font, rtrim(contents, "\n"));
}
return false;
string const val =
- frontStrip(what.substr(tabularFeature[i].feature.length()));
+ ltrim(what.substr(tabularFeature[i].feature.length()));
tabularFeatures(bv, action, val);
return true;
}
return status.unknown(true);
}
- string const argument = frontStrip(what.substr(tabularFeature[i].feature.length()));
+ string const argument = ltrim(what.substr(tabularFeature[i].feature.length()));
int sel_row_start;
int sel_row_end;
updateLocal(bv, FULL, false);
return true;
}
- }
+ }
return false;
}
pair<bool, string> result =
Alert::askForText(_("Enter new label to insert:"), text);
if (result.first) {
- label = frontStrip(strip(result.second));
+ label = trim(result.second);
}
}
if (!label.empty()) {
break;
default:
- if (!strip(lex.getString()).empty())
+ if (!rtrim(lex.getString()).empty())
lex.printError("LyX::ReadUIFile: "
"Unknown menu tag: `$$Token'");
break;
class Buffer;
class kb_keymap;
-
+
///
extern string user_lyxdir;
///
extern string system_tempdir;
///
extern boost::scoped_ptr<LastFiles> lastfiles;
-
+
class LyX : boost::noncopyable {
public:
ost << _(" Number ") << _(GUIMiscNames[number()]);
string buf(ost.str().c_str());
- buf = strip(buf, ", ");
+ buf = rtrim(buf, ", ");
return buf;
}
}
if (!comname.empty()) {
- comname = strip(comname);
+ comname = rtrim(comname);
dispatch_msg += "(" + comname + ')';
}
// blank line in the file being read
continue;
- string const token = frontStrip(strip(getString()), " \t");
+ string const token = trim(getString(), " \t");
lyxerr[Debug::PARSER] << "LongString: `"
<< getString() << '\'' << endl;
&& prefixIs(tmpstr, prefix)) {
tmpstr.erase(0, prefix.length() - 1);
}
- str += frontStrip(tmpstr, "\t") + '\n';
+ str += ltrim(tmpstr, "\t") + '\n';
}
else // token == endtoken
break;
pimpl_->printError("file ended while scanning string token");
return -1;
}
-
+
int i = 0;
-
+
if (compare(pimpl_->buff, "default")) {
while (str[i][0] && compare(str[i], pimpl_->buff)) {
++i;
i = -1;
}
}
-
+
return i;
}
while ((status = read(infd, charbuf, CMDBUFLEN-1))) {
if (status > 0) {
charbuf[status]= '\0'; // turn it into a c string
- lsbuf += strip(charbuf, "\r");
+ lsbuf += rtrim(charbuf, "\r");
// commit any commands read
while (lsbuf.find('\n') != string::npos) {
// split() grabs the entire string if
case TC_PAGESTYLE:
lexrc.next();
- pagestyle_ = strip(lexrc.getString());
+ pagestyle_ = rtrim(lexrc.getString());
break;
case TC_DEFAULTFONT:
switch (static_cast<ClassOptionsTags>(le)) {
case CO_FONTSIZE:
lexrc.next();
- opt_fontsize_ = strip(lexrc.getString());
+ opt_fontsize_ = rtrim(lexrc.getString());
break;
case CO_PAGESTYLE:
lexrc.next();
- opt_pagestyle_ = strip(lexrc.getString());
+ opt_pagestyle_ = rtrim(lexrc.getString());
break;
case CO_OTHER:
lexrc.next();
+2002-07-29 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * formula.C (localDispatch): strip,frontStrip -> trim,ltrim,rtrim
+
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
* math_nestinset.C: add using std::vector
: Alert::askForText(_("Enter label:"), old_label);
if (!res.first)
break;
- new_label = frontStrip(strip(res.second));
+ new_label = trim(res.second);
}
//if (new_label == old_label)
if (!preview_->usePreview())
return 1 + par_->descent();
- int const descent = preview_->pimage_->descent();
- return display() ? descent + 12 : descent;
+ int const descent = preview_->pimage_->descent();
+ return display() ? descent + 12 : descent;
}
//delete mathcursor;
return;
}
-
+
}
- if (button == mouse_button::button3) {
+ if (button == mouse_button::button3) {
if (mathcursor->dispatch("mouse-3-press")) {
//delete mathcursor;
return;
if (!mathcursor)
return;
- if (button == mouse_button::button1)
+ if (button == mouse_button::button1)
if (mathcursor->dispatch("mouse-1-motion"))
return;
- if (button == mouse_button::button3)
+ if (button == mouse_button::button3)
if (mathcursor->dispatch("mouse-3-motion"))
return;
case LFUN_ENDSEL:
sel = true; // fall through
case LFUN_END:
- result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT;
+ result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT;
updateLocal(bv, false);
break;
// ensure that 'notifyCursorLeave' is called
while (popLeft())
;
-}
+}
void MathCursor::push(MathAtom & t)
+2002-07-29 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * lstrings.[hC]: rename stip to rtrim and frontStrip to ltrim,
+ also add a trim function that is the equiv of
+ strip(frontStrip(...)), also reimplement the functions
+ (improvements still possible.)
+
+ * filetools.C: strip,frontStrip -> trim,ltrim,rtrim
+ * forkedcall.C (generateChild): ditto
+ * lstrings.C: ditto
+
+
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
* filetools.C (GetEnvPath): modify because of strip changes
(isStrDbl): ditto
(contains): removed unneeded version of contains
(containsOnly): removed uneeded versions of containsOnly
- (strip, frontStrip): removed unneded versions, changed argument types.
+ (strip, frontStrip): removed unneded versions, changed argument types.
2002-07-22 Dekel Tsur <dekelts@tau.ac.il>
#else
string const pathlist = os::slashify_path(GetEnv(name));
#endif
- return strip(pathlist, ";");
+ return rtrim(pathlist, ";");
}
// Creates directory. Returns true if succesfull
bool createDirectory(string const & path, int permission)
{
- string temp(strip(os::slashify_path(path), "/"));
+ string temp(rtrim(os::slashify_path(path), "/"));
if (temp.empty()) {
Alert::alert(_("Internal error!"),
cmd_ret const c = RunCommand(kpsecmd);
lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n"
- << "kpse result = `" << strip(c.second, "\n")
+ << "kpse result = `" << rtrim(c.second, "\n")
<< "'" << endl;
if (c.first != -1)
- return os::internal_path(strip(strip(c.second, "\n"), "\r"));
+ return os::internal_path(rtrim(c.second, "\n\r"));
else
return string();
}
string s;
getline(is,s);
if (contains(s,"%%BoundingBox:") && !contains(s,"atend")) {
- string const bb = frontStrip(s.substr(14));
+ string const bb = ltrim(s.substr(14));
readBB_lyxerrMessage(file_, zipped, bb);
return bb;
}
int index = 0;
while (more) {
- childcommand = frontStrip(childcommand);
+ childcommand = ltrim(childcommand);
if (syscmd == 0) {
syscmd = new char[childcommand.length() + 1];
childcommand.copy(syscmd, childcommand.length());
if (str.empty()) return false;
// Remove leading and trailing white space chars.
- string const tmpstr = frontStrip(strip(str));
+ string const tmpstr = trim(str);
if (tmpstr.empty()) return false;
string::const_iterator cit = tmpstr.begin();
if (str.empty()) return false;
// Remove leading and trailing white space chars.
- string const tmpstr = frontStrip(strip(str));
+ string const tmpstr = trim(str);
if (tmpstr.empty()) return false;
string::const_iterator cit = tmpstr.begin();
{
if (isStrInt(str)) {
// Remove leading and trailing white space chars.
- string const tmpstr = frontStrip(strip(str));
+ string const tmpstr = trim(str);
// Do the conversion proper.
return lyx::atoi(tmpstr);
} else {
{
if (isStrUnsignedInt(str)) {
// Remove leading and trailing white space chars.
- string const tmpstr = frontStrip(strip(str));
+ string const tmpstr = trim(str);
// Do the conversion proper.
return lyx::atoi(tmpstr);
} else {
if (str.empty()) return false;
// Remove leading and trailing white space chars.
- string const tmpstr = frontStrip(strip(str));
+ string const tmpstr = trim(str);
if (tmpstr.empty()) return false;
// if (1 < tmpstr.count('.')) return false;
{
if (isStrDbl(str)) {
// Remove leading and trailing white space chars.
- string const tmpstr = frontStrip(strip(str));
+ string const tmpstr = trim(str);
// Do the conversion proper.
return ::atof(tmpstr.c_str());
} else {
}
-string const strip(string const & a, char const * p)
+string const trim(string const & a, char const * p)
{
lyx::Assert(p);
- if (a.empty() || !*p) return a;
- string tmp(a);
- string::size_type i = tmp.find_last_not_of(p);
- if (i == a.length() - 1) return tmp; // no c's at end of a
- if (i != string::npos)
- tmp.erase(i + 1, string::npos);
-#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
- // Ok This code is now suspect... (Lgb)
- /// Needed for broken string::find_last_not_of
- else if (tmp[0] != p[0]) {
- if (a.length() == 1) return tmp;
- tmp.erase(1, string::npos);
- }
-#endif
- else
- tmp.erase(); // only chars from p in the whole string
- return tmp;
+ if (a.empty() || !*p)
+ return a;
+
+ string::size_type r = a.find_last_not_of(p);
+ string::size_type l = a.find_first_not_of(p);
+
+ // Is this the minimal test? (lgb)
+ if (r == string::npos && l == string::npos)
+ return string();
+
+ return a.substr(l, r - l + 1);
}
-string const frontStrip(string const & a, char const * p)
+string const rtrim(string const & a, char const * p)
{
lyx::Assert(p);
- if (a.empty() || !*p) return a;
- string tmp(a);
- string::size_type i = tmp.find_first_not_of(p);
- if (i > 0)
- tmp.erase(0, i);
- return tmp;
+ if (a.empty() || !*p)
+ return a;
+
+ string::size_type r = a.find_last_not_of(p);
+
+ // Is this test really needed? (Lgb)
+ if (r == string::npos)
+ return string();
+
+ return a.substr(0, r + 1);
+}
+
+
+string const ltrim(string const & a, char const * p)
+{
+ lyx::Assert(p);
+
+ if (a.empty() || !*p)
+ return a;
+
+ string::size_type l = a.find_first_not_of(p);
+
+ if (l == string::npos)
+ return string();
+
+ return a.substr(l, string::npos);
}
vector<string> vec;
if (str.empty())
return vec;
- string keys(strip(str));
+ string keys(rtrim(str));
for(;;) {
string::size_type const idx = keys.find(delim);
if (idx == string::npos) {
- vec.push_back(frontStrip(keys));
+ vec.push_back(ltrim(keys));
break;
}
- string const key = strip(frontStrip(keys.substr(0, idx)));
+ string const key = trim(keys.substr(0, idx));
if (!key.empty())
vec.push_back(key);
string::size_type const start = idx + delim.size();
int i = 0;
for (vector<string>::const_iterator it = vec.begin();
it != vec.end(); ++it) {
- string item = strip(frontStrip(*it));
+ string item = trim(*it);
if (item.empty()) continue;
if (i++ > 0) str += delim;
string const subst(string const & a,
string const & oldstr, string const & newstr);
-/** Strips characters off the end of a string.
+/** Trims characters off the end and beginning of a string.
\code
- strip("abccc", "c") == "ab".
+ trim("ccabccc", "c") == "ab".
\endcode
*/
-string const strip(string const & a, char const * p = " ");
+string const trim(string const & a, char const * p = " ");
-/** Strips characters off the beginning of a string.
+/** Trims characters off the end of a string.
\code
- frontstrip("ababcdef", "ab") = "cdef"
+ rtrim("abccc", "c") == "ab".
\endcode
*/
-string const frontStrip(string const & a, char const * p = " ");
+string const rtrim(string const & a, char const * p = " ");
+
+/** Trims characters off the beginning of a string.
+ \code
+ ltrim("ababcdef", "ab") = "cdef"
+ \endcode
+*/
+string const ltrim(string const & a, char const * p = " ");
/** Splits the string by the first delim.
Splits the string by the first appearance of delim.
#ifdef SPECIAL_COLUM_HANDLING
if (cellinfo_of_cell(cell)->align_special.empty())
return cellinfo_of_cell(cell)->left_line;
- return prefixIs(frontStrip(cellinfo_of_cell(cell)->align_special), "|");
+ return prefixIs(ltrim(cellinfo_of_cell(cell)->align_special), "|");
#else
return cellinfo_of_cell(cell)->left_line;
#endif
#ifdef SPECIAL_COLUM_HANDLING
if (column_info[column_of_cell(cell)].align_special.empty())
return column_info[column_of_cell(cell)].left_line;
- return prefixIs(frontStrip(column_info[column_of_cell(cell)].align_special), "|");
+ return prefixIs(ltrim(column_info[column_of_cell(cell)].align_special), "|");
#else
return column_info[column_of_cell(cell)].left_line;
#endif
#ifdef SPECIAL_COLUM_HANDLING
if (cellinfo_of_cell(cell)->align_special.empty())
return cellinfo_of_cell(cell)->right_line;
- return suffixIs(strip(cellinfo_of_cell(cell)->align_special), "|");
+ return suffixIs(rtrim(cellinfo_of_cell(cell)->align_special), "|");
#else
return cellinfo_of_cell(cell)->right_line;
#endif
#ifdef SPECIAL_COLUM_HANDLING
if (column_info[column_of_cell(cell)].align_special.empty())
return column_info[right_column_of_cell(cell)].right_line;
- return suffixIs(strip(column_info[column_of_cell(cell)].align_special), "|");
+ return suffixIs(rtrim(column_info[column_of_cell(cell)].align_special), "|");
#else
return column_info[right_column_of_cell(cell)].right_line;
#endif
return string(4 * depth, ' ') + str;
}
-
+
void TocItem::goTo(LyXView & lv_) const
{
string const tmp = tostr(par->id());
par->asString(buf, true));
toclist["TOC"].push_back(item);
}
-
+
// For each paragraph, traverse its insets and look for
// FLOAT_CODE
Paragraph::inset_iterator it = par->inset_iterator_begin();
if ((*it)->lyxCode() == Inset::FLOAT_CODE) {
InsetFloat * il =
static_cast<InsetFloat*>(*it);
- il->addToToc(toclist, buf);
+ il->addToToc(toclist, buf);
}
- }
+ }
par = par->next();
}
} // namespace toc
-
// get version here
string tmv;
ifs >> tmv;
- tmv = strip(tmv, ";");
+ tmv = rtrim(tmv, ";");
version_ = tmv;
lyxerr[Debug::LYXVC] << "LyXVC: version found to be "
<< tmv << endl;
string s2;
do {
ifs >> tmpt;
- s1 = strip(tmpt, ";");
+ s1 = rtrim(tmpt, ";");
// tmp is now in the format <user>:<version>
s1 = split(s1, s2, ':');
// s2 is user, and s1 is version
FileInfo fi(file_);
// FIXME: must double check file is stattable/existing
time_t mod = fi.getModificationTime();
- string mod_date = strip(asctime(gmtime(&mod)), "\n");
+ string mod_date = rtrim(asctime(gmtime(&mod)), "\n");
lyxerr[Debug::LYXVC]
<< "Date in Entries: `" << file_date
<< "'\nModification date of file: `"
inline
bool isEndOfData(string const & data)
{
- return frontStrip(data).empty();
+ return ltrim(data).empty();
}
/**
*/
char nextToken(string & data)
{
- data = frontStrip(data);
+ data = ltrim(data);
if (data.empty())
return '\0';
else if (data[0] == '+') {
if (data.empty())
return true;
- string buffer = frontStrip(data);
+ string buffer = ltrim(data);
// To make isValidGlueLength recognize negative values as
// the first number this little hack is needed:
if (data.empty())
return;
double value;
- string input = strip(data);
+ string input = rtrim(data);
string::size_type const length = input.length();