mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Simplify constructors
This commit is contained in:
parent
ff1ab048f1
commit
f953d88c88
@ -18,16 +18,12 @@ namespace lyx {
|
||||
class Dimension {
|
||||
public:
|
||||
/// constructor
|
||||
Dimension() : wid(0), asc(0), des(0) {}
|
||||
Dimension() = default;
|
||||
/// initialize data
|
||||
Dimension(int w, int a, int d) : wid(w), asc(a), des(d) {}
|
||||
///
|
||||
Dimension & operator=(Dimension const & dim) = default;
|
||||
|
||||
Dimension & operator=(Dimension const & dim) {
|
||||
wid = dim.wid;
|
||||
asc = dim.asc;
|
||||
des = dim.des;
|
||||
return *this;
|
||||
}
|
||||
/// glue horizontally
|
||||
void operator+=(Dimension const & dim);
|
||||
/// set to empty box
|
||||
@ -59,35 +55,33 @@ public:
|
||||
///
|
||||
/// makes the code neither faster nor clearer
|
||||
/// width
|
||||
int wid;
|
||||
int wid = 0;
|
||||
/// ascent
|
||||
int asc;
|
||||
int asc = 0;
|
||||
/// descent
|
||||
int des;
|
||||
int des = 0;
|
||||
};
|
||||
|
||||
inline
|
||||
bool operator==(Dimension const & a, Dimension const & b)
|
||||
{
|
||||
return a.wid == b.wid && a.asc == b.asc && a.des == b.des ;
|
||||
return a.wid == b.wid && a.asc == b.asc && a.des == b.des;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool operator!=(Dimension const & a, Dimension const & b)
|
||||
{
|
||||
return a.wid != b.wid || a.asc != b.asc || a.des != b.des ;
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
class Point {
|
||||
public:
|
||||
Point()
|
||||
: x_(0), y_(0)
|
||||
{}
|
||||
|
||||
Point() = default;
|
||||
Point(int x, int y);
|
||||
|
||||
int x_, y_;
|
||||
int x_ = 0;
|
||||
int y_ = 0;
|
||||
};
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -631,7 +631,7 @@ void PreviewLoader::Impl::startLoading(bool wait)
|
||||
|
||||
// Set \jobname of previews to the document name (see bug 9627)
|
||||
of << "\\def\\jobname{"
|
||||
<< from_utf8(changeExtension(buffer_.latexName(true), ""))
|
||||
<< from_utf8(changeExtension(buffer_.latexName(), ""))
|
||||
<< "}\n";
|
||||
|
||||
LYXERR(Debug::LATEX, "Format = " << buffer_.params().getDefaultOutputFormat());
|
||||
|
@ -47,8 +47,7 @@ namespace lyx {
|
||||
|
||||
|
||||
MathData::MathData(Buffer * buf, const_iterator from, const_iterator to)
|
||||
: base_type(from, to), minasc_(0), mindes_(0), slevel_(0),
|
||||
sshift_(0), buffer_(buf)
|
||||
: base_type(from, to), buffer_(buf)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -68,8 +68,9 @@ public:
|
||||
|
||||
public:
|
||||
///
|
||||
explicit MathData(Buffer * buf = 0) : minasc_(0), mindes_(0), slevel_(0),
|
||||
sshift_(0), buffer_(buf) {}
|
||||
MathData() = default;
|
||||
///
|
||||
explicit MathData(Buffer * buf) : buffer_(buf) {}
|
||||
///
|
||||
MathData(Buffer * buf, const_iterator from, const_iterator to);
|
||||
///
|
||||
@ -186,11 +187,11 @@ public:
|
||||
|
||||
protected:
|
||||
/// cached values for super/subscript placement
|
||||
mutable int minasc_;
|
||||
mutable int mindes_;
|
||||
mutable int slevel_;
|
||||
mutable int sshift_;
|
||||
Buffer * buffer_;
|
||||
mutable int minasc_ = 0;
|
||||
mutable int mindes_ = 0;
|
||||
mutable int slevel_ = 0;
|
||||
mutable int sshift_ = 0;
|
||||
Buffer * buffer_ = nullptr;
|
||||
|
||||
private:
|
||||
/// is this an exact match at this position?
|
||||
|
@ -126,11 +126,8 @@ WriteStream & operator<<(WriteStream & ws, docstring const & s)
|
||||
|
||||
WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex,
|
||||
OutputType output, Encoding const * encoding)
|
||||
: os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
|
||||
output_(output), pendingspace_(false), pendingbrace_(false),
|
||||
textmode_(false), locked_(false), ascii_(false), canbreakline_(true),
|
||||
mathsout_(false), ulemcmd_(NONE), line_(0), encoding_(encoding),
|
||||
row_entry_(TexRow::row_none), mathclass_(false)
|
||||
: os_(os), fragile_(fragile), latex_(latex),
|
||||
output_(output), encoding_(encoding)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
///
|
||||
explicit WriteStream(otexrowstream & os, bool fragile = false,
|
||||
bool latex = false, OutputType output = wsDefault,
|
||||
Encoding const * encoding = 0);
|
||||
Encoding const * encoding = nullptr);
|
||||
///
|
||||
~WriteStream();
|
||||
///
|
||||
@ -116,37 +116,37 @@ private:
|
||||
///
|
||||
otexrowstream & os_;
|
||||
/// do we have to write \\protect sometimes
|
||||
bool fragile_;
|
||||
bool fragile_ = false;
|
||||
/// are we at the beginning of an MathData?
|
||||
bool firstitem_;
|
||||
bool firstitem_ = false;
|
||||
/// are we writing to .tex?
|
||||
int latex_;
|
||||
int latex_ = false;
|
||||
/// output type (default, source preview, instant preview)?
|
||||
OutputType output_;
|
||||
OutputType output_ = wsDefault;
|
||||
/// do we have a space pending?
|
||||
bool pendingspace_;
|
||||
bool pendingspace_ = false;
|
||||
/// do we have a brace pending?
|
||||
bool pendingbrace_;
|
||||
bool pendingbrace_ = false;
|
||||
/// are we in text mode when producing latex code?
|
||||
bool textmode_;
|
||||
bool textmode_ = false;
|
||||
/// are we allowed to switch mode when producing latex code?
|
||||
bool locked_;
|
||||
bool locked_ = false;
|
||||
/// should we use only ascii chars when producing latex code?
|
||||
bool ascii_;
|
||||
bool ascii_ = false;
|
||||
/// are we allowed to output an immediately following newline?
|
||||
bool canbreakline_;
|
||||
bool canbreakline_ = true;
|
||||
/// should we take care for striking out display math?
|
||||
bool mathsout_;
|
||||
bool mathsout_ = false;
|
||||
/// what ulem command are we inside (none, underline, strikeout)?
|
||||
UlemCmdType ulemcmd_;
|
||||
UlemCmdType ulemcmd_ = NONE;
|
||||
///
|
||||
int line_;
|
||||
int line_ = 0;
|
||||
///
|
||||
Encoding const * encoding_;
|
||||
Encoding const * encoding_ = nullptr;
|
||||
/// Row entry we are in
|
||||
TexRow::RowEntry row_entry_;
|
||||
TexRow::RowEntry row_entry_ = TexRow::row_none;
|
||||
/// whether we are in a MathClass inset
|
||||
bool mathclass_;
|
||||
bool mathclass_ = false;
|
||||
};
|
||||
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user