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>
* insetfloat.C (read): handle missing parameters.

View File

@ -116,6 +116,8 @@ void InsetCollapsable::read(Buffer const * buf, LyXLex & lex)
} else {
lyxerr << "InsetCollapsable::Read: Missing collapsed!"
<< endl;
// Take countermeasures
lex.pushToken(token);
}
}
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)
{
string token;
//string token;
if (lex.IsOK()) {
lex.next();
token = lex.GetString();
string const token = lex.GetString();
if (token == "position") {
lex.next();
pos_ = static_cast<Position>(lex.GetInteger());
token = string();
//token = string();
} else {
lyxerr << "InsetMinipage::Read: Missing 'position'-tag!"
<< endl;
// take countermeasures
lex.pushToken(token);
}
}
if (lex.IsOK()) {
if (token.empty()) {
//if (token.empty()) {
lex.next();
token = lex.GetString();
}
string const token = lex.GetString();
//}
if (token == "inner_position") {
lex.next();
inner_pos_ = static_cast<InnerPosition>(lex.GetInteger());
token = string();
//token = string();
} else {
lyxerr << "InsetMinipage::Read: Missing 'inner_position'-tag!"
<< endl;
// take countermeasures
lex.pushToken(token);
}
}
if (lex.IsOK()) {
if (token.empty()) {
//if (token.empty()) {
lex.next();
token = lex.GetString();
}
string const token = lex.GetString();
//}
if (token == "height") {
lex.next();
height_ = lex.GetString();
token = string();
//token = string();
} else {
lyxerr << "InsetMinipage::Read: Missing 'height'-tag!"
<< endl;
// take countermeasures
lex.pushToken(token);
}
}
if (lex.IsOK()) {
if (token.empty()) {
//if (token.empty()) {
lex.next();
token = lex.GetString();
}
string const token = lex.GetString();
//}
if (token == "width") {
lex.next();
width_ = lex.GetString();
token = string();
//token = string();
} else {
lyxerr << "InsetMinipage::Read: Missing 'width'-tag!"
<< endl;
}
}
if (!token.empty())
// take countermeasures
lex.pushToken(token);
}
}
//if (!token.empty())
// lex.pushToken(token);
InsetCollapsable::read(buf, lex);
}