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
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
if (i > 0) {
ostringstream str;
str << _("Saved bookmark") << ' ' << i;
- owner_->message(str.str().c_str());
+ owner_->message(STRCONV(str.str()));
}
}
if (i > 0) {
ostringstream str;
str << _("Moved to bookmark") << ' ' << i;
- owner_->message(str.str().c_str());
+ owner_->message(STRCONV(str.str()));
}
}
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()));
}
}
// e.g. Qt mouse press when no buffer
if (!buffer_)
return false;
-
+
LyXTextClass const & tclass = buffer_->params.getLyXTextClass();
switch (ev.action) {
inset->setLoadingBuffer(bv_->buffer(), false);
updateInset(inset, true);
}
-
+
}
break;
{
InsetBibtex * inset =
static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
- if (inset)
+ if (inset)
inset->setOptions(ev.argument);
}
break;
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(...)
#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
#include "support/lyxstring.h"
// using lyx::string;
typedef lyxstring string;
+#define STRCONV(STR) STR.c_str()
#endif
+
#endif
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
// 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);
}
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
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()();
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()();
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()();
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, ',');
<< 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()) {
<< 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);
}
}
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;
}
// (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)
++cit)
languages << (*cit)->babel() << ',';
- return languages.str().c_str();
+ return STRCONV(languages.str());
}
packages << externalPreambles;
- return packages.str().c_str();
+ return STRCONV(packages.str());
}
// floats
getFloatDefinitions(macros);
- return macros.str().c_str();
+ return STRCONV(macros.str());
}
if (!params.language->latex_options().empty())
tmp << params.language->latex_options() << '\n';
- return tmp.str().c_str();
+ return STRCONV(tmp.str());
}
tcpreamble << tclass[*cit]->preamble();
}
- return tcpreamble.str().c_str();
+ return STRCONV(tcpreamble.str());
}
entities << "<!ENTITY lyxarrow \"->\">" << '\n';
}
- return entities.str().c_str();
+ return STRCONV(entities.str());
}
<< (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
<< MakeRelPath(fi->second, basename) << "\">";
- return sgmlpreamble.str().c_str();
+ return STRCONV(sgmlpreamble.str());
}
ostringstream ost;
ost << "\\begin{spacing}{"
<< getValue() << "}";
- return ost.str().c_str();
+ return STRCONV(ost.str());
}
}
return string();
"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());
}
}
buffer << word;
- return buffer.str().c_str();
+ return STRCONV(buffer.str());
}
options << params.options << ',';
}
- string strOptions(options.str().c_str());
+ string strOptions(STRCONV(options.str()));
if (!strOptions.empty()) {
strOptions = rtrim(strOptions, ",");
os << '[' << strOptions << ']';
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();
#ifdef DEVEL_VERSION
state << _(", Paragraph: ") << text->cursor.par()->id();
#endif
- return state.str().c_str();
+ return STRCONV(state.str());
}
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)
// 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;
}
s << o.str();
}
- return s.str();
+
+ return STRCONV(s.str());
}
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);
s << eiv.str();
}
}
- return s.str();
+
+ return STRCONV(s.str());
}
+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.
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>
<< _("User directory: ")
<< MakeDisplayPath(user_lyxdir);
- return ss.str().c_str();
+ return STRCONV(ss.str());
}
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.
if (info != theMap.end())
data += " " + info->second;
- if (boost::regex_match(data, reg)) {
+ if (boost::regex_match(STRCONV(data), reg)) {
return it;
}
}
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;
* 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
*/
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"))
-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");
}
#include "LColor.h"
#include "LString.h"
+
#include <vector>
class Dialogs;
* 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
/**
* remove a I/O read callback
+ * @param fd file descriptor
*/
void remove_read_callback(int fd);
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
ostringstream in;
controller().getCredits(in);
- istringstream ss(in.str().c_str());
+ istringstream ss(in.str());
string s;
ostringstream out;
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.
#include FORMS_H_LOCATION
-using std::string;
-
typedef FormCB<ControlAboutlyx, FormDB<FD_aboutlyx> > base_class;
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);
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.
* \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
*/
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())));
}
}
}
- // 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);
* \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
*/
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())));
}
* 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
*/
<< setw(2) << col.g
<< setw(2) << col.b;
- return ostr.str().c_str();
+ return STRCONV(ostr.str());
}
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"));
}
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());
}
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)) {
<< setw(2) << (xcol.green / 256)
<< setw(2) << (xcol.blue / 256);
- return os.str().c_str();
+ return STRCONV(os.str());
}
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>
* 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
*/
lyxerr[Debug::GRAPHICS] << "\tConversion script:"
<< "\n--------------------------------------\n"
- << script.str().c_str()
+ << STRCONV(script.str())
<< "\n--------------------------------------\n";
// Output the script to file.
if (!fs.good())
return;
- fs << script.str().c_str();
+ fs << STRCONV(script.str());
fs.close();
// The command needed to run the conversion process
<< "\t'rm' -f ${fromfile}\n"
<< "fi\n";
- return command.str().c_str();
+ return STRCONV(command.str());
}
* 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
*/
* 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
*/
{
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);
}
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));
}
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);
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");
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>
using std::ostream;
using std::endl;
+
+namespace {
+
///////////////////////////////////////////////////////////////////////////
int const VersionNumber = 1;
///////////////////////////////////////////////////////////////////////////
-namespace {
-
// This function is a utility function
// ... that should be with ChangeExtension ...
inline
return ChangeExtension(filename, string());
}
-} // namespace anon
-
-
-namespace {
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
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
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;
if (!params().special.empty())
options << params().special << ",\n";
- string opts = options.str().c_str();
- return opts.substr(0,opts.size()-2); // delete last ",\n"
-}
-
-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
+ string opts = STRCONV(options.str());
+ // delete last ",\n"
+ return opts.substr(0, opts.size() - 2);
}
-} // 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.
ost << "file" << ++seed;
// Needed if we use lyxstring.
- return ost.str().c_str();
+ return STRCONV(ost.str());
}
} // namespace anon
ostringstream os;
parent().latex(view()->buffer(), os, false, false);
- return os.str().c_str();
+ return STRCONV(os.str());
}
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;
}
// 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);
}
if (number() != OFF)
ost << _(" Number ") << _(GUIMiscNames[number()]);
- string buf(ost.str().c_str());
+ string buf(STRCONV(ost.str()));
buf = rtrim(buf, ", ");
return buf;
}
<< keysym->getSymbolName()
<< endl;
}
-
+
// Do nothing if we have nothing (JMarc)
if (!keysym->isOK()) {
lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
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;
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;
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()));
}
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());
}
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());
}
{
ostringstream buffer;
buffer << val_ << unit_name[unit_]; // setw?
- return buffer.str().c_str();
+ return STRCONV(buffer.str());
}
buffer << val_ << unit_name[unit_]; // setw?
break;
}
- return buffer.str().c_str();
+ return STRCONV(buffer.str());
}
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.
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
ostringstream ls;
WriteStream wi(ls, false, false);
parent().par_->write(wi);
- return ls.str().c_str();
+ return STRCONV(ls.str());
}
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();
}
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;
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);
mathcursor->niceInsert(argument);
updateLocal(bv, true);
break;
-
+
case -1:
case LFUN_SELFINSERT:
if (!argument.empty()) {
string InsetFormulaBase::selectionAsString() const
{
- return mathcursor ? mathcursor->grabSelection() : string();
+ return mathcursor ? mathcursor->grabSelection() : string();
}
/////////////////////////////////////////////////////////////////////
}
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);
}
InsetFormulaMacro::InsetFormulaMacro(string const & s)
{
- std::istringstream is(s);
+ std::istringstream is(STRCONV(s));
read(is);
}
#ifdef __GNUG__
-#pragma implementation
+#pragma implementation
#endif
#include <config.h>
//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)) {
if (prevAtom()->asSymbolInset() || prevAtom()->asScriptInset())
prevAtom()->infoize(os);
os << " ";
- return os.str().c_str(); // .c_str() needed for lyxstring
+ return STRCONV(os.str());
}
-
#ifdef __GNUG__
-#pragma implementation
+#pragma implementation
#endif
#include "math_diminset.h"
/*
std::ostringstream os;
os << MathAtom(this);
- pain.draw(x, y, os.str().c_str());
+ pain.draw(x, y, STRCONV(os.str()));
*/
}
-
#ifdef __GNUG__
-#pragma implementation
+#pragma implementation
#endif
// This file contains most of the magic that extracts "context
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);
}
{
return
testIntSymbol(at) ||
- ( at->asScriptInset()
+ ( at->asScriptInset()
&& at->asScriptInset()->nuc().size()
&& testIntSymbol(at->asScriptInset()->nuc().back()) );
}
{
return
testSumSymbol(at) ||
- ( at->asScriptInset()
+ ( at->asScriptInset()
&& at->asScriptInset()->nuc().size()
&& testSumSymbol(at->asScriptInset()->nuc().back()) );
}
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)
// 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());
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;
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";
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";
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);
using std::endl;
+
namespace {
// file scope
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;
// 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))
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)) {
}
} 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";
{
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")
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";
void MathHullInset::addCol(col_type col)
{
- if (colChangeOK())
+ if (colChangeOK())
MathGridInset::addCol(col);
else
lyxerr << "Can't change number of columns in '" << type_ << "'\n";
void MathHullInset::delCol(col_type col)
{
- if (colChangeOK())
+ if (colChangeOK())
MathGridInset::delCol(col);
else
lyxerr << "Can't change number of columns in '" << type_ << "'\n";
}
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") {
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;
}
#include <config.h>
#ifdef __GNUG__
-#pragma implementation
+#pragma implementation
#endif
#include "math_inset.h"
MathInset::result_type
- MathInset::dispatch(FuncRequest const &, idx_type &, pos_type &)
+ MathInset::dispatch(FuncRequest const &, idx_type &, pos_type &)
{
return UNDISPATCHED;
}
std::ostringstream os;
WriteStream ws(os);
ws << ar;
- return os.str().c_str();
+ return STRCONV(os.str());
}
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',' ');
}
}
}
}
- return ost.str().c_str();
+ return STRCONV(ost.str());
}
*/
#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;
return make_pair(false, str);
}
-
+
int openTag(ostream & os, Paragraph::depth_type depth,
bool mixcont, string const & latexname)
{
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
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;
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);
}
#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
}
{
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)
#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
.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");
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");
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;
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)
{
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_);