From 52dd5dc84f3a9f836903aeaca49f27e45cda6dce Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Tue, 14 Jun 2016 19:22:24 +0100 Subject: [PATCH] Fix compilation with gcc 4.6 part II --- src/MetricsInfo.cpp | 16 ++++------------ src/MetricsInfo.h | 5 ++--- src/mathed/MathStream.cpp | 16 +++------------- src/mathed/MathStream.h | 7 +++---- src/support/Changer.h | 4 +++- src/support/RefChanger.h | 12 ++++++++++++ 6 files changed, 27 insertions(+), 33 deletions(-) diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 5e10df1d6d..9f2baa81aa 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -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 rc = make_save(*this); diff --git a/src/MetricsInfo.h b/src/MetricsInfo.h index 18dbbe3540..d2dd8b7bcf 100644 --- a/src/MetricsInfo.h +++ b/src/MetricsInfo.h @@ -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; diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp index e91db433f9..78838ccd0a 100644 --- a/src/mathed/MathStream.cpp +++ b/src/mathed/MathStream.cpp @@ -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) {} diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h index 6f432b65fc..479e9d459e 100644 --- a/src/mathed/MathStream.h +++ b/src/mathed/MathStream.h @@ -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(); /// diff --git a/src/support/Changer.h b/src/support/Changer.h index 8f24ba5c89..9d85c26200 100644 --- a/src/support/Changer.h +++ b/src/support/Changer.h @@ -24,7 +24,9 @@ struct Revertible { virtual void keep() {} }; -using Changer = unique_ptr; +//for gcc 4.6 +//using Changer = unique_ptr; +typedef unique_ptr Changer; } diff --git a/src/support/RefChanger.h b/src/support/RefChanger.h index 9b9d020a41..baf3d840eb 100644 --- a/src/support/RefChanger.h +++ b/src/support/RefChanger.h @@ -45,7 +45,19 @@ private: bool enabled; }; + +//for gcc 4.6 +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 6) +template +struct RefChanger : unique_ptr> +{ + RefChanger(unique_ptr> p) + : unique_ptr>(move(p)) + {} +}; +#else template using RefChanger = unique_ptr>; +#endif /// Saves the value of \param ref in a movable object -- 2.39.2