handle missing parameters more gracefully

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2349 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-07-25 22:05:53 +00:00
parent 817c9751c1
commit c544988f28
3 changed files with 36 additions and 20 deletions

View File

@ -1,3 +1,9 @@
2001-07-26 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insetminipage.C (read): handle missing parameters more gracefully
* insetcollapsable.C (read): handel missing collapsed more gracefully
2001-07-25 Lars Gullik Bjønnes <larsbj@birdstep.com> 2001-07-25 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insetfloat.C (read): handle missing parameters. * insetfloat.C (read): handle missing parameters.

View File

@ -116,6 +116,8 @@ void InsetCollapsable::read(Buffer const * buf, LyXLex & lex)
} else { } else {
lyxerr << "InsetCollapsable::Read: Missing collapsed!" lyxerr << "InsetCollapsable::Read: Missing collapsed!"
<< endl; << endl;
// Take countermeasures
lex.pushToken(token);
} }
} }
inset.read(buf, lex); inset.read(buf, lex);

View File

@ -110,64 +110,72 @@ void InsetMinipage::write(Buffer const * buf, ostream & os) const
void InsetMinipage::read(Buffer const * buf, LyXLex & lex) void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
{ {
string token; //string token;
if (lex.IsOK()) { if (lex.IsOK()) {
lex.next(); lex.next();
token = lex.GetString(); string const token = lex.GetString();
if (token == "position") { if (token == "position") {
lex.next(); lex.next();
pos_ = static_cast<Position>(lex.GetInteger()); pos_ = static_cast<Position>(lex.GetInteger());
token = string(); //token = string();
} else { } else {
lyxerr << "InsetMinipage::Read: Missing 'position'-tag!" lyxerr << "InsetMinipage::Read: Missing 'position'-tag!"
<< endl; << endl;
// take countermeasures
lex.pushToken(token);
} }
} }
if (lex.IsOK()) { if (lex.IsOK()) {
if (token.empty()) { //if (token.empty()) {
lex.next(); lex.next();
token = lex.GetString(); string const token = lex.GetString();
} //}
if (token == "inner_position") { if (token == "inner_position") {
lex.next(); lex.next();
inner_pos_ = static_cast<InnerPosition>(lex.GetInteger()); inner_pos_ = static_cast<InnerPosition>(lex.GetInteger());
token = string(); //token = string();
} else { } else {
lyxerr << "InsetMinipage::Read: Missing 'inner_position'-tag!" lyxerr << "InsetMinipage::Read: Missing 'inner_position'-tag!"
<< endl; << endl;
// take countermeasures
lex.pushToken(token);
} }
} }
if (lex.IsOK()) { if (lex.IsOK()) {
if (token.empty()) { //if (token.empty()) {
lex.next(); lex.next();
token = lex.GetString(); string const token = lex.GetString();
} //}
if (token == "height") { if (token == "height") {
lex.next(); lex.next();
height_ = lex.GetString(); height_ = lex.GetString();
token = string(); //token = string();
} else { } else {
lyxerr << "InsetMinipage::Read: Missing 'height'-tag!" lyxerr << "InsetMinipage::Read: Missing 'height'-tag!"
<< endl; << endl;
// take countermeasures
lex.pushToken(token);
} }
} }
if (lex.IsOK()) { if (lex.IsOK()) {
if (token.empty()) { //if (token.empty()) {
lex.next(); lex.next();
token = lex.GetString(); string const token = lex.GetString();
} //}
if (token == "width") { if (token == "width") {
lex.next(); lex.next();
width_ = lex.GetString(); width_ = lex.GetString();
token = string(); //token = string();
} else { } else {
lyxerr << "InsetMinipage::Read: Missing 'width'-tag!" lyxerr << "InsetMinipage::Read: Missing 'width'-tag!"
<< endl; << endl;
} // take countermeasures
}
if (!token.empty())
lex.pushToken(token); lex.pushToken(token);
}
}
//if (!token.empty())
// lex.pushToken(token);
InsetCollapsable::read(buf, lex); InsetCollapsable::read(buf, lex);
} }