clear()->erase() ; lots of using directives for cxx

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@712 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-05-04 10:57:00 +00:00
parent 570e57d5b9
commit 3c8aba3b55
36 changed files with 93 additions and 137 deletions

View File

@ -1,3 +1,12 @@
2000-05-04 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* (various *.C files): add using std::foo directives to please dec
cxx.
* replace calls to string::clear() to string::erase() (Angus)
* src/cheaders/cmath: modified to provide std::abs.
2000-05-04 Juergen Vigna <jug@sad.it>
* src/insets/insettext.C: Prepared all for inserting of multiple

View File

@ -27,7 +27,7 @@
class Bullet {
public:
///
Bullet(int f = -1, int c = -1, int s = -1);
Bullet(const int f = -1, const int c = -1, const int s = -1);
///
explicit Bullet(string const &);

View File

@ -32,6 +32,7 @@
#include "gettext.h"
using std::ifstream;
using std::getline;
/*
* CLASS Chktex

View File

@ -19,6 +19,7 @@
#include <fstream>
using std::ifstream;
using std::getline;
#include "ImportNoweb.h"
#include "lyxrc.h"

View File

@ -33,6 +33,7 @@
#include "gettext.h"
using std::ifstream;
using std::getline;
using std::endl;
// TODO: in no particular order

View File

@ -29,6 +29,7 @@
#include "gettext.h"
using std::ifstream;
using std::getline;
using std::endl;
extern BufferList bufferlist;

View File

@ -83,13 +83,10 @@ string Spacing::writeEnvirBegin() const
case Default: break; // do nothing
case Single:
return "\\begin{singlespace}";
break;
case Onehalf:
return "\\begin{onehalfspace}";
break;
case Double:
return "\\begin{doublespace}";
break;
case Other:
#ifdef HAVE_SSTREAM
ostringstream ost;
@ -105,7 +102,6 @@ string Spacing::writeEnvirBegin() const
return ost.str();
}
#endif
break;
}
return string();
}
@ -117,16 +113,12 @@ string Spacing::writeEnvirEnd() const
case Default: break; // do nothing
case Single:
return "\\end{singlespace}";
break;
case Onehalf:
return "\\end{onehalfspace}";
break;
case Double:
return "\\end{doublespace}";
break;
case Other:
return "\\end{spacing}";
break;
}
return string();
}

View File

@ -24,7 +24,7 @@ using std::endl;
FL_OBJECT * figinset_canvas;
// need to make the c++ compiler fint the correct version of abs.
// need to make the c++ compiler find the correct version of abs.
// This is at least true for g++.
using std::abs;
@ -65,7 +65,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
<< width << 'x' << height << endl;
//
FL_OBJECT * obj;
const int bw = int(abs(float(fl_get_border_width())));
const int bw = int(std::abs(float(fl_get_border_width())));
// We really want to get rid of figinset_canvas.
::figinset_canvas = figinset_canvas = obj =
@ -162,7 +162,7 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
{
fl_freeze_all_forms();
const int bw = int(abs(float(fl_get_border_width())));
const int bw = int(std::abs(float(fl_get_border_width())));
// a box
fl_set_object_geometry(backgroundbox, xpos, ypos, width - 15, height);

View File

@ -125,7 +125,7 @@ Buffer::Buffer(string const & file, bool ronly)
lyxvc.buffer(this);
if (read_only || (lyxrc.use_tempdir)) {
tmppath = CreateBufferTmpDir();
} else tmppath.clear();
} else tmppath.erase();
}
@ -2278,7 +2278,7 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
// environment tag closing
for( ; depth > par->depth; --depth) {
sgmlCloseTag(ofs, depth, environment_stack[depth]);
environment_stack[depth].clear();
environment_stack[depth].erase();
}
// write opening SGML tags
@ -2287,7 +2287,7 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
if(depth == par->depth
&& !environment_stack[depth].empty()) {
sgmlCloseTag(ofs, depth, environment_stack[depth]);
environment_stack[depth].clear();
environment_stack[depth].erase();
if(depth)
--depth;
else
@ -2308,7 +2308,7 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
ofs << "</p>";
}
environment_stack[depth].clear();
environment_stack[depth].erase();
sgmlOpenTag(ofs, depth, style.latexname());
break;
@ -2320,11 +2320,11 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
sgmlCloseTag(ofs, depth,
environment_stack[depth]);
environment_stack[depth].clear();
environment_stack[depth].erase();
}
if (depth < par->depth) {
depth = par->depth;
environment_stack[depth].clear();
environment_stack[depth].erase();
}
if (environment_stack[depth] != style.latexname()) {
if(depth == 0) {
@ -2448,7 +2448,7 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
if(inner_span) {
if(!tmp_par.empty()) {
os << tmp_par;
tmp_par.clear();
tmp_par.erase();
sgmlCloseTag(os, depth + 1, inner_tag);
sgmlOpenTag(os, depth + 1, inner_tag);
}
@ -2461,7 +2461,7 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
inner_tag);
if(!extra_par.empty()) os << extra_par;
if(!tag.empty()) sgmlCloseTag(os, depth, tag);
extra_par.clear();
extra_par.erase();
switch (par->footnotekind) {
case LyXParagraph::FOOTNOTE:
@ -2496,7 +2496,7 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
if ((present == TAB_LIKE) || (present == FIG_LIKE)) {
DocBookHandleCaption(os, inner_tag, depth,
desc_on, par);
inner_tag.clear();
inner_tag.erase();
} else {
sgmlOpenTag(os, depth + 1, inner_tag);
}
@ -2873,8 +2873,8 @@ void Buffer::makeDocBookFile(string const & fname, int column)
}
sgmlCloseTag(ofs, depth + command_depth,
environment_stack[depth]);
environment_stack[depth].clear();
environment_inner[depth].clear();
environment_stack[depth].erase();
environment_inner[depth].erase();
}
if(depth == par->depth
@ -2893,8 +2893,8 @@ void Buffer::makeDocBookFile(string const & fname, int column)
sgmlCloseTag(ofs, depth + command_depth,
environment_stack[depth]);
environment_stack[depth].clear();
environment_inner[depth].clear();
environment_stack[depth].erase();
environment_inner[depth].erase();
}
// Write opening SGML tags.
@ -2965,7 +2965,7 @@ void Buffer::makeDocBookFile(string const & fname, int column)
case LATEX_ITEM_ENVIRONMENT:
if (depth < par->depth) {
depth = par->depth;
environment_stack[depth].clear();
environment_stack[depth].erase();
}
if (environment_stack[depth] != style.latexname()) {

View File

@ -157,7 +157,7 @@ public:
// LaTeX all paragraphs from par to endpar,
// if endpar == 0 then to the end
//
void latexParagraphs(ostream & os, LyXParagraph *par,
void latexParagraphs(std::ostream & os, LyXParagraph *par,
LyXParagraph *endpar, TexRow & texrow);
///

View File

@ -1,80 +1,19 @@
// The -*- C++ -*- math functions header.
// This file is part of the GNU ANSI C++ Library.
// Modified for use with LyX.
#ifndef __CMATH__
#define __CMATH__
#ifdef __GNUG__
#include <_G_config.h>
#endif
#include <math.h>
#ifdef __GNUG__
#pragma interface "cmath"
#endif
extern "C++" {
#if 0
float acos (float);
float asin (float);
float atan (float);
float atan2(float, float);
float ceil (float);
float cos (float);
float cosh (float);
float exp (float);
float fabs (float);
float floor(float);
float fmod (float, float);
float frexp(float, int*);
float modf (float, float*);
float ldexp(float, int);
float log (float);
float log10(float);
float pow (float, float);
float pow (float, int);
float sin (float);
float sinh (float);
float sqrt (float);
float tan (float);
float tanh (float);
#endif
inline float abs (float x) { return fabs (x); }
#if ! _G_MATH_H_INLINES /* hpux and SCO define this in math.h */
inline double abs (double x) { return fabs (x); }
#endif
#if 0
double pow(double, int);
long double acos (long double);
long double asin (long double);
long double atan (long double);
long double atan2(long double, long double);
long double ceil (long double);
long double cos (long double);
long double cosh (long double);
long double exp (long double);
long double fabs (long double);
long double floor(long double);
long double frexp(long double, int*);
long double fmod (long double, long double);
long double frexp(long double, int*);
long double log (long double);
long double log10(long double);
long double modf (long double, long double*);
long double pow (long double, long double);
long double pow (long double, int);
long double sin (long double);
long double sinh (long double);
long double sqrt (long double);
long double tan (long double);
long double tanh (long double);
#endif
inline long double abs (long double x) { return fabs (x); }
} // extern "C++"
namespace std {
inline float abs (float x) { return fabs (x); }
inline double abs (double x) { return fabs (x); }
}
#endif

View File

@ -13,6 +13,7 @@
#include "debug.h"
using std::ifstream;
using std::getline;
using std::pair;
using std::make_pair;
using std::endl;
@ -20,7 +21,7 @@ using std::endl;
bool CharacterSet::loadFile(string const & fname)
{
map_.clear();
name_.clear();
name_.erase();
if (fname.empty() || fname == "ascii")
return true; // ascii 7-bit

View File

@ -421,7 +421,7 @@ void LyXFileDlg::SetButton(int iIndex, string const & pszName,
*pTemp = pszPath;
} else {
fl_hide_object(pObject);
(*pTemp).clear();
(*pTemp).erase();
}
}
@ -579,7 +579,7 @@ bool LyXFileDlg::HandleDoubleClick()
Temp += pszTemp;
} else {
// Directory higher up
Temp.clear();
Temp.erase();
for (int i = 0; i < iSelect; ++i) {
string piece = fl_get_browser_line(pFileDlgForm->List, i+1);
// The '+2' is here to count the '@b' (JMarc)

View File

@ -1768,7 +1768,7 @@ void InsetFig::CallbackFig(long arg)
} else {
if (!fname.empty()) {
changedfname = true;
fname.clear();
fname.erase();
}
}
subcaption = fl_get_input(form->Subcaption);

View File

@ -2,6 +2,7 @@
#include <fstream>
using std::ifstream;
using std::getline;
#include <cstdlib>

View File

@ -21,6 +21,7 @@
#include "support/LOstream.h"
using std::ostream;
using std::endl;
InsetFoot::InsetFoot(Buffer * bf)
: InsetCollapsable(bf)

View File

@ -792,7 +792,7 @@ InsetText::LocalDispatch(BufferView * bv,
// and current buffer's textclass (number). */
LyXTextClassList::ClassList::size_type tclass =
buffer->params.textclass;
pair <bool, LyXTextClass::size_type> layout =
std::pair <bool, LyXTextClass::size_type> layout =
textclasslist.NumberOfLayout(tclass, arg);
// If the entry is obsolete, use the new one instead.

View File

@ -23,6 +23,7 @@
#include "debug.h"
using std::ifstream;
using std::getline;
using std::ofstream;
using std::copy;
using std::ostream_iterator;

View File

@ -248,7 +248,7 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
lyxerr[Debug::INIT]
<< "Checking whether LyX is run in place... no"
<< endl;
build_lyxdir.clear();
build_lyxdir.erase();
}
bool FollowLink;

View File

@ -457,7 +457,7 @@ string LyXFunc::Dispatch(int ac,
// we have not done anything wrong yet.
errorstat = false;
dispatch_buffer.clear();
dispatch_buffer.erase();
// if action is a pseudo-action, we need the real action
if (lyxaction.isPseudoAction(ac)) {
@ -481,7 +481,7 @@ string LyXFunc::Dispatch(int ac,
if (getStatus(action) & Disabled)
goto exit_with_message;
commandshortcut.clear();
commandshortcut.erase();
if (lyxrc.display_shortcuts && show_sc) {
if (action != LFUN_SELFINSERT) {

View File

@ -120,7 +120,7 @@ void LyXComm::openConnection() {
lyxerr << "LyXComm: Pipe " << tmp << " already exists.\n"
<< "If no other LyX program is active, please delete"
" the pipe by hand and try again." << endl;
pipename.clear();
pipename.erase();
return;
}
#ifndef __EMX__
@ -171,7 +171,7 @@ void LyXComm::openConnection() {
lyxerr << "LyXComm: Pipe " << tmp << " already exists.\n"
<< "If no other LyX program is active, please delete"
" the pipe by hand and try again." << endl;
pipename.clear();
pipename.erase();
return;
}
#ifndef __EMX__
@ -343,7 +343,7 @@ void LyXComm::callback(int fd, void *v)
{
lyxerr << "LyxComm: truncated command: "
<< lsbuf << endl;
lsbuf.clear();
lsbuf.erase();
}
break; // reset connection
}
@ -498,7 +498,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
}
if (i < serv->numclients) {
serv->numclients--;
serv->clients[i].clear();
serv->clients[i].erase();
lyxerr[Debug::LYXSERVER]
<< "LyXServer: Client "
<< client << " said goodbye"

View File

@ -588,7 +588,7 @@ void InsetFormula::display(bool dspf)
par->SetType(LM_OT_MIN);
par->SetStyle(LM_ST_TEXT);
if (!label.empty() && par->GetType() != LM_OT_MPARN) {
label.clear();
label.erase();
}
}
disp_flag = dspf;
@ -904,7 +904,7 @@ InsetFormula::LocalDispatch(BufferView * bv,
if (oldf) {
--type;
if (!label.empty()) {
label.clear();
label.erase();
}
bv->owner()->getMiniBuffer()->Set(_("No number"));
} else {
@ -1058,7 +1058,7 @@ InsetFormula::LocalDispatch(BufferView * bv,
}
UpdateLocal(bv);
} else
label.clear();
label.erase();
break;
}

View File

@ -41,6 +41,7 @@
using std::max;
using std::endl;
using std::ostream;
extern short greek_kb_flag;

View File

@ -140,7 +140,7 @@ extern "C" int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event,
void MiniBuffer::ExecCommand()
{
text.clear();
text.erase();
fl_set_input(the_buffer, "");
fl_set_focus_object(owner->getForm(), the_buffer);
}
@ -253,7 +253,7 @@ void MiniBuffer::Reset()
{
if (!text_stored.empty()){
Set(text_stored);
text_stored.clear();
text_stored.erase();
}
}

View File

@ -38,6 +38,8 @@ using std::ostream;
using std::endl;
using std::fstream;
using std::ios;
using std::lower_bound;
using std::upper_bound;
int tex_code_break_column = 72; // needs non-zero initialization. set later.
// this is a bad idea, but how can LyXParagraph find its buffer to get
@ -479,14 +481,14 @@ void LyXParagraph::Clear()
noindent = false;
pextra_type = PEXTRA_NONE;
pextra_width.clear();
pextra_widthp.clear();
pextra_width.erase();
pextra_widthp.erase();
pextra_alignment = MINIPAGE_ALIGN_TOP;
pextra_hfill = false;
pextra_start_minipage = false;
labelstring.clear();
labelwidthstring.clear();
labelstring.erase();
labelwidthstring.erase();
layout = 0;
bibkey = 0;
@ -1770,7 +1772,7 @@ void LyXParagraph::SetLayout(LyXTextClass::size_type new_layout)
* npar = 0;
par->layout = new_layout;
par->labelwidthstring.clear();
par->labelwidthstring.erase();
par->align = LYX_ALIGN_LAYOUT;
par->added_space_top = VSpace(VSpace::NONE);
par->added_space_bottom = VSpace(VSpace::NONE);
@ -2683,7 +2685,7 @@ bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
bool retval = false;
switch (c) {
case LyXParagraph::META_HFILL:
sgml_string.clear();
sgml_string.erase();
break;
case LyXParagraph::META_NEWLINE:
sgml_string = '\n';
@ -2732,7 +2734,7 @@ bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
sgml_string = ' ';
break;
case '\0': // Ignore :-)
sgml_string.clear();
sgml_string.erase();
break;
default:
sgml_string = c;
@ -4086,8 +4088,8 @@ void LyXParagraph::UnsetPExtraType()
return;
pextra_type = PEXTRA_NONE;
pextra_width.clear();
pextra_widthp.clear();
pextra_width.erase();
pextra_widthp.erase();
if (textclasslist.Style(current_view->buffer()->params.textclass,
layout).isEnvironment()) {
@ -4111,8 +4113,8 @@ void LyXParagraph::UnsetPExtraType()
while (par && (par->layout == layout)
&& (par->depth == depth)) {
par->pextra_type = PEXTRA_NONE;
par->pextra_width.clear();
par->pextra_widthp.clear();
par->pextra_width.erase();
par->pextra_widthp.erase();
par = par->NextAfterFootnote();
if (par && (par->depth > depth))
par->UnsetPExtraType();

View File

@ -51,7 +51,7 @@
#include "debug.h"
#include "support/lstrings.h"
using std::reverse;
using std::endl;
// Spellchecker status

View File

@ -748,7 +748,7 @@ string ReplaceEnvironmentPath(string const & path)
if (!regexMatch(copy1, RegExp)) {
// No EndChar inside. So we are finished
result1 += CompareString + result0;
result0.clear();
result0.erase();
continue;
}

View File

@ -289,7 +289,7 @@ string strip(string const & a, char const c)
if (i != string::npos)
tmp.erase(i + 1, string::npos);
else
tmp.clear(); // only c in the whole string
tmp.erase(); // only c in the whole string
return tmp;
}
@ -326,7 +326,7 @@ string split(string const & a, string & piece, char delim)
piece = a.substr(0, i);
tmp = a.substr(i + 1);
} else if (i == 0) {
piece.clear();
piece.erase();
tmp = a.substr(i + 1);
} else {
piece = a;
@ -354,7 +354,7 @@ string rsplit(string const & a, string & piece, char delim)
piece = a.substr(0, i);
tmp = a.substr(i + 1);
} else { // delimter was not found
piece.clear();
piece.erase();
}
return tmp;
}

View File

@ -29,6 +29,7 @@
using std::ostream;
using std::istream;
using std::getline;
using std::max;
using std::endl;

View File

@ -284,6 +284,8 @@ private: //////////////////////////////////////////////////////////////////
///
cellstruct & operator=(cellstruct const &);
///
void setBuffer(Buffer * buf);
///
int cellno;
///
int width_of_cell;

View File

@ -28,6 +28,7 @@
using std::ostream;
using std::istream;
using std::getline;
using std::max;
using std::endl;
@ -963,7 +964,7 @@ static bool getTokenValue(string const str, const char * token, string & ret)
if ((pos < 0) || (ch != '='))
return false;
ret.clear();
ret.erase();
pos += strlen(token)+1;
ch = str[pos];
if ((ch != '"') && (ch != '\'')) { // only read till next space
@ -984,7 +985,7 @@ static bool getTokenValue(string const str, const char * token, int & num)
if ((pos < 0) || (ch != '='))
return false;
ret.clear();
ret.erase();
pos += strlen(token)+1;
ch = str[pos];
if ((ch != '"') && (ch != '\'')) { // only read till next space
@ -1008,7 +1009,7 @@ static bool getTokenValue(string const str, const char * token, bool & flag)
if ((pos < 0) || (ch != '='))
return false;
ret.clear();
ret.erase();
pos += strlen(token)+1;
ch = str[pos];
if ((ch != '"') && (ch != '\'')) { // only read till next space

View File

@ -571,7 +571,7 @@ int LyXText::LeftMargin(Row const * row) const
/* table stuff -- begin */
if (row->par->table)
parindent.clear();
parindent.erase();
/* table stuff -- end */
int x = LYX_PAPER_MARGIN;
@ -603,7 +603,7 @@ int LyXText::LeftMargin(Row const * row) const
textclasslist.Style(buffer->params.textclass,
newpar->GetLayout())
.nextnoindent)
parindent.clear();
parindent.erase();
}
}
} else {
@ -632,7 +632,7 @@ int LyXText::LeftMargin(Row const * row) const
if (newpar && !row->par->GetLayout()) {
if (newpar->FirstPhysicalPar()->noindent)
parindent.clear();
parindent.erase();
else
parindent = textclasslist
.Style(buffer->params.textclass,

View File

@ -1575,7 +1575,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
}
if (!par->labelstring.empty()) {
par->labelstring.clear();
par->labelstring.erase();
}
if (layout.margintype == MARGIN_MANUAL) {
@ -1598,12 +1598,12 @@ void LyXText::SetCounter(LyXParagraph * par) const
if (!layout.labelstring().empty())
par->labelstring = layout.labelstring();
else
par->labelstring.clear();
par->labelstring.erase();
} else {
if (!layout.labelstring_appendix().empty())
par->labelstring = layout.labelstring_appendix();
else
par->labelstring.clear();
par->labelstring.erase();
}
#ifdef HAVE_SSTREAM

View File

@ -371,7 +371,7 @@ int Trans::Load(string const & language)
if (res == 0) {
name_ = language;
} else
name_.clear();
name_.erase();
return res;
}

View File

@ -340,7 +340,7 @@ void TransManager::deadkey(char c, tex_accent accent, LyXText * t)
KmodInfo i;
i.accent = accent;
i.allowed = lyx_accent_table[accent].native;
i.data.clear();
i.data.erase();
i.exception_list = 0;
string res = trans_fsm_.currentState->deadkey(c, i);

View File

@ -18,6 +18,7 @@
using std::endl;
using std::ifstream;
using std::getline;
int VCS::doVCCommand(string const & cmd, string const & path)
{