mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
Ensure that InsetVSpace works with the new, simpler lyxlex syntax.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8182 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7c12de7d3d
commit
51fa9803d3
@ -1,3 +1,9 @@
|
||||
2003-12-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyxlex.[Ch] (operator void const *): add the 'const' to the return
|
||||
type. Add a comment in the implementation that the function uses
|
||||
the stream's bad() function rather than fail() as the std::streams
|
||||
would do.
|
||||
|
||||
2003-12-02 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-12-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetvspace.[Ch] (space): new member function. Make space_ private.
|
||||
(read): use the new, simpler lyxlex syntax.
|
||||
|
||||
2003-12-01 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insetcollapsable.[Ch]:
|
||||
|
@ -78,21 +78,21 @@ InsetVSpace::priv_dispatch(FuncRequest const & cmd,
|
||||
return InsetOld::priv_dispatch(cmd, idx, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void InsetVSpace::read(Buffer const &, LyXLex & lex)
|
||||
{
|
||||
if (lex.isOK()) {
|
||||
lex.next();
|
||||
space_ = VSpace(lex.getString());
|
||||
}
|
||||
BOOST_ASSERT(lex.isOK());
|
||||
string vsp;
|
||||
lex >> vsp;
|
||||
if (lex)
|
||||
space_ = VSpace(vsp);
|
||||
|
||||
if (lex.isOK())
|
||||
lex.next();
|
||||
if (lex.getString() != "\\end_inset") {
|
||||
string end_token;
|
||||
lex >> end_token;
|
||||
if (end_token != "\\end_inset")
|
||||
lex.printError("Missing \\end_inset at this point. "
|
||||
"Read: `$$Token'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -232,7 +232,7 @@ InsetVSpaceMailer::InsetVSpaceMailer(InsetVSpace & inset)
|
||||
|
||||
string const InsetVSpaceMailer::inset2string(Buffer const &) const
|
||||
{
|
||||
return params2string(inset_.space_);
|
||||
return params2string(inset_.space());
|
||||
}
|
||||
|
||||
|
||||
@ -247,7 +247,7 @@ void InsetVSpaceMailer::string2params(string const & in, VSpace & vspace)
|
||||
LyXLex lex(0,0);
|
||||
lex.setStream(data);
|
||||
string name, vsp;
|
||||
lex >> name >> vsp;
|
||||
lex >> name >> vsp;
|
||||
if (lex)
|
||||
vspace = VSpace(vsp);
|
||||
}
|
||||
|
@ -36,19 +36,21 @@ public:
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int linuxdoc(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
OutputParams const &) const;
|
||||
///
|
||||
void read(Buffer const &, LyXLex & lex);
|
||||
///
|
||||
void write(Buffer const & buf, std::ostream & os) const;
|
||||
///
|
||||
bool display() const { return true; }
|
||||
/// How much?
|
||||
VSpace const & space() const { return space_; }
|
||||
|
||||
protected:
|
||||
///
|
||||
@ -56,8 +58,8 @@ protected:
|
||||
DispatchResult
|
||||
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
||||
|
||||
public:
|
||||
/// how much
|
||||
private:
|
||||
///
|
||||
VSpace space_;
|
||||
};
|
||||
|
||||
|
11
src/lyxlex.C
11
src/lyxlex.C
@ -256,15 +256,19 @@ int LyXLex::findToken(char const * str[])
|
||||
}
|
||||
|
||||
|
||||
LyXLex::operator void *() const
|
||||
LyXLex::operator void const *() const
|
||||
{
|
||||
return isOK() ? const_cast<LyXLex *>(this) : 0;
|
||||
// This behaviour is NOT the same as the std::streams which would
|
||||
// use fail() here. However, our implementation of getString() et al.
|
||||
// can cause the eof() and fail() bits to be set, even though we
|
||||
// haven't tried to read 'em.
|
||||
return pimpl_->is.bad() ? 0 : this;
|
||||
}
|
||||
|
||||
|
||||
bool LyXLex::operator!() const
|
||||
{
|
||||
return !isOK();
|
||||
return pimpl_->is.bad();
|
||||
}
|
||||
|
||||
|
||||
@ -317,4 +321,3 @@ LyXLex & LyXLex::operator>>(bool & s)
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,10 +55,10 @@ public:
|
||||
LEX_TOKEN = -4
|
||||
};
|
||||
|
||||
/// straem is open and end of straem is not reached
|
||||
/// stream is open and end of stream is not reached
|
||||
bool isOK() const;
|
||||
/// stream is ok
|
||||
operator void *() const;
|
||||
operator void const *() const;
|
||||
/// stream is not ok
|
||||
bool operator!() const;
|
||||
/// return true if able to open file, else false
|
||||
|
Loading…
Reference in New Issue
Block a user