From c544988f28b84fb877a856f19a45f3b3e6c998f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 25 Jul 2001 22:05:53 +0000 Subject: [PATCH] handle missing parameters more gracefully git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2349 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/ChangeLog | 6 +++++ src/insets/insetcollapsable.C | 2 ++ src/insets/insetminipage.C | 48 ++++++++++++++++++++--------------- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 7101c8b40a..3a044554a0 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2001-07-26 Lars Gullik Bjønnes + + * insetminipage.C (read): handle missing parameters more gracefully + + * insetcollapsable.C (read): handel missing collapsed more gracefully + 2001-07-25 Lars Gullik Bjønnes * insetfloat.C (read): handle missing parameters. diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index b48f7a185e..2b9bdcd9d0 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -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); diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index 99db750f1d..b8afb1cd24 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -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(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()) { - lex.next(); - token = lex.GetString(); - } + //if (token.empty()) { + lex.next(); + string const token = lex.GetString(); + //} if (token == "inner_position") { lex.next(); inner_pos_ = static_cast(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()) { - lex.next(); - token = lex.GetString(); - } + //if (token.empty()) { + lex.next(); + 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()) { - lex.next(); - token = lex.GetString(); - } + //if (token.empty()) { + lex.next(); + 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; + // take countermeasures + lex.pushToken(token); } } - if (!token.empty()) - lex.pushToken(token); + //if (!token.empty()) + // lex.pushToken(token); InsetCollapsable::read(buf, lex); } -- 2.39.2