mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
more tostr fixes and stricter lyxstring again + lyxstring & operator+=(int)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@213 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ba452ec219
commit
2f3e0b32e6
37
ChangeLog
37
ChangeLog
@ -1,3 +1,40 @@
|
||||
1999-10-19 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/chset.C (encodeString): use a char temporary instead
|
||||
|
||||
* src/table.C (TexEndOfCell): added tostr around
|
||||
column_of_cell(fcell+i)+1 and around right_column_of_cell(fcell+i)+1
|
||||
(TexEndOfCell): ditto
|
||||
(TexEndOfCell): ditto
|
||||
(TexEndOfCell): ditto
|
||||
(DocBookEndOfCell): ditto
|
||||
(DocBookEndOfCell): ditto
|
||||
(DocBookEndOfCell): ditto
|
||||
(DocBookEndOfCell): ditto
|
||||
|
||||
* src/paragraph.C (TeXEnvironment): added tostr around foot_count -1
|
||||
|
||||
* src/lyxfr1.C (SearchReplaceAllCB): added tostr around replace_count
|
||||
|
||||
* src/lyx_cb.C (MenuRunLaTeX): added tostr around ret
|
||||
(MenuBuildProg): added tostr around ret
|
||||
(MenuRunChktex): added tostr around ret
|
||||
(DocumentApplyCB): added tostr around ret
|
||||
|
||||
* src/chset.C (encodeString): added tostr around t->ic
|
||||
|
||||
* src/buffer.C (makeLaTeXFile): added tostr around secnumdepth
|
||||
(makeLaTeXFile): added tostr around tocdepth
|
||||
(makeLaTeXFile): added tostr around ftcound - 1
|
||||
|
||||
* src/insets/insetbib.C (setCounter): added tostr around counter.
|
||||
|
||||
* src/support/lyxstring.h: added an operator+=(int) to catch more
|
||||
mistakes.
|
||||
|
||||
* src/support/lyxstring.C (lyxstring): We DON'T allow NULL pointers.
|
||||
(lyxstring): We DON'T allow NULL pointers.
|
||||
|
||||
1999-10-19 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* src/mathed/math_macro.C (MathMacroArgument::Write,
|
||||
|
@ -1832,13 +1832,13 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
|
||||
if (params.secnumdepth != tclass->secnumdepth) {
|
||||
LFile += "\\setcounter{secnumdepth}{";
|
||||
LFile += params.secnumdepth;
|
||||
LFile += tostr(params.secnumdepth);
|
||||
LFile += "}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
if (params.tocdepth != tclass->tocdepth) {
|
||||
LFile += "\\setcounter{tocdepth}{";
|
||||
LFile += params.tocdepth;
|
||||
LFile += tostr(params.tocdepth);
|
||||
LFile += "}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
@ -1995,7 +1995,7 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
if (ftcount >= 1) {
|
||||
if (ftcount > 1) {
|
||||
LFile += "\\addtocounter{footnote}{-";
|
||||
LFile += ftcount - 1;
|
||||
LFile += tostr(ftcount - 1);
|
||||
LFile += '}';
|
||||
}
|
||||
LFile += ftnote;
|
||||
|
@ -98,15 +98,14 @@ bool CharacterSet::loadFile(const string& fname)
|
||||
}
|
||||
|
||||
|
||||
bool CharacterSet::encodeString(string& str)
|
||||
bool CharacterSet::encodeString(string & str)
|
||||
{
|
||||
Cdef *t=map_;
|
||||
|
||||
while(t) {
|
||||
if (t->str==str) {
|
||||
str.erase();
|
||||
str += t->ic;
|
||||
//str = tostr(t->ic);
|
||||
// Can this fail? Why is ic an unsigned char?
|
||||
str = char(t->ic);
|
||||
break;
|
||||
}
|
||||
t=t->next;
|
||||
|
@ -231,7 +231,7 @@ void InsetBibKey::setCounter(int c)
|
||||
counter = c;
|
||||
|
||||
if (contents.empty())
|
||||
contents += counter;
|
||||
contents += tostr(counter);
|
||||
}
|
||||
|
||||
|
||||
|
@ -465,7 +465,7 @@ int MenuRunLaTeX(Buffer *buffer)
|
||||
s = _("One error detected");
|
||||
t = _("You should try to fix it.");
|
||||
} else {
|
||||
s += ret;
|
||||
s += tostr(ret);
|
||||
s += _(" errors detected.");
|
||||
t = _("You should try to fix them.");
|
||||
}
|
||||
@ -497,7 +497,7 @@ int MenuBuildProg(Buffer *buffer)
|
||||
s = _("One error detected");
|
||||
t = _("You should try to fix it.");
|
||||
} else {
|
||||
s += ret;
|
||||
s += tostr(ret);
|
||||
s += _(" errors detected.");
|
||||
t = _("You should try to fix them.");
|
||||
}
|
||||
@ -526,7 +526,7 @@ int MenuRunChktex(Buffer *buffer)
|
||||
s = _("One warning found.");
|
||||
t = _("Use 'Edit->Go to Error' to find it.");
|
||||
} else {
|
||||
s += ret;
|
||||
s += tostr(ret);
|
||||
s += _(" warnings found.");
|
||||
t = _("Use 'Edit->Go to Error' to find them.");
|
||||
}
|
||||
@ -2886,7 +2886,7 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
|
||||
if (ret==1)
|
||||
s= _("One paragraph couldn't be converted");
|
||||
else {
|
||||
s += ret;
|
||||
s += tostr(ret);
|
||||
s += _(" paragraphs couldn't be converted");
|
||||
}
|
||||
WriteAlert(_("Conversion Errors!"),s,
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "LyXView.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "minibuffer.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
extern BufferView *current_view; // called too many times in this file...
|
||||
extern MiniBuffer *minibuffer;
|
||||
@ -234,8 +235,7 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
||||
if( replace_count == 1 ) {
|
||||
minibuffer->Set(_("1 string has been replaced."));
|
||||
} else {
|
||||
string str;
|
||||
str += replace_count;
|
||||
string str = tostr(replace_count);
|
||||
str += _(" strings have been replaced.");
|
||||
minibuffer->Set(str);
|
||||
}
|
||||
|
@ -3526,7 +3526,7 @@ LyXParagraph* LyXParagraph::TeXEnvironment(string &file, TexRow &texrow,
|
||||
if (foot_count >= 1) {
|
||||
if (foot_count > 1) {
|
||||
file += "\\addtocounter{footnote}{-";
|
||||
file += foot_count - 1;
|
||||
file += tostr(foot_count - 1);
|
||||
file += '}';
|
||||
}
|
||||
file += foot;
|
||||
|
@ -342,7 +342,7 @@ lyxstring::lyxstring(value_type const * s, size_type n)
|
||||
{
|
||||
Assert(s); // we don't allow null pointers
|
||||
static Srep empty_rep(0, "");
|
||||
if (s && *s && n) { // s is not empty string and n > 0
|
||||
if (*s && n) { // s is not empty string and n > 0
|
||||
rep = new Srep(min(strlen(s), n), s);
|
||||
} else {
|
||||
++empty_rep.ref;
|
||||
@ -353,10 +353,9 @@ lyxstring::lyxstring(value_type const * s, size_type n)
|
||||
|
||||
lyxstring::lyxstring(value_type const * s)
|
||||
{
|
||||
// yes we allow them just don't initalize them
|
||||
// Assert(s); // we don't allow null pointers
|
||||
Assert(s); // we don't allow null pointers
|
||||
static Srep empty_rep(0, "");
|
||||
if (s && *s) { // s is not empty string
|
||||
if (*s) { // s is not empty string
|
||||
rep = new Srep(strlen(s), s);
|
||||
} else {
|
||||
++empty_rep.ref;
|
||||
|
@ -510,6 +510,8 @@ private:
|
||||
lyxstring & operator+(int);
|
||||
///
|
||||
lyxstring & operator=(int);
|
||||
///
|
||||
lyxstring & operator+=(int);
|
||||
|
||||
/// A string representation
|
||||
struct Srep {
|
||||
|
47
src/table.C
47
src/table.C
@ -15,6 +15,7 @@
|
||||
#include "table.h"
|
||||
#include "vspace.h"
|
||||
#include "layout.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
@ -1010,9 +1011,9 @@ int LyXTable::TexEndOfCell(string& file, int cell)
|
||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
||||
if (BottomLine(fcell+i)){
|
||||
file += "\\cline{";
|
||||
file += column_of_cell(fcell+i)+1;
|
||||
file += tostr(column_of_cell(fcell+i)+1);
|
||||
file += '-';
|
||||
file += right_column_of_cell(fcell+i)+1;
|
||||
file += tostr(right_column_of_cell(fcell+i)+1);
|
||||
file += "} ";
|
||||
tmp = 1;
|
||||
}
|
||||
@ -1083,9 +1084,9 @@ int LyXTable::TexEndOfCell(string& file, int cell)
|
||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
||||
if (TopLine(fcell+i)){
|
||||
file += "\\cline{";
|
||||
file += column_of_cell(fcell+i)+1;
|
||||
file += tostr(column_of_cell(fcell+i)+1);
|
||||
file += '-';
|
||||
file += right_column_of_cell(fcell+i)+1;
|
||||
file += tostr(right_column_of_cell(fcell+i)+1);
|
||||
file += "} ";
|
||||
tmp = 1;
|
||||
}
|
||||
@ -1151,14 +1152,14 @@ int LyXTable::TexEndOfCell(string& file, int cell)
|
||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
||||
if (BottomLine(fcell+i)){
|
||||
file += "\\cline{";
|
||||
file += column_of_cell(fcell+i)+1;
|
||||
file += tostr(column_of_cell(fcell+i)+1);
|
||||
file += '-';
|
||||
file += right_column_of_cell(fcell+i)+1;
|
||||
file += tostr(right_column_of_cell(fcell+i)+1);
|
||||
file += "} ";
|
||||
hline1 += "\\cline{";
|
||||
hline1 += column_of_cell(fcell+i)+1;
|
||||
hline1 += tostr(column_of_cell(fcell+i)+1);
|
||||
hline1 += '-';
|
||||
hline1 += right_column_of_cell(fcell+i)+1;
|
||||
hline1 += tostr(right_column_of_cell(fcell+i)+1);
|
||||
hline1 += "} ";
|
||||
tmp = 1;
|
||||
}
|
||||
@ -1209,15 +1210,15 @@ int LyXTable::TexEndOfCell(string& file, int cell)
|
||||
if (TopLine(fcell+i)){
|
||||
if (print_hline) {
|
||||
file += "\\cline{";
|
||||
file += column_of_cell(fcell+i)+1;
|
||||
file += tostr(column_of_cell(fcell+i)+1);
|
||||
file += '-';
|
||||
file += right_column_of_cell(fcell+i)+1;
|
||||
file += tostr(right_column_of_cell(fcell+i)+1);
|
||||
file += "} ";
|
||||
}
|
||||
hline2 += "\\cline{";
|
||||
hline2 += column_of_cell(fcell+i)+1;
|
||||
hline2 += tostr(column_of_cell(fcell+i)+1);
|
||||
hline2 += '-';
|
||||
hline2 += right_column_of_cell(fcell+i)+1;
|
||||
hline2 += tostr(right_column_of_cell(fcell+i)+1);
|
||||
hline2 += "} ";
|
||||
tmp = 1;
|
||||
}
|
||||
@ -1279,7 +1280,7 @@ int LyXTable::TexEndOfCell(string& file, int cell)
|
||||
}
|
||||
if (nvcell < numberofcells && IsMultiColumn(nvcell)) {
|
||||
file += "\\multicolumn{";
|
||||
file += cells_in_multicolumn(nvcell);
|
||||
file += tostr(cells_in_multicolumn(nvcell));
|
||||
file += "}{";
|
||||
if (!cellinfo_of_cell(cell+1)->align_special.empty()) {
|
||||
file += cellinfo_of_cell(cell+1)->align_special;
|
||||
@ -1535,7 +1536,7 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
||||
else
|
||||
file += "<TGROUP ";
|
||||
file += "COLS='";
|
||||
file += columns;
|
||||
file += tostr(columns);
|
||||
file += "' COLSEP='1' ROWSEP='1'>";
|
||||
addNewlineAndDepth(file,++depth);
|
||||
ret++;
|
||||
@ -1543,9 +1544,9 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
||||
file += "<COLSPEC ALIGN='";
|
||||
file += getDocBookAlign(i, true);
|
||||
file += "' COLNAME='col";
|
||||
file += i+1;
|
||||
file += tostr(i+1);
|
||||
file += "' COLNUM='";
|
||||
file += i+1;
|
||||
file += tostr(i+1);
|
||||
file += "' COLSEP='";
|
||||
if (i == (columns-1)) {
|
||||
file += '1';
|
||||
@ -1606,7 +1607,7 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
||||
file += "'";
|
||||
if (IsMultiColumn(0)) {
|
||||
file += " NAMEST='col1' NAMEEND='col";
|
||||
file += cells_in_multicolumn(0);
|
||||
file += tostr(cells_in_multicolumn(0));
|
||||
file += "'";
|
||||
}
|
||||
file += ">";
|
||||
@ -1638,10 +1639,10 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
||||
file += "' VALIGN='middle'";
|
||||
if (IsMultiColumn(cell+1)) {
|
||||
file += " NAMEST='col";
|
||||
file += column_of_cell(cell+1) + 1;
|
||||
file += tostr(column_of_cell(cell+1) + 1);
|
||||
file += "' NAMEEND='col";
|
||||
file += column_of_cell(cell+1) +
|
||||
cells_in_multicolumn(cell+1);
|
||||
file += tostr(column_of_cell(cell+1) +
|
||||
cells_in_multicolumn(cell+1));
|
||||
file += "'";
|
||||
}
|
||||
file += ">";
|
||||
@ -1807,10 +1808,10 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
||||
file += "' VALIGN='middle'";
|
||||
if (IsMultiColumn(cell+1)) {
|
||||
file += " NAMEST='col";
|
||||
file += column_of_cell(cell+1) + 1;
|
||||
file += tostr(column_of_cell(cell+1) + 1);
|
||||
file += "' NAMEEND='col";
|
||||
file += column_of_cell(cell+1) +
|
||||
cells_in_multicolumn(cell+1);
|
||||
file += tostr(column_of_cell(cell+1) +
|
||||
cells_in_multicolumn(cell+1));
|
||||
file += "'";
|
||||
}
|
||||
file += ">";
|
||||
|
Loading…
Reference in New Issue
Block a user