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()
: bv(0), font(), style(LM_ST_TEXT), fontname("mathnormal"), textwidth(0),
solid_line_thickness_(1), solid_line_offset_(1), dotted_line_thickness_(1)
MetricsBase::MetricsBase(BufferView * b, FontInfo f, int w)
: bv(b), font(move(f)), style(LM_ST_TEXT), fontname("mathnormal"),
textwidth(w), solid_line_thickness_(1), solid_line_offset_(1),
dotted_line_thickness_(1)
{
if (lyxrc.zoom >= 200) {
// 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)
{
RefChanger<MetricsBase> rc = make_save(*this);

View File

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

View File

@ -124,20 +124,10 @@ WriteStream & operator<<(WriteStream & ws, docstring const & s)
WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex,
OutputType output, Encoding const * encoding)
: WriteStream(os)
{
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),
: os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
output_(output), pendingspace_(false), pendingbrace_(false),
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
};
///
WriteStream(otexrowstream & os, bool fragile, bool latex, OutputType output,
Encoding const * encoding = 0);
///
explicit WriteStream(otexrowstream & os);
explicit WriteStream(otexrowstream & os, bool fragile = false,
bool latex = false, OutputType output = wsDefault,
Encoding const * encoding = 0);
///
~WriteStream();
///

View File

@ -24,7 +24,9 @@ struct Revertible {
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;
};
//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>>;
#endif
/// Saves the value of \param ref in a movable object