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