Fix compilation with gcc 4.6 part II

This commit is contained in:
Guillaume Munch 2016-06-14 19:22:24 +01:00
parent 43d284e15a
commit 52dd5dc84f
6 changed files with 27 additions and 33 deletions

View File

@ -36,9 +36,10 @@ namespace lyx {
// //
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
MetricsBase::MetricsBase() MetricsBase::MetricsBase(BufferView * b, FontInfo f, int w)
: bv(0), font(), style(LM_ST_TEXT), fontname("mathnormal"), textwidth(0), : bv(b), font(move(f)), style(LM_ST_TEXT), fontname("mathnormal"),
solid_line_thickness_(1), solid_line_offset_(1), dotted_line_thickness_(1) textwidth(w), solid_line_thickness_(1), solid_line_offset_(1),
dotted_line_thickness_(1)
{ {
if (lyxrc.zoom >= 200) { if (lyxrc.zoom >= 200) {
// derive the line thickness from zoom factor // derive the line thickness from zoom factor
@ -57,15 +58,6 @@ MetricsBase::MetricsBase()
} }
MetricsBase::MetricsBase(BufferView * b, FontInfo f, int w)
: MetricsBase()
{
bv = b;
font = f;
textwidth = w;
}
Changer MetricsBase::changeFontSet(string const & name, bool cond) Changer MetricsBase::changeFontSet(string const & name, bool cond)
{ {
RefChanger<MetricsBase> rc = make_save(*this); RefChanger<MetricsBase> rc = make_save(*this);

View File

@ -52,9 +52,8 @@ enum Styles {
class MetricsBase { class MetricsBase {
public: public:
/// ///
MetricsBase(); MetricsBase(BufferView * bv = 0, FontInfo font = FontInfo(),
/// int textwidth = 0);
MetricsBase(BufferView * bv, FontInfo font, int textwidth);
/// the current view /// the current view
BufferView * bv; BufferView * bv;

View File

@ -124,20 +124,10 @@ WriteStream & operator<<(WriteStream & ws, docstring const & s)
WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex, WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex,
OutputType output, Encoding const * encoding) OutputType output, Encoding const * encoding)
: WriteStream(os) : os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
{ output_(output), pendingspace_(false), pendingbrace_(false),
fragile_ = fragile;
latex_ = latex;
output_ = output;
encoding_ = encoding;
}
WriteStream::WriteStream(otexrowstream & os)
: os_(os), fragile_(false), firstitem_(false), latex_(false),
output_(wsDefault), pendingspace_(false), pendingbrace_(false),
textmode_(false), locked_(0), ascii_(0), canbreakline_(true), textmode_(false), locked_(0), ascii_(0), canbreakline_(true),
line_(0), encoding_(0), row_entry_(TexRow::row_none) line_(0), encoding_(encoding), row_entry_(TexRow::row_none)
{} {}

View File

@ -39,10 +39,9 @@ public:
wsPreview wsPreview
}; };
/// ///
WriteStream(otexrowstream & os, bool fragile, bool latex, OutputType output, explicit WriteStream(otexrowstream & os, bool fragile = false,
Encoding const * encoding = 0); bool latex = false, OutputType output = wsDefault,
/// Encoding const * encoding = 0);
explicit WriteStream(otexrowstream & os);
/// ///
~WriteStream(); ~WriteStream();
/// ///

View File

@ -24,7 +24,9 @@ struct Revertible {
virtual void keep() {} virtual void keep() {}
}; };
using Changer = unique_ptr<Revertible>; //for gcc 4.6
//using Changer = unique_ptr<Revertible>;
typedef unique_ptr<Revertible> Changer;
} }

View File

@ -45,7 +45,19 @@ private:
bool enabled; bool enabled;
}; };
//for gcc 4.6
#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
template <typename X>
struct RefChanger : unique_ptr<RevertibleRef<X>>
{
RefChanger(unique_ptr<RevertibleRef<X>> p)
: unique_ptr<RevertibleRef<X>>(move(p))
{}
};
#else
template <typename X> using RefChanger = unique_ptr<RevertibleRef<X>>; template <typename X> using RefChanger = unique_ptr<RevertibleRef<X>>;
#endif
/// Saves the value of \param ref in a movable object /// Saves the value of \param ref in a movable object