git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5573 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-11-04 02:12:42 +00:00
parent dd9b8de435
commit 6a1167adab
60 changed files with 413 additions and 246 deletions

View File

@ -52,13 +52,14 @@ src/frontends/qt2/QGraphics.C
src/frontends/qt2/QInclude.C
src/frontends/qt2/QIndex.C
src/frontends/qt2/QLog.C
src/frontends/qt2/QLPrintDialog.C
src/frontends/qt2/QMathDialog.C
src/frontends/qt2/QMathMatrixDialog.C
src/frontends/qt2/QMinipage.C
src/frontends/qt2/QParagraph.C
src/frontends/qt2/QPreamble.C
src/frontends/qt2/QPreambleDialog.C
src/frontends/qt2/QPrint.C
src/frontends/qt2/QPrintDialog.C
src/frontends/qt2/QRef.C
src/frontends/qt2/QSearch.C
src/frontends/qt2/QSendto.C
@ -107,6 +108,7 @@ src/frontends/xforms/FormPrint.C
src/frontends/xforms/FormRef.C
src/frontends/xforms/FormSearch.C
src/frontends/xforms/FormSendto.C
src/frontends/xforms/FormShowFile.C
src/frontends/xforms/FormSpellchecker.C
src/frontends/xforms/FormTabular.C
src/frontends/xforms/FormTabularCreate.C

View File

@ -638,7 +638,7 @@ void BufferView::Pimpl::savePosition(unsigned int i)
if (i > 0) {
ostringstream str;
str << _("Saved bookmark") << ' ' << i;
owner_->message(str.str().c_str());
owner_->message(STRCONV(str.str()));
}
}
@ -670,7 +670,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
if (i > 0) {
ostringstream str;
str << _("Moved to bookmark") << ' ' << i;
owner_->message(str.str().c_str());
owner_->message(STRCONV(str.str()));
}
}
@ -879,18 +879,18 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
ostringstream s1;
s1 << _("Inserting document") << ' '
<< disp_fn << " ...";
owner_->message(s1.str().c_str());
owner_->message(STRCONV(s1.str()));
bool const res = bv_->insertLyXFile(filename);
if (res) {
ostringstream str;
str << _("Document") << ' ' << disp_fn
<< ' ' << _("inserted.");
owner_->message(str.str().c_str());
owner_->message(STRCONV(str.str()));
} else {
ostringstream str;
str << _("Could not insert document") << ' '
<< disp_fn;
owner_->message(str.str().c_str());
owner_->message(STRCONV(str.str()));
}
}
@ -908,7 +908,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
// e.g. Qt mouse press when no buffer
if (!buffer_)
return false;
LyXTextClass const & tclass = buffer_->params.getLyXTextClass();
switch (ev.action) {
@ -1126,7 +1126,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
inset->setLoadingBuffer(bv_->buffer(), false);
updateInset(inset, true);
}
}
break;
@ -1175,7 +1175,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
{
InsetBibtex * inset =
static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
if (inset)
if (inset)
inset->setOptions(ev.argument);
}
break;

View File

@ -1,5 +1,59 @@
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* vc-backend.C: STRCONV
(scanMaster): ditto
* text2.C (setCounter): STRCONV
* paragraph.C (asString): STRCONV
* lyxlength.C (asString): STRCONV
(asLatexString): ditto
* lyxgluelength.C (asString): STRCONV
(asLatexString): ditto
* lyxfunc.C (dispatch): STRCONV
(open): ditto
* lyxfont.C (stateText): STRCONV
* importer.C (Import): STRCONV
* counters.C (labelItem): STRCONV
(numberLabel): ditto
(numberLabel): remove unused ostringstream o
* chset.C: STRCONV
(loadFile): ditto
* bufferview_funcs.C (currentState): STRCONV
* buffer.C (readFile): STRCONV
(asciiParagraph): ditto
(makeLaTeXFile): ditto
* Spacing.C (writeEnvirBegin): STRCONV
* LaTeXFeatures.C (getLanguages): STRCONV
(getPackages): ditto
(getMacros): ditto
(getBabelOptions): ditto
(getTClassPreamble): ditto
(getLyXSGMLEntities): ditto
(getIncludedFiles): ditto
* LaTeX.C: STRCONV
(run): ditto
(scanAuxFile): ditto
(deplog): ditto
* LString.h: add the STRCONV macros
* BufferView_pimpl.C (savePosition): STRCONV
(restorePosition): ditto
(MenuInsertLyXFile): ditto
* vc-backend.C (scanMaster): change from submatch[...] to
submatch.str(...)

View File

@ -19,9 +19,12 @@
#endif
#ifndef USE_INCLUDED_STRING
#include <string>
using std::string;
#define STRCONV(STR) STR
#else
#ifdef __STRING__
#error The <string> header has been included before LString.h
#else
@ -30,5 +33,7 @@ using std::string;
#include "support/lyxstring.h"
// using lyx::string;
typedef lyxstring string;
#define STRCONV(STR) STR.c_str()
#endif
#endif

View File

@ -47,7 +47,12 @@ using std::vector;
using std::set;
using boost::regex;
using boost::regex_match;
#ifndef USE_INCLUDED_STRING
using boost::smatch;
#else
using boost::cmatch;
#endif
// TODO: in no particular order
// - get rid of the extern BufferList and the call to
@ -104,18 +109,18 @@ void LaTeX::deleteFilesOnError() const
// but the reason for the error might be in a generated file...
string ofname = OnlyFilename(file);
string const ofname = OnlyFilename(file);
// bibtex file
string bbl = ChangeExtension(ofname, ".bbl");
string const bbl = ChangeExtension(ofname, ".bbl");
lyx::unlink(bbl);
// makeindex file
string ind = ChangeExtension(ofname, ".ind");
string const ind = ChangeExtension(ofname, ".ind");
lyx::unlink(ind);
// Also remove the aux file
string aux = ChangeExtension(ofname, ".aux");
string const aux = ChangeExtension(ofname, ".aux");
lyx::unlink(aux);
}
@ -130,7 +135,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
int scanres = NO_ERRORS;
unsigned int count = 0; // number of times run
num_errors = 0; // just to make sure.
const unsigned int MAX_RUN = 6;
unsigned int const MAX_RUN = 6;
DepTable head; // empty head
bool rerun = false; // rerun requested
@ -198,7 +203,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
if (lfun) {
ostringstream str;
str << _("LaTeX run number") << ' ' << count;
lfun->dispatch(FuncRequest(LFUN_MESSAGE, str.str().c_str()));
lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
}
this->operator()();
@ -284,7 +289,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
ostringstream str;
str << _("LaTeX run number") << ' ' << count;
// check lyxstring string stream and gcc 3.1 before fixing
lfun->dispatch(FuncRequest(LFUN_MESSAGE, str.str().c_str()));
lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
}
this->operator()();
@ -340,7 +345,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
if (lfun) {
ostringstream str;
str << _("LaTeX run number") << ' ' << count;
lfun->dispatch(FuncRequest(LFUN_MESSAGE, str.str().c_str()));
lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
}
this->operator()();
@ -432,9 +437,13 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
while (getline(ifs, token)) {
token = rtrim(token, "\r");
#ifndef USE_INCLUDED_STRING
smatch sub;
if (regex_match(token, sub, reg1)) {
string data = sub.str(1);
#else
cmatch sub;
#endif
if (regex_match(STRCONV(token), sub, reg1)) {
string data = STRCONV(sub.str(1));
while (!data.empty()) {
string citation;
data = split(data, citation, ',');
@ -442,8 +451,8 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
<< citation << endl;
aux_info.citations.insert(citation);
}
} else if (regex_match(token, sub, reg2)) {
string data = sub.str(1);
} else if (regex_match(STRCONV(token), sub, reg2)) {
string data = sub.STRCONV(str(1));
// data is now all the bib files separated by ','
// get them one by one and pass them to the helper
while (!data.empty()) {
@ -454,16 +463,16 @@ void LaTeX::scanAuxFile(string const & file, Aux_Info & aux_info)
<< database << "'" << endl;
aux_info.databases.insert(database);
}
} else if (regex_match(token, sub, reg3)) {
string style = sub.str(1);
} else if (regex_match(STRCONV(token), sub, reg3)) {
string style = STRCONV(sub.str(1));
// token is now the style file
// pass it to the helper
style = ChangeExtension(style, "bst");
lyxerr[Debug::LATEX] << "Bibtex style: `"
<< style << "'" << endl;
aux_info.styles.insert(style);
} else if (regex_match(token, sub, reg4)) {
string file2 = sub.str(1);
} else if (regex_match(STRCONV(token), sub, reg4)) {
string const file2 = STRCONV(sub.str(1));
scanAuxFile(file2, aux_info);
}
}
@ -683,17 +692,21 @@ void LaTeX::deplog(DepTable & head)
token = rtrim(token, "\r");
if (token.empty()) continue;
#ifndef USE_INCLUDED_STRING
smatch sub;
if (regex_match(token, sub, reg1)) {
foundfile = sub.str(1);
} else if (regex_match(token, sub, reg2)) {
foundfile = sub.str(1);
} else if (regex_match(token, sub, reg3)) {
foundfile = sub.str(1);
} else if (regex_match(token, sub, reg4)) {
foundfile = sub.str(1);
} else if (regex_match(token, sub, reg5)) {
foundfile = sub.str(1);
#else
cmatch sub;
#endif
if (regex_match(STRCONV(token), sub, reg1)) {
foundfile = STRCONV(sub.str(1));
} else if (regex_match(STRCONV(token), sub, reg2)) {
foundfile = STRCONV(sub.str(1));
} else if (regex_match(STRCONV(token), sub, reg3)) {
foundfile = STRCONV(sub.str(1));
} else if (regex_match(STRCONV(token), sub, reg4)) {
foundfile = STRCONV(sub.str(1));
} else if (regex_match(STRCONV(token), sub, reg5)) {
foundfile = STRCONV(sub.str(1));
} else {
continue;
}
@ -726,7 +739,7 @@ void LaTeX::deplog(DepTable & head)
// (2) foundfile is in the tmpdir
// insert it into head
else if (FileInfo(OnlyFilename(foundfile)).exist()) {
if (regex_match(foundfile, unwanted)) {
if (regex_match(STRCONV(foundfile), unwanted)) {
lyxerr[Debug::DEPEND]
<< "We don't want "
<< OnlyFilename(foundfile)

View File

@ -145,7 +145,7 @@ string LaTeXFeatures::getLanguages() const
++cit)
languages << (*cit)->babel() << ',';
return languages.str().c_str();
return STRCONV(languages.str());
}
@ -289,7 +289,7 @@ string const LaTeXFeatures::getPackages() const
packages << externalPreambles;
return packages.str().c_str();
return STRCONV(packages.str());
}
@ -346,7 +346,7 @@ string const LaTeXFeatures::getMacros() const
// floats
getFloatDefinitions(macros);
return macros.str().c_str();
return STRCONV(macros.str());
}
@ -361,7 +361,7 @@ string const LaTeXFeatures::getBabelOptions() const
if (!params.language->latex_options().empty())
tmp << params.language->latex_options() << '\n';
return tmp.str().c_str();
return STRCONV(tmp.str());
}
@ -379,7 +379,7 @@ string const LaTeXFeatures::getTClassPreamble() const
tcpreamble << tclass[*cit]->preamble();
}
return tcpreamble.str().c_str();
return STRCONV(tcpreamble.str());
}
@ -392,7 +392,7 @@ string const LaTeXFeatures::getLyXSGMLEntities() const
entities << "<!ENTITY lyxarrow \"-&gt;\">" << '\n';
}
return entities.str().c_str();
return STRCONV(entities.str());
}
@ -408,7 +408,7 @@ string const LaTeXFeatures::getIncludedFiles(string const & fname) const
<< (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
<< MakeRelPath(fi->second, basename) << "\">";
return sgmlpreamble.str().c_str();
return STRCONV(sgmlpreamble.str());
}

View File

@ -92,7 +92,7 @@ string const Spacing::writeEnvirBegin() const
ostringstream ost;
ost << "\\begin{spacing}{"
<< getValue() << "}";
return ost.str().c_str();
return STRCONV(ost.str());
}
}
return string();

View File

@ -1180,7 +1180,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, Paragraph * par)
"running the conversion script."));
return false;
}
istringstream is(ret.second);
istringstream is(STRCONV(ret.second));
LyXLex tmplex(0, 0);
tmplex.setStream(is);
return readFile(tmplex, string());
@ -1588,7 +1588,7 @@ string const Buffer::asciiParagraph(Paragraph const & par,
}
}
buffer << word;
return buffer.str().c_str();
return STRCONV(buffer.str());
}
@ -1775,7 +1775,7 @@ void Buffer::makeLaTeXFile(ostream & os,
options << params.options << ',';
}
string strOptions(options.str().c_str());
string strOptions(STRCONV(options.str()));
if (!strOptions.empty()) {
strOptions = rtrim(strOptions, ",");
os << '[' << strOptions << ']';
@ -2055,7 +2055,7 @@ void Buffer::makeLaTeXFile(ostream & os,
if (!lyxrc.language_global_options
&& tmp == "\\usepackage{babel}")
tmp = string("\\usepackage[") +
language_options.str().c_str() +
STRCONV(language_options.str()) +
"]{babel}";
preamble += tmp + "\n";
preamble += features.getBabelOptions();

View File

@ -194,7 +194,7 @@ string const currentState(BufferView * bv)
#ifdef DEVEL_VERSION
state << _(", Paragraph: ") << text->cursor.par()->id();
#endif
return state.str().c_str();
return STRCONV(state.str());
}

View File

@ -20,7 +20,13 @@ using std::make_pair;
using std::endl;
using boost::regex;
using boost::regex_match;
#ifndef USE_INCLUDED_STRING
using boost::smatch;
#else
using boost::cmatch;
#endif
bool CharacterSet::loadFile(string const & fname)
@ -50,10 +56,14 @@ bool CharacterSet::loadFile(string const & fname)
// without the use of a keyword table.
regex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*");
while (getline(ifs, line)) {
#ifndef USE_INCLUDED_STRING
smatch sub;
if (regex_match(line, sub, reg)) {
int const n = lyx::atoi(sub.str(1));
string const str = sub.str(2);
#else
cmatch sub;
#endif
if (regex_match(STRCONV(line), sub, reg)) {
int const n = lyx::atoi(STRCONV(sub.str(1)));
string const str = STRCONV(sub.str(2));
if (lyxerr.debugging(Debug::KBMAP))
lyxerr << "Chardef: " << n
<< " to [" << str << "]" << endl;

View File

@ -278,7 +278,8 @@ string Counters::labelItem(string const & ctr,
}
s << o.str();
}
return s.str();
return STRCONV(s.str());
}
@ -287,7 +288,8 @@ string Counters::numberLabel(string const & ctr,
string const & langtype,
int head)
{
ostringstream s, o;
ostringstream s;
if (numbertype == "sectioning" || numbertype == "appendix") {
if (ctr == "chapter" && head == 0) {
s << labelItem("chapter", numbertype, langtype, true);
@ -340,5 +342,6 @@ string Counters::numberLabel(string const & ctr,
s << eiv.str();
}
}
return s.str();
return STRCONV(s.str());
}

View File

@ -1,3 +1,7 @@
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* lyx_gui.h: do not use std:: on string
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* lyx_gui.h: reindent a bit, change signeture on lyx_gui::start.

View File

@ -1,5 +1,10 @@
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* biblio.C (regexSearch): STRCONV
(getInfo): ditto
* ControlAboutlyx.C (getVersion): STRCONV
* ControlMath.C: include config.h
2002-10-31 John Levon <levon@movementarian.org>

View File

@ -91,5 +91,5 @@ string const ControlAboutlyx::getVersion() const
<< _("User directory: ")
<< MakeDisplayPath(user_lyxdir);
return ss.str().c_str();
return STRCONV(ss.str());
}

View File

@ -118,7 +118,7 @@ regexSearch(InfoMap const & theMap,
vector<string>::const_iterator start,
Direction dir)
{
boost::regex reg(expr);
boost::regex reg(STRCONV(expr));
for (vector<string>::const_iterator it = start;
// End condition is direction-dependent.
@ -131,7 +131,7 @@ regexSearch(InfoMap const & theMap,
if (info != theMap.end())
data += " " + info->second;
if (boost::regex_match(data, reg)) {
if (boost::regex_match(STRCONV(data), reg)) {
return it;
}
}
@ -336,7 +336,7 @@ string const getInfo(InfoMap const & map, string const & key)
if (!year.empty())
result << ", " << year;
string const result_str = rtrim(result.str().c_str());
string const result_str = rtrim(STRCONV(result.str()));
if (!result_str.empty())
return result_str;

View File

@ -3,7 +3,7 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Michael Koziarski
* \author Michael Koziarski
*
* Full author contact details are available in file CREDITS
*/
@ -59,21 +59,21 @@ void GAbout::update()
cr += controller().getDisclaimer();
copyright()->get_buffer()->set_text(cr);
version()->set_text(controller().getVersion());
stringstream in;
controller().getCredits(in);
istringstream ss(in.str().c_str());
istringstream ss(in.str());
string s;
string out;
Gtk::TextIter e;
while (getline(ss, s)) {
if (prefixIs(s, "@b"))
out += s.substr(2);
else if (prefixIs(s, "@i"))
@ -88,19 +88,19 @@ void GAbout::update()
Gtk::Button * GAbout::close_btn() const
Gtk::Button * GAbout::close_btn() const
{
return getWidget<Gtk::Button>("r_close_btn");
return getWidget<Gtk::Button>("r_close_btn");
}
Gtk::Label * GAbout::version() const
Gtk::Label * GAbout::version() const
{
return getWidget<Gtk::Label>("r_version");
return getWidget<Gtk::Label>("r_version");
}
Gtk::TextView * GAbout::credits() const
Gtk::TextView * GAbout::credits() const
{
return getWidget<Gtk::TextView>("r_credits");
return getWidget<Gtk::TextView>("r_credits");
}
Gtk::TextView * GAbout::copyright() const
Gtk::TextView * GAbout::copyright() const
{
return getWidget<Gtk::TextView>("r_copyright");
return getWidget<Gtk::TextView>("r_copyright");
}

View File

@ -14,6 +14,7 @@
#include "LColor.h"
#include "LString.h"
#include <vector>
class Dialogs;
@ -36,7 +37,7 @@ void parse_lyxrc();
* Start the main event loop, after executing the given
* batch commands, and loading the given documents
*/
void start(string const & batch, std::vector<std::string> const & files);
void start(string const & batch, std::vector<string> const & files);
/**
* quit running LyX
@ -70,6 +71,7 @@ void set_read_callback(int fd, LyXComm * comm);
/**
* remove a I/O read callback
* @param fd file descriptor
*/
void remove_read_callback(int fd);

View File

@ -1,5 +1,7 @@
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* QAbout.C (build_dialog): do not use str().c_str() when not needed.
* qttableview.C: include config.h
* lyx_gui.C: move includes around a bit

View File

@ -64,7 +64,7 @@ void QAbout::build_dialog()
ostringstream in;
controller().getCredits(in);
istringstream ss(in.str().c_str());
istringstream ss(in.str());
string s;
ostringstream out;

View File

@ -1,5 +1,13 @@
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* lyx_gui.C (hexname): STRCONV
* FormPreferences.C (X11hexname): STRCONV
* FormMathsMatrix.C (apply): STRCONV
* FormMathsDelim.C (apply): STRCONV
* lyx_gui.C (start): adjust signature
(start): exchange magic integeres for defined values.

View File

@ -26,8 +26,6 @@
#include FORMS_H_LOCATION
using std::string;
typedef FormCB<ControlAboutlyx, FormDB<FD_aboutlyx> > base_class;
@ -50,7 +48,7 @@ void FormAboutlyx::build()
fl_add_browser_line(version_->browser_version, vs.str().c_str());
// create credits tab
credits_.reset(build_aboutlyx_credits(this));
credits_.reset(build_aboutlyx_credits(this));
ostringstream crs;
controller().getCredits(crs);
@ -73,7 +71,7 @@ void FormAboutlyx::build()
version_->form);
fl_addto_tabfolder(dialog_->tabfolder, _("Credits"),
credits_->form);
fl_addto_tabfolder(dialog_->tabfolder, _("License"),
fl_addto_tabfolder(dialog_->tabfolder, _("License"),
license_->form);
// work-around xforms bug re update of folder->x, folder->y coords.

View File

@ -6,7 +6,7 @@
* \author Alejandro Aguilar Sierra
* \author Pablo De Napoli
* \author John Levon
* \author Angus Leeming
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
@ -103,7 +103,7 @@ void FormMathsDelim::apply()
ostringstream os;
os << delim_values[left] << ' ' << delim_values[right];
lv_.dispatch(FuncRequest(LFUN_MATH_DELIM, os.str().c_str()));
lv_.dispatch(FuncRequest(LFUN_MATH_DELIM, STRCONV(os.str())));
}
@ -136,13 +136,13 @@ bool FormMathsDelim::input(FL_OBJECT *, long)
}
}
// Re-initialize button_pix to solid blue
// Re-initialize button_pix to solid blue
// (not elegant but works, MV 24.5.2002)
fl_free_pixmap_pixmap(dialog_->button_pix);
fl_set_pixmap_data(dialog_->button_pix, const_cast<char**>(delim1));
Pixmap p1;
fl_get_pixmap_pixmap(dialog_->button_pix, &p1, 0);
fl_draw_bmtable_item(dialog_->bmtable, left, p1, 0, 0);
fl_draw_bmtable_item(dialog_->bmtable, right, p1, 16, 0);
fl_redraw_object(dialog_->button_pix);

View File

@ -6,7 +6,7 @@
* \author Alejandro Aguilar Sierra
* \author Pablo De Napoli
* \author John Levon
* \author Angus Leeming
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
@ -106,7 +106,7 @@ void FormMathsMatrix::apply()
ostringstream os;
os << nx << ' ' << ny << ' ' << c << ' ' << sh;
lv_.dispatch(FuncRequest(LFUN_INSERT_MATRIX, os.str().c_str()));
lv_.dispatch(FuncRequest(LFUN_INSERT_MATRIX, STRCONV(os.str())));
}

View File

@ -3,7 +3,7 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
@ -911,7 +911,7 @@ string const FormPreferences::Colors::X11hexname(RGBColor const & col) const
<< setw(2) << col.g
<< setw(2) << col.b;
return ostr.str().c_str();
return STRCONV(ostr.str());
}
@ -1871,7 +1871,7 @@ void FormPreferences::LnFmisc::build()
setPrehandler(dialog_->check_dialogs_iconify_with_main);
setPrehandler(dialog_->check_preview_latex);
setPrehandler(dialog_->counter_wm_jump);
fl_addto_choice(dialog_->choice_display, _("Monochrome|Grayscale|Color|Do not display"));
}

View File

@ -35,6 +35,5 @@ void FormVCLog::update()
ostringstream ss;
controller().getVCLogFile(ss);
fl_add_browser_line(dialog_->browser,
ss.str().c_str());
fl_add_browser_line(dialog_->browser, ss.str().c_str());
}

View File

@ -249,7 +249,7 @@ void lyx_gui::start(string const & batch, vector<string> const & files)
int const geometryBitmask =
XParseGeometry(geometry,
&xpos, &ypos, &width, &height);
&xpos, &ypos, &width, &height);
// if width is not set by geometry, check it against monitor width
if (!(geometryBitmask & WidthValue)) {
@ -353,7 +353,7 @@ string const lyx_gui::hexname(LColor::color col)
<< setw(2) << (xcol.green / 256)
<< setw(2) << (xcol.blue / 256);
return os.str().c_str();
return STRCONV(os.str());
}

View File

@ -1,5 +1,11 @@
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* PreviewLoader.C (IncrementedFileName): STRCONV
(startLoading): ditto
* GraphicsConverter.C (Impl): STRCONV
(move_file): ditto
* GraphicsTypes.C: include config.h
2002-10-25 Angus Leeming <leeming@lyx.org>

View File

@ -3,7 +3,7 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
@ -161,7 +161,7 @@ Converter::Impl::Impl(string const & from_file, string const & to_file_base,
lyxerr[Debug::GRAPHICS] << "\tConversion script:"
<< "\n--------------------------------------\n"
<< script.str().c_str()
<< STRCONV(script.str())
<< "\n--------------------------------------\n";
// Output the script to file.
@ -173,7 +173,7 @@ Converter::Impl::Impl(string const & from_file, string const & to_file_base,
if (!fs.good())
return;
fs << script.str().c_str();
fs << STRCONV(script.str());
fs.close();
// The command needed to run the conversion process
@ -251,7 +251,7 @@ string const move_file(string const & from_file, string const & to_file)
<< "\t'rm' -f ${fromfile}\n"
<< "fi\n";
return command.str().c_str();
return STRCONV(command.str());
}

View File

@ -3,8 +3,8 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Baruch Even
* \author Angus Leeming
* \author Baruch Even
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/

View File

@ -3,7 +3,7 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
@ -258,7 +258,7 @@ struct IncrementedFileName {
{
ostringstream os;
os << base_ << counter_++ << "." << to_format_;
string const file = os.str().c_str();
string const file = STRCONV(os.str());
return make_pair(snippet, file);
}
@ -281,7 +281,7 @@ InProgress::InProgress(string const & filename_base,
PendingSnippets::const_iterator pend = pending.end();
BitmapFile::iterator sit = snippets.begin();
std::transform(pit, pend, sit,
std::transform(pit, pend, sit,
IncrementedFileName(to_format, filename_base));
}
@ -478,7 +478,7 @@ void PreviewLoader::Impl::startLoading()
cs << pconverter_->command << " " << latexfile << " "
<< int(font_scaling_factor_) << " " << pconverter_->to;
string const command = "sh " + LibScriptSearch(cs.str().c_str());
string const command = "sh " + LibScriptSearch(STRCONV(cs.str()));
// Initiate the conversion from LaTeX to bitmap images files.
Forkedcall::SignalTypePtr convert_ptr(new Forkedcall::SignalType);

View File

@ -40,7 +40,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
string const displaypath = MakeDisplayPath(filename);
ostringstream s1;
s1 << _("Importing") << ' ' << displaypath << "...";
lv->message(s1.str().c_str());
lv->message(STRCONV(s1.str()));
string const lyxfile = ChangeExtension(filename, ".lyx");

View File

@ -1,5 +1,13 @@
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* insettabular.C (copySelection): STRCONV
* insetinclude.C (uniqueID): STRCONV
(latexString): ditto
* insetgraphics.C: put VersionNumber inside anon namespace
(createLatexOptions): STRCONV
* insetcommandparams.C: include config.h
2002-10-31 Rob Lahaye <lahaye@snu.ac.kr>

View File

@ -100,12 +100,13 @@ extern string system_tempdir;
using std::ostream;
using std::endl;
namespace {
///////////////////////////////////////////////////////////////////////////
int const VersionNumber = 1;
///////////////////////////////////////////////////////////////////////////
namespace {
// This function is a utility function
// ... that should be with ChangeExtension ...
inline
@ -114,10 +115,6 @@ string const RemoveExtension(string const & filename)
return ChangeExtension(filename, string());
}
} // namespace anon
namespace {
string const uniqueID()
{
@ -127,7 +124,30 @@ string const uniqueID()
ost << "graph" << ++seed;
// Needed if we use lyxstring.
return ost.str().c_str();
return STRCONV(ost.str());
}
string findTargetFormat(string const & suffix)
{
// lyxrc.pdf_mode means:
// Are we creating a PDF or a PS file?
// (Should actually mean, are we using latex or pdflatex).
if (lyxrc.pdf_mode) {
lyxerr[Debug::GRAPHICS] << "findTargetFormat: PDF mode\n";
if (contains(suffix, "ps") || suffix == "pdf")
return "pdf";
else if (suffix == "jpg") // pdflatex can use jpeg
return suffix;
else
return "png"; // and also png
}
// If it's postscript, we always do eps.
lyxerr[Debug::GRAPHICS] << "findTargetFormat: PostScript mode\n";
if (suffix != "ps") // any other than ps
return "eps"; // is changed to eps
else
return suffix; // let ps untouched
}
} // namespace anon
@ -468,7 +488,6 @@ string const InsetGraphics::createLatexOptions() const
options << " draft,\n";
if (params().clip)
options << " clip,\n";
if (!lyx::float_equal(params().scale, 0.0, 0.05)) {
if (!lyx::float_equal(params().scale, 100.0, 0.05))
options << " scale=" << params().scale / 100.0
@ -479,7 +498,7 @@ string const InsetGraphics::createLatexOptions() const
if (!params().height.zero())
options << " height=" << params().height.asLatexString() << ",\n";
if (params().keepAspectRatio)
options << " keepaspectratio,\n";
options << " keepaspectratio,\n";
}
// Make sure rotation angle is not very close to zero;
@ -501,37 +520,13 @@ string const InsetGraphics::createLatexOptions() const
if (!params().special.empty())
options << params().special << ",\n";
string opts = options.str().c_str();
return opts.substr(0,opts.size()-2); // delete last ",\n"
string opts = STRCONV(options.str());
// delete last ",\n"
return opts.substr(0, opts.size() - 2);
}
namespace {
string findTargetFormat(string const & suffix)
{
// lyxrc.pdf_mode means:
// Are we creating a PDF or a PS file?
// (Should actually mean, are we using latex or pdflatex).
if (lyxrc.pdf_mode) {
lyxerr[Debug::GRAPHICS] << "findTargetFormat: PDF mode\n";
if (contains(suffix, "ps") || suffix == "pdf")
return "pdf";
else if (suffix == "jpg") // pdflatex can use jpeg
return suffix;
else
return "png"; // and also png
}
// If it's postscript, we always do eps.
lyxerr[Debug::GRAPHICS] << "findTargetFormat: PostScript mode\n";
if (suffix != "ps") // any other than ps
return "eps"; // is changed to eps
else
return suffix; // let ps untouched
}
} // Anon. namespace
string const InsetGraphics::prepareFile(Buffer const *buf) const
string const InsetGraphics::prepareFile(Buffer const * buf) const
{
// LaTeX can cope if the graphics file doesn't exist, so just return the
// filename.

View File

@ -86,7 +86,7 @@ string const uniqueID()
ost << "file" << ++seed;
// Needed if we use lyxstring.
return ost.str().c_str();
return STRCONV(ost.str());
}
} // namespace anon
@ -554,7 +554,7 @@ string const InsetInclude::PreviewImpl::latexString() const
ostringstream os;
parent().latex(view()->buffer(), os, false, false);
return os.str().c_str();
return STRCONV(os.str());
}

View File

@ -2529,7 +2529,7 @@ bool InsetTabular::copySelection(BufferView * bv)
ostringstream sstr;
paste_tabular->ascii(bv->buffer(), sstr,
(int)parOwner()->params().depth(), true, '\t');
bv->stuffClipboard(sstr.str().c_str());
bv->stuffClipboard(STRCONV(sstr.str()));
return true;
}

View File

@ -91,7 +91,7 @@ LyX::LyX(int & argc, char * argv[])
// if this should not be in this file, please also remove
// #include "graphics/GraphicsTypes.h" at the top -- Rob Lahaye.
grfx::setDisplayTranslator();
if (want_gui) {
lyx_gui::parse_init(argc, argv);
}

View File

@ -539,7 +539,7 @@ string const LyXFont::stateText(BufferParams * params) const
if (number() != OFF)
ost << _(" Number ") << _(GUIMiscNames[number()]);
string buf(ost.str().c_str());
string buf(STRCONV(ost.str()));
buf = rtrim(buf, ", ");
return buf;
}

View File

@ -160,7 +160,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym,
<< keysym->getSymbolName()
<< endl;
}
// Do nothing if we have nothing (JMarc)
if (!keysym->isOK()) {
lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
@ -948,10 +948,10 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
ostringstream s1;
s1 << _("Saving document") << ' '
<< MakeDisplayPath(owner->buffer()->fileName() + "...");
owner->message(s1.str().c_str());
owner->message(STRCONV(s1.str()));
MenuWrite(view(), owner->buffer());
s1 << _(" done.");
owner->message(s1.str().c_str());
owner->message(STRCONV(s1.str()));
} else
WriteAs(view(), owner->buffer());
break;
@ -1106,7 +1106,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
ostringstream str;
str << _("Opening help file") << ' '
<< MakeDisplayPath(fname) << "...";
owner->message(str.str().c_str());
owner->message(STRCONV(str.str()));
view()->buffer(bufferlist.loadLyXFile(fname, false));
owner->allowInput();
break;
@ -1675,19 +1675,17 @@ void LyXFunc::open(string const & fname)
ostringstream str;
str << _("Opening document") << ' ' << disp_fn << "...";
owner->message(str.str().c_str());
owner->message(STRCONV(str.str()));
Buffer * openbuf = bufferlist.loadLyXFile(filename);
ostringstream str2;
if (openbuf) {
view()->buffer(openbuf);
ostringstream str;
str << _("Document") << ' ' << disp_fn << ' ' << _("opened.");
owner->message(str.str().c_str());
str2 << _("Document") << ' ' << disp_fn << ' ' << _("opened.");
} else {
ostringstream str;
str << _("Could not open document") << ' ' << disp_fn;
owner->message(str.str().c_str());
str2 << _("Could not open document") << ' ' << disp_fn;
}
owner->message(STRCONV(str2.str()));
}

View File

@ -45,45 +45,45 @@ string const LyXGlueLength::asString() const
if (plus_.zero() && minus_.zero()) {
buffer << unit_name[len_.unit()];
return buffer.str().c_str();
return STRCONV(buffer.str());
}
// just len and plus
if (minus_.zero()) {
if (len_.unit() != plus_.unit())
buffer << unit_name[len_.unit()];
buffer << "+" << plus_.value();
buffer << unit_name[plus_.unit()];
return buffer.str().c_str();
return STRCONV(buffer.str());
}
// just len and minus
if (plus_.zero()) {
if (len_.unit() != minus_.unit())
buffer << unit_name[len_.unit()];
buffer << "-" << minus_.value();
buffer << unit_name[minus_.unit()];
return buffer.str().c_str();
return STRCONV(buffer.str());
}
// ok, len, plus AND minus
// len+-
if (minus_ == plus_) {
if (len_.unit() != minus_.unit())
buffer << unit_name[len_.unit()];
buffer << "+-" << minus_.value();
buffer << unit_name[minus_.unit()];
return buffer.str().c_str();
return STRCONV(buffer.str());
}
// this is so rare a case, why bother minimising units ?
buffer << unit_name[len_.unit()];
buffer << "+" << plus_.value() << unit_name[plus_.unit()];
buffer << "-" << minus_.value() << unit_name[minus_.unit()];
return buffer.str().c_str();
return STRCONV(buffer.str());
}
@ -92,12 +92,12 @@ string const LyXGlueLength::asLatexString() const
ostringstream buffer;
buffer << len_.value() << unit_name[len_.unit()];
if (!plus_.zero())
buffer << " plus " << plus_.value() << unit_name[plus_.unit()];
if (!minus_.zero())
buffer << " minus " << minus_.value() << unit_name[minus_.unit()];
return buffer.str().c_str();
return STRCONV(buffer.str());
}

View File

@ -53,7 +53,7 @@ string const LyXLength::asString() const
{
ostringstream buffer;
buffer << val_ << unit_name[unit_]; // setw?
return buffer.str().c_str();
return STRCONV(buffer.str());
}
@ -89,7 +89,7 @@ string const LyXLength::asLatexString() const
buffer << val_ << unit_name[unit_]; // setw?
break;
}
return buffer.str().c_str();
return STRCONV(buffer.str());
}
@ -134,7 +134,7 @@ int LyXLength::inPixels(int text_width, int em_width_base) const
double const em_width = (em_width_base > 0)
? em_width_base
: 10*(dpi/72.27)*zoom;
// A different estimate for em_width is
// A different estimate for em_width is
// font_metrics::width('M', LyXFont(LyXFont::ALL_SANE))
// but this estimate might not be more accurate as the screen font
// is different then the latex font.

View File

@ -1,5 +1,24 @@
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* math_inset.C (asString): STRCONV
* math_factory.C (initSymbols): do not std:: qualify getline, use
empty() to check for empty string, STRCONV
* math_extern.C: STRCONV
* math_diminset.C (drawT): STRCONV
* math_cursor.C (info): STRCONV
* math_autocorrect.C (initAutoCorrect): STRCONV
* formulamacro.C (InsetFormulaMacro): STRCONV
* formulabase.C (localDispatch): STRCONV
* formula.C (latexString): STRCONV
* math_factory.C: add using std::endl
(math_font_available): use it
(initSymbols): use it

View File

@ -330,5 +330,5 @@ string const InsetFormula::PreviewImpl::latexString() const
ostringstream ls;
WriteStream wi(ls, false, false);
parent().par_->write(wi);
return ls.str().c_str();
return STRCONV(ls.str());
}

View File

@ -310,7 +310,7 @@ Inset::RESULT InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
if (cmd.button() == mouse_button::button3) {
// try to dispatch to enclosed insets first
if (mathcursor->dispatch(cmd) == MathInset::UNDISPATCHED) {
if (mathcursor->dispatch(cmd) == MathInset::UNDISPATCHED) {
// launch math panel for right mouse button
bv->owner()->getDialogs().showMathPanel();
}
@ -382,12 +382,12 @@ Inset::RESULT InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
return DISPATCHED;
// only select with button 1
if (cmd.button() != mouse_button::button1)
if (cmd.button() != mouse_button::button1)
return DISPATCHED;
if (abs(cmd.x - first_x) < 2 && abs(cmd.y - first_y) < 2)
return DISPATCHED;
first_x = cmd.x;
first_y = cmd.y;
@ -662,7 +662,7 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
unsigned int n = 1;
string v_align;
string h_align;
istringstream is(argument);
istringstream is(STRCONV(argument));
is >> m >> n >> v_align >> h_align;
m = max(1u, m);
n = max(1u, n);
@ -736,7 +736,7 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
mathcursor->niceInsert(argument);
updateLocal(bv, true);
break;
case -1:
case LFUN_SELFINSERT:
if (!argument.empty()) {
@ -949,7 +949,7 @@ bool InsetFormulaBase::display() const
string InsetFormulaBase::selectionAsString() const
{
return mathcursor ? mathcursor->grabSelection() : string();
return mathcursor ? mathcursor->grabSelection() : string();
}
/////////////////////////////////////////////////////////////////////
@ -1025,13 +1025,13 @@ void mathDispatch(FuncRequest const & cmd)
}
break;
case LFUN_GREEK:
case LFUN_INSERT_MATH:
case LFUN_INSERT_MATRIX:
case LFUN_GREEK:
case LFUN_INSERT_MATH:
case LFUN_INSERT_MATRIX:
case LFUN_MATH_DELIM: {
InsetFormula * f = new InsetFormula(bv);
if (openNewInset(bv, f)) {
bv->theLockingInset()->
bv->theLockingInset()->
localDispatch(FuncRequest(bv, LFUN_MATH_MUTATE, "simple"));
bv->theLockingInset()->localDispatch(cmd);
}

View File

@ -61,7 +61,7 @@ InsetFormulaMacro::InsetFormulaMacro(string const & name, int nargs)
InsetFormulaMacro::InsetFormulaMacro(string const & s)
{
std::istringstream is(s);
std::istringstream is(STRCONV(s));
read(is);
}

View File

@ -1,5 +1,5 @@
#ifdef __GNUG__
#pragma implementation
#pragma implementation
#endif
#include <config.h>
@ -146,7 +146,8 @@ void initAutoCorrect()
//lyxerr[Debug::MATHED] << "ignoring line '" << line << "'" << endl;
continue;
}
istringstream il(line);
istringstream il(STRCONV(line));
//lyxerr[Debug::MATHED] << "line '" << line << "'" << endl;
Correction corr;
if (corr.read(il)) {

View File

@ -1290,7 +1290,7 @@ string MathCursor::info() const
if (prevAtom()->asSymbolInset() || prevAtom()->asScriptInset())
prevAtom()->infoize(os);
os << " ";
return os.str().c_str(); // .c_str() needed for lyxstring
return STRCONV(os.str());
}

View File

@ -1,6 +1,5 @@
#ifdef __GNUG__
#pragma implementation
#pragma implementation
#endif
#include "math_diminset.h"
@ -28,6 +27,6 @@ void MathDimInset::drawT(TextPainter &, int, int) const
/*
std::ostringstream os;
os << MathAtom(this);
pain.draw(x, y, os.str().c_str());
pain.draw(x, y, STRCONV(os.str()));
*/
}

View File

@ -1,6 +1,5 @@
#ifdef __GNUG__
#pragma implementation
#pragma implementation
#endif
// This file contains most of the magic that extracts "context
@ -306,7 +305,7 @@ void extractExps(MathArray & ar)
if (!sup || sup->hasDown())
continue;
// create a proper exp-inset as replacement
// create a proper exp-inset as replacement
ar[i] = MathAtom(new MathExFuncInset("exp", sup->cell(1)));
ar.erase(i + 1);
}
@ -490,7 +489,7 @@ bool testIntegral(MathAtom const & at)
{
return
testIntSymbol(at) ||
( at->asScriptInset()
( at->asScriptInset()
&& at->asScriptInset()->nuc().size()
&& testIntSymbol(at->asScriptInset()->nuc().back()) );
}
@ -569,7 +568,7 @@ bool testSum(MathAtom const & at)
{
return
testSumSymbol(at) ||
( at->asScriptInset()
( at->asScriptInset()
&& at->asScriptInset()->nuc().size()
&& testSumSymbol(at->asScriptInset()->nuc().back()) );
}
@ -750,7 +749,7 @@ void extractLims(MathArray & ar)
MathArray::iterator it = ar.begin() + i;
// is this a limit function?
if (!testSymbol(*it, "lim"))
if (!testSymbol(*it, "lim"))
continue;
// the next one must be a subscript (without superscript)
@ -767,7 +766,7 @@ void extractLims(MathArray & ar)
// the -> splits the subscript int x and x0
MathArray x = MathArray(s.begin(), st);
MathArray x0 = MathArray(st + 1, s.end());
// use something behind the script as core
MathArray f;
MathArray::iterator tt = extractArgument(f, it + 2, ar.end());
@ -927,7 +926,7 @@ namespace {
ostringstream os;
MaximaStream ms(os);
ms << ar;
string expr = os.str().c_str();
string expr = STRCONV(os.str());
string const header = "SIMPSUM:true;";
string out;
@ -1050,7 +1049,7 @@ namespace {
ostringstream os;
MapleStream ms(os);
ms << ar;
string expr = os.str().c_str();
string expr = STRCONV(os.str());
lyxerr << "ar: '" << ar << "'\n";
lyxerr << "ms: '" << os.str() << "'\n";
@ -1098,7 +1097,7 @@ namespace {
ostringstream os;
OctaveStream vs(os);
vs << ar;
string expr = os.str().c_str();
string expr = STRCONV(os.str());
string out;
lyxerr << "pipe: ar: '" << ar << "'\n";
@ -1182,7 +1181,7 @@ MathArray pipeThroughExtern(string const & lang, string const & extra,
os << "[" << extra << ' ';
ns << ar;
os << "]";
string data = os.str().c_str();
string data = STRCONV(os.str());
// search external script
string file = LibFileSearch("mathed", "extern_" + lang);

View File

@ -57,6 +57,7 @@ bool has_math_fonts;
using std::endl;
namespace {
// file scope
@ -98,15 +99,15 @@ void initSymbols()
std::ifstream fs(filename.c_str());
string line;
bool skip = false;
while (std::getline(fs, line)) {
while (getline(fs, line)) {
int charid = 0;
int fallbackid = 0;
if (line.size() > 0 && line[0] == '#')
if (!line.empty() && line[0] == '#')
continue;
// special case of iffont/else/endif
if (line.size() >= 7 && line.substr(0, 6) == "iffont") {
istringstream is(line);
istringstream is(STRCONV(line));
string tmp;
is >> tmp;
is >> tmp;
@ -122,13 +123,13 @@ void initSymbols()
// special case of pre-defined macros
if (line.size() > 8 && line.substr(0, 5) == "\\def\\") {
//lyxerr << "defining: '" << line << "'\n";
istringstream is(line);
//lyxerr << "defining: '" << line << "'" << endl;
istringstream is(STRCONV(line));
MathMacroTable::create(MathAtom(new MathMacroTemplate(is)));
continue;
}
istringstream is(line);
istringstream is(STRCONV(line));
latexkeys tmp;
is >> tmp.name >> tmp.inset;
if (isFontName(tmp.inset))
@ -145,7 +146,7 @@ void initSymbols()
if (isFontName(tmp.inset)) {
// tmp.inset _is_ the fontname here.
// create fallbacks if necessary
if (tmp.extra=="func" || tmp.extra=="funclim" || tmp.extra=="special") {
if (tmp.extra == "func" || tmp.extra == "funclim" || tmp.extra == "special") {
lyxerr[Debug::MATHED] << "symbol abuse for " << tmp.name << endl;
tmp.draw = tmp.name;
} else if (math_font_available(tmp.inset)) {
@ -165,20 +166,24 @@ void initSymbols()
}
} else {
// it's a proper inset
lyxerr[Debug::MATHED] << "inset " << tmp.inset << " used for "
<< tmp.name << endl;
lyxerr[Debug::MATHED] << "inset " << tmp.inset
<< " used for " << tmp.name
<< endl;
}
if (theWordList.find(tmp.name) != theWordList.end())
lyxerr[Debug::MATHED] << "readSymbols: inset " << tmp.name
<< " already exists." << endl;
lyxerr[Debug::MATHED]
<< "readSymbols: inset " << tmp.name
<< " already exists." << endl;
else
theWordList[tmp.name] = tmp;
lyxerr[Debug::MATHED] << "read symbol '" << tmp.name
<< " inset: " << tmp.inset
<< " draw: " << int(tmp.draw[0])
<< " extra: " << tmp.extra
<< "'" << endl;
lyxerr[Debug::MATHED]
<< "read symbol '" << tmp.name
<< " inset: " << tmp.inset
<< " draw: " << int(tmp.draw.empty() ? 0 : tmp.draw[0])
<< " extra: " << tmp.extra
<< "'" << endl;
}
string tmp = "cmm";
string tmp2 = "cmsy";
@ -203,18 +208,20 @@ latexkeys const * in_word_set(string const & str)
{
WordList::iterator it = theWordList.find(str);
//lyxerr << "looking up '" << str << "' found: "
// << (it != theWordList.end()) << "\n";
// << (it != theWordList.end()) << endl;
return (it != theWordList.end()) ? &(it->second) : 0;
}
MathAtom createMathInset(string const & s)
{
lyxerr[Debug::MATHED] << "creating inset with name: '" << s << "'" << endl;
lyxerr[Debug::MATHED] << "creating inset with name: '"
<< s << "'" << endl;;
latexkeys const * l = in_word_set(s);
if (l) {
string const & inset = l->inset;
lyxerr[Debug::MATHED] << " found inset: '" << inset << "'" << endl;
lyxerr[Debug::MATHED] << " found inset: '" <<
inset << "'" << endl;
if (inset == "ref")
return MathAtom(new RefInset(l->name));
if (inset == "underset")

View File

@ -393,7 +393,7 @@ void MathHullInset::footer_write(WriteStream & os) const
else
os << "\\]\n";
else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"
else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"
|| type_ == "alignat" || type_ == "xalignat")
os << "\\end{" << type_ << star(n) << "}\n";
@ -433,7 +433,7 @@ void MathHullInset::delRow(row_type row)
void MathHullInset::addCol(col_type col)
{
if (colChangeOK())
if (colChangeOK())
MathGridInset::addCol(col);
else
lyxerr << "Can't change number of columns in '" << type_ << "'\n";
@ -442,7 +442,7 @@ void MathHullInset::addCol(col_type col)
void MathHullInset::delCol(col_type col)
{
if (colChangeOK())
if (colChangeOK())
MathGridInset::delCol(col);
else
lyxerr << "Can't change number of columns in '" << type_ << "'\n";
@ -592,7 +592,7 @@ void MathHullInset::mutate(string const & newtype)
}
else if (type_ == "multline") {
if (newtype == "gather" || newtype == "align" ||
if (newtype == "gather" || newtype == "align" ||
newtype == "xalignat" || newtype == "xxalignat" || newtype == "flalign")
setType(newtype);
else if (newtype == "eqnarray") {
@ -826,7 +826,7 @@ MathInset::result_type MathHullInset::dispatch
idx = r * ncols() + c;
if (idx >= nargs())
idx = nargs() - 1;
if (pos > cell(idx).size())
if (pos > cell(idx).size())
pos = cell(idx).size();
return DISPATCHED_POP;
}

View File

@ -18,7 +18,7 @@
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#pragma implementation
#endif
#include "math_inset.h"
@ -264,7 +264,7 @@ int MathInset::docbook(std::ostream &, bool) const
MathInset::result_type
MathInset::dispatch(FuncRequest const &, idx_type &, pos_type &)
MathInset::dispatch(FuncRequest const &, idx_type &, pos_type &)
{
return UNDISPATCHED;
}
@ -288,7 +288,7 @@ string asString(MathArray const & ar)
std::ostringstream os;
WriteStream ws(os);
ws << ar;
return os.str().c_str();
return STRCONV(os.str());
}

View File

@ -1743,7 +1743,7 @@ string const Paragraph::asString(Buffer const * buffer, bool label)
getInset(i)->lyxCode() == Inset::MATH_CODE) {
ostringstream ost;
getInset(i)->ascii(buffer, ost);
s += subst(ost.str().c_str(),'\n',' ');
s += subst(STRCONV(ost.str()),'\n',' ');
}
}
@ -1775,7 +1775,7 @@ string const Paragraph::asString(Buffer const * buffer,
}
}
return ost.str().c_str();
return STRCONV(ost.str());
}

View File

@ -8,23 +8,23 @@
*/
#include <config.h>
#include "support/LOstream.h"
#include "paragraph.h"
#include "sgml.h"
using std::pair;
using std::make_pair;
using std::ostream;
using std::endl;
namespace sgml {
pair<bool, string> escapeChar(char c)
{
string str;
switch (c) {
case Paragraph::META_HFILL:
break;
@ -83,7 +83,7 @@ pair<bool, string> escapeChar(char c)
return make_pair(false, str);
}
int openTag(ostream & os, Paragraph::depth_type depth,
bool mixcont, string const & latexname)
{

View File

@ -1,5 +1,12 @@
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* lstrings.h (tostr): STRCONV
* lstrings.C (regexMatch): STRCONV
(getVectorFromString): STRCONV, manual copy into vector
* filetools.C (GetFileContents): STRCONV
* os.C: include config.h
* lstrings.C (getVectorFromString): rewrite to use

View File

@ -782,7 +782,7 @@ string const GetFileContents(string const & fname)
if (ifs && ofs) {
ofs << ifs.rdbuf();
ifs.close();
return ofs.str().c_str();
return STRCONV(ofs.str());
}
}
lyxerr << "LyX was not able to read file '" << fname << "'" << endl;

View File

@ -447,8 +447,8 @@ bool regexMatch(string const & a, string const & pattern)
string regex(pattern);
regex = subst(regex, ".", "\\.");
regex = subst(regex, "*", ".*");
boost::regex reg(regex);
return boost::regex_match(a, reg);
boost::regex reg(STRCONV(regex));
return boost::regex_match(STRCONV(a), reg);
}
@ -637,7 +637,20 @@ vector<string> const getVectorFromString(string const & str,
#else
boost::char_separator<char> sep(delim.c_str());
boost::tokenizer<boost::char_separator<char> > tokens(str, sep);
#ifndef USE_INCLUDED_STRING
return vector<string>(tokens.begin(), tokens.end());
#else
vector<string> vec;
using boost::tokenizer;
using boost::char_separator;
tokenizer<char_separator<char> >::iterator it = tokens.begin();
tokenizer<char_separator<char> >::iterator end = tokens.end();
for (; it != end; ++it) {
vec.push_back(STRCONV((*it)));
}
return vec;
#endif
#endif
}

View File

@ -97,7 +97,7 @@ string const tostr(T const & t)
{
ostringstream ostr;
ostr << t;
return ostr.str().c_str();
return STRCONV(ostr.str());
// We need to use the .c_str since we sometimes are using
// our own string class and that is not compatible with
// basic_string<char>. (of course we don't want this later)

View File

@ -665,7 +665,7 @@ lyxstring::const_reference lyxstring::operator[](size_type pos) const
#if 0
// This is actually what the standard requires,
lyx::Assert(pos <= rep->sz); // OURS!
static char helper = '\0';
static char const helper = '\0';
return pos == rep->sz ? helper : rep->s[pos];
#else
// but we use this one since it is stricter

View File

@ -1257,9 +1257,8 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
.numberLabel(layout->latexname(),
numbertype, langtype, head);
par->params().labelString(par->params().labelString() + s.str().c_str());
// We really want to remove the c_str as soon as
// possible...
par->params().labelString(par->params().labelString()
+ STRCONV(s.str()));
// reset enum counters
textclass.counters().reset("enum");
@ -1292,7 +1291,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
s << textclass.counters()
.numberLabel(enumcounter,
"enumeration", langtype);
par->params().labelString(s.str().c_str());
par->params().labelString(STRCONV(s.str()));
}
} else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
textclass.counters().step("bibitem");
@ -1335,7 +1334,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
ostringstream o;
//o << fl.name() << " " << buf->counters().value(fl.name()) << ":";
o << fl.name() << " #:";
s = o.str();
s = STRCONV(o.str());
} else {
// par->SetLayout(0);
// s = layout->labelstring;

View File

@ -31,7 +31,13 @@ using std::ifstream;
using std::getline;
using boost::regex;
using boost::regex_match;
#ifndef USE_INCLUDED_STRING
using boost::smatch;
#else
using boost::cmatch;
#endif
int VCS::doVCCommand(string const & cmd, string const & path)
{
@ -252,13 +258,18 @@ void CVS::scanMaster()
lyxerr[Debug::LYXVC] << "\t line: " << line << endl;
if (contains(line, tmpf)) {
// Ok extract the fields.
#ifndef USE_INCLUDED_STRING
smatch sm;
regex_match(line, sm, reg);
#else
cmatch sm;
#endif
regex_match(STRCONV(line), sm, reg);
//sm[0]; // whole matched string
//sm[1]; // filename
version_ = sm.str(2);
string file_date = sm.str(3);
version_ = STRCONV(sm.str(2));
string const file_date = STRCONV(sm.str(3));
//sm[4]; // options
//sm[5]; // tag or tagdate
FileInfo fi(file_);