mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
remove some unneeded version of functions from lstrings,
some gcc 3.2. minor compile fixes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4800 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4d51fc96b4
commit
e39935204d
@ -1,3 +1,7 @@
|
||||
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* lyxinclude.m4 (LYX_PROG_CXX): remove the double -Winline
|
||||
|
||||
2002-07-17 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* lyxinclude.m4 (LYX_SCO):
|
||||
|
@ -211,7 +211,7 @@ if test x$GXX = xyes; then
|
||||
2.96*) CXXFLAGS="$lyx_opt -fno-exceptions -Wno-non-template-friend";;
|
||||
3.0*) CXXFLAGS="$lyx_opt";;
|
||||
3.1*) CXXFLAGS="$lyx_opt -finline-limit=500 -fno-exceptions";;
|
||||
3.2*) CXXFLAGS="$lyx_opt";;
|
||||
3.2*) CXXFLAGS="$lyx_opt -fno-exceptions";;
|
||||
*) CXXFLAGS="$lyx_opt";;
|
||||
esac
|
||||
if test x$enable_debug = xyes ; then
|
||||
@ -222,7 +222,7 @@ if test x$GXX = xyes; then
|
||||
case $gxx_version in
|
||||
2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall";;
|
||||
2.96*) CXXFLAGS="$CXXFLAGS -W -Wall";;
|
||||
3.1*) CXXFLAGS="$CXXFLAGS -W -Wall -Winline";;
|
||||
3.1*) CXXFLAGS="$CXXFLAGS -W -Wall";;
|
||||
*) CXXFLAGS="$CXXFLAGS -W -Wall";;
|
||||
esac
|
||||
if test $lyx_devel_version = yes ; then
|
||||
|
@ -8,7 +8,6 @@ src/converter.C
|
||||
src/CutAndPaste.C
|
||||
src/debug.C
|
||||
src/exporter.C
|
||||
src/ext_l10n.h
|
||||
src/FloatList.C
|
||||
src/frontends/controllers/biblio.C
|
||||
src/frontends/controllers/ButtonController.h
|
||||
|
@ -77,6 +77,7 @@
|
||||
#include "support/lyxfunctional.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/signals/connection.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
|
@ -133,11 +133,12 @@ private:
|
||||
*/
|
||||
Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
|
||||
/**
|
||||
* check if the given co-ordinates are inside an inset at the given cursor,
|
||||
* if one exists. If so, the inset is returned, and the co-ordinates are
|
||||
* made relative. Otherwise, 0 is returned.
|
||||
* check if the given co-ordinates are inside an inset at the
|
||||
* given cursor, if one exists. If so, the inset is returned,
|
||||
* and the co-ordinates are made relative. Otherwise, 0 is returned.
|
||||
*/
|
||||
Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
|
||||
Inset * checkInset(LyXText const & text, LyXCursor const & cursor,
|
||||
int & x, int & y) const;
|
||||
///
|
||||
friend class BufferView;
|
||||
/// open and lock an updatable inset
|
||||
|
@ -1,3 +1,19 @@
|
||||
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* PrinterParams.h: remove extern containsOnly, and include
|
||||
support/lstrings.h instead.
|
||||
|
||||
* LaTeX.C (scanAuxFile): modify because of strip changes
|
||||
(deplog): ditto
|
||||
* buffer.C (makeLaTeXFile): ditto
|
||||
* bufferparams.C (writeFile): ditt
|
||||
* lyxfont.C (stateText): ditto
|
||||
* lyxserver.C (read_ready): ditto
|
||||
* vc-backend.C (scanMaster): ditto
|
||||
|
||||
* BufferView_pimpl.h: ws changes
|
||||
|
||||
* BufferView_pimpl.C: inlude boost/signals/connection.hpp
|
||||
|
||||
2002-07-26 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -430,7 +430,7 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
|
||||
regex reg4("\\\\@input\\{([^}]+)\\}");
|
||||
|
||||
while (getline(ifs, token)) {
|
||||
token = strip(token, '\r');
|
||||
token = strip(token, "\r");
|
||||
smatch sub;
|
||||
if (regex_match(token, sub, reg1)) {
|
||||
string data = sub[1];
|
||||
@ -679,7 +679,7 @@ void LaTeX::deplog(DepTable & head)
|
||||
string foundfile;
|
||||
string token;
|
||||
getline(ifs, token);
|
||||
token = strip(token, '\r');
|
||||
token = strip(token, "\r");
|
||||
if (token.empty()) continue;
|
||||
|
||||
smatch sub;
|
||||
|
@ -18,8 +18,8 @@
|
||||
#include "lyxrc.h"
|
||||
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
#include "support/lstrings.h"
|
||||
#include "support/LAssert.h"
|
||||
extern bool containsOnly(string const &, char const *);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -2338,7 +2338,7 @@ void Buffer::makeLaTeXFile(ostream & os,
|
||||
|
||||
string strOptions(options.str().c_str());
|
||||
if (!strOptions.empty()) {
|
||||
strOptions = strip(strOptions, ',');
|
||||
strOptions = strip(strOptions, ",");
|
||||
os << '[' << strOptions << ']';
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ void BufferParams::writeFile(ostream & os) const
|
||||
// then the the preamble
|
||||
if (!preamble.empty()) {
|
||||
// remove '\n' from the end of preamble
|
||||
string const tmppreamble = strip(preamble, '\n');
|
||||
string const tmppreamble = strip(preamble, "\n");
|
||||
os << "\\begin_preamble\n"
|
||||
<< tmppreamble
|
||||
<< "\n\\end_preamble\n";
|
||||
|
@ -1,3 +1,7 @@
|
||||
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* biblio.C (parseBibTeX): modify because of strip changes
|
||||
|
||||
2002-07-24 Juergen Spitzmueller <j.spitzmueller@gmx.de>
|
||||
|
||||
* ControlFloat.[Ch]: Implement Wide Float toggle
|
||||
|
@ -451,10 +451,10 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
|
||||
// Clean-up.
|
||||
// 1. Spaces
|
||||
data = strip(data, ' ');
|
||||
data = strip(data);
|
||||
// 2. if there is no opening '{' then a closing '{' is probably cruft.
|
||||
if (!contains(data, '{'))
|
||||
data = strip(data, '}');
|
||||
data = strip(data, "}");
|
||||
// happens, when last keyword
|
||||
string::size_type const idx =
|
||||
!data.empty() ? data.find('=') : string::npos;
|
||||
@ -469,7 +469,7 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
return string();
|
||||
} else {
|
||||
// delete '=' and the following spaces
|
||||
data = frontStrip(frontStrip(data,'='));
|
||||
data = frontStrip(frontStrip(data, "="));
|
||||
if (data.length() < 2) {
|
||||
return data; // not long enough to find delimiters
|
||||
} else {
|
||||
@ -482,7 +482,7 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
} else {
|
||||
// no {} and no "", pure data but with a
|
||||
// possible ',' at the end
|
||||
return strip(data,',');
|
||||
return strip(data, ",");
|
||||
}
|
||||
string tmp = data.substr(keypos);
|
||||
while (tmp.find('{') != string::npos &&
|
||||
|
@ -679,8 +679,8 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
||||
setEnabled(lyxview_->check_lyxaspectratio, 1);
|
||||
setEnabled(lyxview_->input_lyxscale, 0);
|
||||
} else if (ob == lyxview_->button_latex_values) {
|
||||
if (contains(fl_get_choice_text(size_->choice_width),'%') ||
|
||||
contains(fl_get_choice_text(size_->choice_height),'%'))
|
||||
if (contains(fl_get_choice_text(size_->choice_width), '%') ||
|
||||
contains(fl_get_choice_text(size_->choice_height), '%'))
|
||||
Alert::alert(_("Warning!"),
|
||||
_("The %-units are not allowed here."),
|
||||
_("Cannot use the values from LaTeX size!"));
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* PreviewLoader.C (setAscentFractions): modify because of strip
|
||||
changes
|
||||
|
||||
2002-07-22 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* GraphicsConverter.C (build_script): take a ostream as a more
|
||||
|
@ -737,7 +737,7 @@ void setAscentFractions(vector<double> & ascent_fractions,
|
||||
|
||||
if (!ifs.good() ||
|
||||
page != "%%Page" ||
|
||||
!isStrUnsignedInt(strip(page_id, ':'))) {
|
||||
!isStrUnsignedInt(strip(page_id, ":"))) {
|
||||
lyxerr[Debug::GRAPHICS] << "setAscentFractions("
|
||||
<< metrics_file << ")\n"
|
||||
<< "Error reading file!"
|
||||
|
@ -1,3 +1,9 @@
|
||||
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* insetbib.C (latex): modify because of strip changes
|
||||
(getKeys): ditto
|
||||
* insetnote.C (InsetNote): ditto
|
||||
|
||||
2002-07-26 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettabular.C (searchForward): check for lastcell if we
|
||||
|
@ -152,10 +152,10 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
|
||||
// Style-Options
|
||||
string style = getOptions(); // maybe empty! and with bibtotoc
|
||||
string bibtotoc;
|
||||
if (prefixIs(style,"bibtotoc")) {
|
||||
if (prefixIs(style, "bibtotoc")) {
|
||||
bibtotoc = "bibtotoc";
|
||||
if (contains(style,',')) {
|
||||
style = split(style,bibtotoc,',');
|
||||
if (contains(style, ',')) {
|
||||
style = split(style, bibtotoc, ',');
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
|
||||
db_out += ',';
|
||||
db_in= split(db_in, adb,',');
|
||||
}
|
||||
db_out = strip(db_out, ',');
|
||||
db_out = strip(db_out, ",");
|
||||
os << "\\bibliography{" << db_out << "}\n";
|
||||
return 2;
|
||||
}
|
||||
@ -264,7 +264,7 @@ vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer)
|
||||
&& !prefixIs(tmp, "@preamble")) {
|
||||
linebuf = split(linebuf, tmp, ',');
|
||||
tmp = frontStrip(tmp);
|
||||
tmp = frontStrip(tmp,'\t');
|
||||
tmp = frontStrip(tmp,"\t");
|
||||
if (!tmp.empty()) {
|
||||
keys.push_back(pair<string,string>(tmp,string()));
|
||||
}
|
||||
|
@ -90,10 +90,10 @@ string const getNatbibLabel(Buffer const * buffer,
|
||||
|
||||
// We don't currently use the full or forceUCase fields.
|
||||
// bool const forceUCase = citeType[0] == 'C';
|
||||
bool const full = citeType[citeType.size()-1] == '*';
|
||||
bool const full = citeType[citeType.size() - 1] == '*';
|
||||
|
||||
string const cite_type = full ?
|
||||
ascii_lowercase(citeType.substr(0,citeType.size()-1)) :
|
||||
ascii_lowercase(citeType.substr(0, citeType.size() - 1)) :
|
||||
ascii_lowercase(citeType);
|
||||
|
||||
string before_str;
|
||||
@ -120,11 +120,12 @@ string const getNatbibLabel(Buffer const * buffer,
|
||||
// One day, these might be tunable (as they are in BibTeX).
|
||||
char const op = '('; // opening parenthesis.
|
||||
char const cp = ')'; // closing parenthesis.
|
||||
char const sep = ';'; // puctuation mark separating citation entries.
|
||||
// puctuation mark separating citation entries.
|
||||
char const * const sep = ";";
|
||||
|
||||
string const op_str(string(1, ' ') + string(1, op));
|
||||
string const cp_str(string(1, cp) + string(1, ' '));
|
||||
string const sep_str(string(1, sep) + string(1, ' '));
|
||||
string const sep_str(string(sep) + " ");
|
||||
|
||||
string label;
|
||||
vector<string> keys = getVectorFromString(keyList);
|
||||
@ -176,7 +177,7 @@ string const getNatbibLabel(Buffer const * buffer,
|
||||
if (!after_str.empty()) {
|
||||
if (cite_type == "citet") {
|
||||
// insert "after" before last ')'
|
||||
label.insert(label.size()-1, after_str);
|
||||
label.insert(label.size() - 1, after_str);
|
||||
} else {
|
||||
bool const add = !(numerical &&
|
||||
(cite_type == "citeauthor" ||
|
||||
@ -351,13 +352,23 @@ int InsetCitation::latex(Buffer const * buffer, ostream & os,
|
||||
else
|
||||
os << "cite";
|
||||
|
||||
#warning What is this code supposed to do? (Lgb)
|
||||
|
||||
#if 1
|
||||
// The current strange code
|
||||
|
||||
string const before = string();
|
||||
string const after = getOptions();
|
||||
if (!before.empty() && buffer->params.use_natbib)
|
||||
os << "[" << before << "][" << after << "]";
|
||||
else if (!after.empty())
|
||||
os << "[" << after << "]";
|
||||
|
||||
#else
|
||||
// and the cleaned up equvalent, should it just be changed? (Lgb)
|
||||
string const after = getOptions();
|
||||
if (!after.empty())
|
||||
os << "[" << after << "]";
|
||||
#endif
|
||||
string::const_iterator it = getContents().begin();
|
||||
string::const_iterator end = getContents().end();
|
||||
// Paranoia check: make sure that there is no whitespace in here
|
||||
|
@ -77,7 +77,7 @@ InsetNote::InsetNote(Buffer const * buf, string const & contents,
|
||||
font.setLanguage(default_language);
|
||||
|
||||
lyx::pos_type pos = 0;
|
||||
buf->insertStringAsLines(par, pos, font, strip(contents, '\n'));
|
||||
buf->insertStringAsLines(par, pos, font, strip(contents, "\n"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -571,8 +571,7 @@ string const LyXFont::stateText(BufferParams * params) const
|
||||
ost << _(" Number ") << _(GUIMiscNames[number()]);
|
||||
|
||||
string buf(ost.str().c_str());
|
||||
buf = strip(buf, ' ');
|
||||
buf = strip(buf, ',');
|
||||
buf = strip(buf, ", ");
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ void LyXComm::read_ready()
|
||||
while ((status = read(infd, charbuf, CMDBUFLEN-1))) {
|
||||
if (status > 0) {
|
||||
charbuf[status]= '\0'; // turn it into a c string
|
||||
lsbuf += strip(charbuf, '\r');
|
||||
lsbuf += strip(charbuf, "\r");
|
||||
// commit any commands read
|
||||
while (lsbuf.find('\n') != string::npos) {
|
||||
// split() grabs the entire string if
|
||||
|
@ -1,3 +1,7 @@
|
||||
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* math_nestinset.C: add using std::vector
|
||||
|
||||
2002-07-23 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* formula.C (descent): add an arbitrary 12 pixels to the descent when
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "graphics/PreviewLoader.h"
|
||||
#include "graphics/Previews.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
|
||||
MathNestInset::MathNestInset(idx_type nargs)
|
||||
: MathDimInset(), cells_(nargs), lock_(false)
|
||||
|
@ -1,3 +1,17 @@
|
||||
2002-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* filetools.C (GetEnvPath): modify because of strip changes
|
||||
(createDirectory): ditto
|
||||
(findtexfile): ditto
|
||||
* lstrings.[Ch] (isStrInt): ditto
|
||||
(isStrUnsignedInt): ditto
|
||||
(strToInt): ditto
|
||||
(strToUnsignedInt): ditto
|
||||
(isStrDbl): ditto
|
||||
(contains): removed unneeded version of contains
|
||||
(containsOnly): removed uneeded versions of containsOnly
|
||||
(strip, frontStrip): removed unneded versions, changed argument types.
|
||||
|
||||
2002-07-22 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* filetools.C (RunCommand): Made public
|
||||
|
@ -364,7 +364,7 @@ string const GetEnvPath(string const & name)
|
||||
#else
|
||||
string const pathlist = os::slashify_path(GetEnv(name));
|
||||
#endif
|
||||
return strip(pathlist, ';');
|
||||
return strip(pathlist, ";");
|
||||
}
|
||||
|
||||
|
||||
@ -564,7 +564,7 @@ int DestroyLyXTmpDir(string const & tmpdir)
|
||||
// Creates directory. Returns true if succesfull
|
||||
bool createDirectory(string const & path, int permission)
|
||||
{
|
||||
string temp(strip(os::slashify_path(path), '/'));
|
||||
string temp(strip(os::slashify_path(path), "/"));
|
||||
|
||||
if (temp.empty()) {
|
||||
Alert::alert(_("Internal error!"),
|
||||
@ -1352,10 +1352,10 @@ string const findtexfile(string const & fil, string const & /*format*/)
|
||||
cmd_ret const c = RunCommand(kpsecmd);
|
||||
|
||||
lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n"
|
||||
<< "kpse result = `" << strip(c.second, '\n')
|
||||
<< "kpse result = `" << strip(c.second, "\n")
|
||||
<< "'" << endl;
|
||||
if (c.first != -1)
|
||||
return os::internal_path(strip(strip(c.second, '\n'), '\r'));
|
||||
return os::internal_path(strip(strip(c.second, "\n"), "\r"));
|
||||
else
|
||||
return string();
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ bool isStrInt(string const & str)
|
||||
if (str.empty()) return false;
|
||||
|
||||
// Remove leading and trailing white space chars.
|
||||
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
||||
string const tmpstr = frontStrip(strip(str));
|
||||
if (tmpstr.empty()) return false;
|
||||
|
||||
string::const_iterator cit = tmpstr.begin();
|
||||
@ -138,7 +138,7 @@ bool isStrUnsignedInt(string const & str)
|
||||
if (str.empty()) return false;
|
||||
|
||||
// Remove leading and trailing white space chars.
|
||||
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
||||
string const tmpstr = frontStrip(strip(str));
|
||||
if (tmpstr.empty()) return false;
|
||||
|
||||
string::const_iterator cit = tmpstr.begin();
|
||||
@ -154,7 +154,7 @@ int strToInt(string const & str)
|
||||
{
|
||||
if (isStrInt(str)) {
|
||||
// Remove leading and trailing white space chars.
|
||||
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
||||
string const tmpstr = frontStrip(strip(str));
|
||||
// Do the conversion proper.
|
||||
return lyx::atoi(tmpstr);
|
||||
} else {
|
||||
@ -167,7 +167,7 @@ unsigned int strToUnsignedInt(string const & str)
|
||||
{
|
||||
if (isStrUnsignedInt(str)) {
|
||||
// Remove leading and trailing white space chars.
|
||||
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
||||
string const tmpstr = frontStrip(strip(str));
|
||||
// Do the conversion proper.
|
||||
return lyx::atoi(tmpstr);
|
||||
} else {
|
||||
@ -181,7 +181,7 @@ bool isStrDbl(string const & str)
|
||||
if (str.empty()) return false;
|
||||
|
||||
// Remove leading and trailing white space chars.
|
||||
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
||||
string const tmpstr = frontStrip(strip(str));
|
||||
if (tmpstr.empty()) return false;
|
||||
// if (1 < tmpstr.count('.')) return false;
|
||||
|
||||
@ -210,7 +210,7 @@ double strToDbl(string const & str)
|
||||
{
|
||||
if (isStrDbl(str)) {
|
||||
// Remove leading and trailing white space chars.
|
||||
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
||||
string const tmpstr = frontStrip(strip(str));
|
||||
// Do the conversion proper.
|
||||
return ::atof(tmpstr.c_str());
|
||||
} else {
|
||||
@ -371,22 +371,6 @@ bool suffixIs(string const & a, string const & suf)
|
||||
}
|
||||
|
||||
|
||||
bool contains(char const * a, string const & b)
|
||||
{
|
||||
lyx::Assert(a);
|
||||
string const at(a);
|
||||
return contains(at, b);
|
||||
}
|
||||
|
||||
|
||||
bool contains(string const & a, char const * b)
|
||||
{
|
||||
lyx::Assert(b);
|
||||
string const bt(b);
|
||||
return contains(a, bt);
|
||||
}
|
||||
|
||||
|
||||
bool contains(string const & a, string const & b)
|
||||
{
|
||||
if (a.empty())
|
||||
@ -403,45 +387,12 @@ bool contains(string const & a, char b)
|
||||
}
|
||||
|
||||
|
||||
bool contains(char const * a, char const * b)
|
||||
{
|
||||
lyx::Assert(a && b);
|
||||
string const at(a);
|
||||
string const bt(b);
|
||||
return contains(at, bt);
|
||||
}
|
||||
|
||||
|
||||
bool containsOnly(string const & s, char const * cset)
|
||||
{
|
||||
lyx::Assert(cset);
|
||||
|
||||
return s.find_first_not_of(cset) == string::npos;
|
||||
}
|
||||
|
||||
|
||||
bool containsOnly(string const & s, string const & cset)
|
||||
{
|
||||
return s.find_first_not_of(cset) == string::npos;
|
||||
}
|
||||
|
||||
|
||||
bool containsOnly(char const * s, char const * cset)
|
||||
{
|
||||
lyx::Assert(s && cset);
|
||||
|
||||
return string(s).find_first_not_of(cset) == string::npos;
|
||||
}
|
||||
|
||||
|
||||
bool containsOnly(char const * s, string const & cset)
|
||||
{
|
||||
lyx::Assert(s);
|
||||
|
||||
return string(s).find_first_not_of(cset) == string::npos;
|
||||
}
|
||||
|
||||
|
||||
// ale970405+lasgoutt-970425
|
||||
// rewritten to use new string (Lgb)
|
||||
string const token(string const & a, char delim, int n)
|
||||
@ -543,23 +494,26 @@ string const subst(string const & a,
|
||||
}
|
||||
|
||||
|
||||
string const strip(string const & a, char c)
|
||||
string const strip(string const & a, char const * p)
|
||||
{
|
||||
if (a.empty()) return a;
|
||||
lyx::Assert(p);
|
||||
|
||||
if (a.empty() || !*p) return a;
|
||||
string tmp(a);
|
||||
string::size_type i = tmp.find_last_not_of(c);
|
||||
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] != c) {
|
||||
else if (tmp[0] != p[0]) {
|
||||
if (a.length() == 1) return tmp;
|
||||
tmp.erase(1, string::npos);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
tmp.erase(); // only c in the whole string
|
||||
tmp.erase(); // only chars from p in the whole string
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@ -577,17 +531,6 @@ string const frontStrip(string const & a, char const * p)
|
||||
}
|
||||
|
||||
|
||||
string const frontStrip(string const & a, char c)
|
||||
{
|
||||
if (a.empty()) return a;
|
||||
string tmp(a);
|
||||
string::size_type i = tmp.find_first_not_of(c);
|
||||
if (i > 0)
|
||||
tmp.erase(0, i);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
string const split(string const & a, string & piece, char delim)
|
||||
{
|
||||
string tmp;
|
||||
|
@ -16,9 +16,6 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
//#include <cstring>
|
||||
//#include <cctype>
|
||||
//#include <cctype>
|
||||
#include <vector>
|
||||
|
||||
#include "Lsstream.h"
|
||||
@ -134,21 +131,12 @@ bool suffixIs(string const &, char const *);
|
||||
/// Does the string end with this suffix?
|
||||
bool suffixIs(string const &, string const &);
|
||||
|
||||
///
|
||||
bool contains(char const * a, string const & b);
|
||||
|
||||
///
|
||||
bool contains(string const & a, char const * b);
|
||||
|
||||
///
|
||||
bool contains(string const & a, string const & b);
|
||||
|
||||
///
|
||||
bool contains(string const & a, char b);
|
||||
|
||||
///
|
||||
bool contains(char const * a, char const * b);
|
||||
|
||||
/// This should probably we rewritten to be more general.
|
||||
class contains_functor {
|
||||
public:
|
||||
@ -162,18 +150,9 @@ public:
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
bool containsOnly(string const &, char const *);
|
||||
|
||||
///
|
||||
bool containsOnly(string const &, string const &);
|
||||
|
||||
///
|
||||
bool containsOnly(char const *, char const *);
|
||||
|
||||
///
|
||||
bool containsOnly(char const *, string const &);
|
||||
|
||||
/** Extracts a token from this string at the nth delim.
|
||||
Doesn't modify the original string. Similar to strtok.
|
||||
Example:
|
||||
@ -215,24 +194,17 @@ string const subst(string const & a,
|
||||
|
||||
/** Strips characters off the end of a string.
|
||||
\code
|
||||
"abccc".strip('c') = "ab".
|
||||
strip("abccc", "c") == "ab".
|
||||
\endcode
|
||||
*/
|
||||
string const strip(string const & a, char c = ' ');
|
||||
|
||||
/** Strips characters of the beginning of a string.
|
||||
\code
|
||||
"cccba".frontstrip('c') = "ba"
|
||||
\endcode
|
||||
*/
|
||||
string const frontStrip(string const & a, char c = ' ');
|
||||
string const strip(string const & a, char const * p = " ");
|
||||
|
||||
/** Strips characters off the beginning of a string.
|
||||
\code
|
||||
"ababcdef".frontstrip("ab") = "cdef"
|
||||
frontstrip("ababcdef", "ab") = "cdef"
|
||||
\endcode
|
||||
*/
|
||||
string const frontStrip(string const & a, char const * p);
|
||||
string const frontStrip(string const & a, char const * p = " ");
|
||||
|
||||
/** Splits the string by the first delim.
|
||||
Splits the string by the first appearance of delim.
|
||||
|
@ -107,7 +107,7 @@ void RCS::scanMaster()
|
||||
// get version here
|
||||
string tmv;
|
||||
ifs >> tmv;
|
||||
tmv = strip(tmv, ';');
|
||||
tmv = strip(tmv, ";");
|
||||
version_ = tmv;
|
||||
lyxerr[Debug::LYXVC] << "LyXVC: version found to be "
|
||||
<< tmv << endl;
|
||||
@ -127,7 +127,7 @@ void RCS::scanMaster()
|
||||
string s2;
|
||||
do {
|
||||
ifs >> tmpt;
|
||||
s1 = strip(tmpt, ';');
|
||||
s1 = strip(tmpt, ";");
|
||||
// tmp is now in the format <user>:<version>
|
||||
s1 = split(s1, s2, ':');
|
||||
// s2 is user, and s1 is version
|
||||
@ -265,7 +265,7 @@ void CVS::scanMaster()
|
||||
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 = strip(asctime(gmtime(&mod)), "\n");
|
||||
lyxerr[Debug::LYXVC]
|
||||
<< "Date in Entries: `" << file_date
|
||||
<< "'\nModification date of file: `"
|
||||
|
Loading…
Reference in New Issue
Block a user