Patches

Yuriy Skalko yuriy.skalko at gmail.com
Thu Oct 29 06:47:23 UTC 2020


Next 3 patches.

Yuriy
-------------- next part --------------
From 37944992bf356680f8910d384df37ac3fb998339 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Mon, 26 Oct 2020 20:16:28 +0200
Subject: [PATCH 1/5] Move HullType functions declared in InsetMath.h into
 InsetMath.cpp

---
 src/mathed/InsetMath.cpp     | 42 ++++++++++++++++++++++++++++++++++++
 src/mathed/InsetMathHull.cpp | 42 ------------------------------------
 2 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/src/mathed/InsetMath.cpp b/src/mathed/InsetMath.cpp
index 1adeec10a8..33a9a4e6b4 100644
--- a/src/mathed/InsetMath.cpp
+++ b/src/mathed/InsetMath.cpp
@@ -30,6 +30,48 @@ using namespace std;
 
 namespace lyx {
 
+HullType hullType(docstring const & s)
+{
+	if (s == "none")      return hullNone;
+	if (s == "simple")    return hullSimple;
+	if (s == "equation")  return hullEquation;
+	if (s == "eqnarray")  return hullEqnArray;
+	if (s == "align")     return hullAlign;
+	if (s == "alignat")   return hullAlignAt;
+	if (s == "xalignat")  return hullXAlignAt;
+	if (s == "xxalignat") return hullXXAlignAt;
+	if (s == "multline")  return hullMultline;
+	if (s == "gather")    return hullGather;
+	if (s == "flalign")   return hullFlAlign;
+	if (s == "regexp")    return hullRegexp;
+	lyxerr << "unknown hull type '" << to_utf8(s) << "'" << endl;
+	return hullUnknown;
+}
+
+
+docstring hullName(HullType type)
+{
+	switch (type) {
+	case hullNone:       return from_ascii("none");
+	case hullSimple:     return from_ascii("simple");
+	case hullEquation:   return from_ascii("equation");
+	case hullEqnArray:   return from_ascii("eqnarray");
+	case hullAlign:      return from_ascii("align");
+	case hullAlignAt:    return from_ascii("alignat");
+	case hullXAlignAt:   return from_ascii("xalignat");
+	case hullXXAlignAt:  return from_ascii("xxalignat");
+	case hullMultline:   return from_ascii("multline");
+	case hullGather:     return from_ascii("gather");
+	case hullFlAlign:    return from_ascii("flalign");
+	case hullRegexp:     return from_ascii("regexp");
+	case hullUnknown:
+		lyxerr << "unknown hull type" << endl;
+		break;
+	}
+	return from_ascii("none");
+}
+
+
 docstring InsetMath::name() const
 {
 	return from_utf8("Unknown");
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 4125bf6ee5..43f49584af 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -147,51 +147,9 @@ namespace {
 			os << "}\\\\\n";
 	}
 
-
 } // namespace
 
 
-HullType hullType(docstring const & s)
-{
-	if (s == "none")      return hullNone;
-	if (s == "simple")    return hullSimple;
-	if (s == "equation")  return hullEquation;
-	if (s == "eqnarray")  return hullEqnArray;
-	if (s == "align")     return hullAlign;
-	if (s == "alignat")   return hullAlignAt;
-	if (s == "xalignat")  return hullXAlignAt;
-	if (s == "xxalignat") return hullXXAlignAt;
-	if (s == "multline")  return hullMultline;
-	if (s == "gather")    return hullGather;
-	if (s == "flalign")   return hullFlAlign;
-	if (s == "regexp")    return hullRegexp;
-	lyxerr << "unknown hull type '" << to_utf8(s) << "'" << endl;
-	return hullUnknown;
-}
-
-
-docstring hullName(HullType type)
-{
-	switch (type) {
-	case hullNone:       return from_ascii("none");
-	case hullSimple:     return from_ascii("simple");
-	case hullEquation:   return from_ascii("equation");
-	case hullEqnArray:   return from_ascii("eqnarray");
-	case hullAlign:      return from_ascii("align");
-	case hullAlignAt:    return from_ascii("alignat");
-	case hullXAlignAt:   return from_ascii("xalignat");
-	case hullXXAlignAt:  return from_ascii("xxalignat");
-	case hullMultline:   return from_ascii("multline");
-	case hullGather:     return from_ascii("gather");
-	case hullFlAlign:    return from_ascii("flalign");
-	case hullRegexp:     return from_ascii("regexp");
-	case hullUnknown:
-		lyxerr << "unknown hull type" << endl;
-		break;
-	}
-	return from_ascii("none");
-}
-
 static InsetLabel * dummy_pointer = 0;
 
 InsetMathHull::InsetMathHull(Buffer * buf)
-- 
2.28.0.windows.1

-------------- next part --------------
From a1521094703b8c88ba383a79bdb86df863cc66d9 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Tue, 27 Oct 2020 11:20:27 +0200
Subject: [PATCH 2/5] Use nullptr

---
 src/insets/Inset.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 2fec7023a6..bf165d91c5 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -135,33 +135,33 @@ public:
 	virtual bool isLabeled() const { return false; }
 
 	/// identification as math inset
-	virtual InsetMath * asInsetMath() { return 0; }
+	virtual InsetMath * asInsetMath() { return nullptr; }
 	/// identification as math inset
-	virtual InsetMath const * asInsetMath() const { return 0; }
+	virtual InsetMath const * asInsetMath() const { return nullptr; }
 	/// true for 'math' math inset, but not for e.g. mbox
 	virtual bool inMathed() const { return false; }
 	/// is this inset based on the InsetText class?
-	virtual InsetText * asInsetText() { return 0; }
+	virtual InsetText * asInsetText() { return nullptr; }
 	/// is this inset based on the InsetText class?
-	virtual InsetText const * asInsetText() const { return 0; }
+	virtual InsetText const * asInsetText() const { return nullptr; }
 	/// is this inset based on the InsetCollapsible class?
-	virtual InsetCollapsible * asInsetCollapsible() { return 0; }
+	virtual InsetCollapsible * asInsetCollapsible() { return nullptr; }
 	/// is this inset based on the InsetCollapsible class?
-	virtual InsetCollapsible const * asInsetCollapsible() const { return 0; }
+	virtual InsetCollapsible const * asInsetCollapsible() const { return nullptr; }
 	/// is this inset based on the InsetTabular class?
-	virtual InsetTabular * asInsetTabular() { return 0; }
+	virtual InsetTabular * asInsetTabular() { return nullptr; }
 	/// is this inset based on the InsetTabular class?
-	virtual InsetTabular const * asInsetTabular() const { return 0; }
+	virtual InsetTabular const * asInsetTabular() const { return nullptr; }
 	/// is this inset based on the InsetCommand class?
-	virtual InsetCommand * asInsetCommand() { return 0; }
+	virtual InsetCommand * asInsetCommand() { return nullptr; }
 	/// is this inset based on the InsetCommand class?
-	virtual InsetCommand const * asInsetCommand() const { return 0; }
+	virtual InsetCommand const * asInsetCommand() const { return nullptr; }
 	/// is this inset based on the InsetArgument class?
 	virtual InsetArgument const * asInsetArgument() const { return nullptr; }
 	/// is this inset based on the InsetGraphics class?
-	virtual InsetGraphics * asInsetGraphics() { return 0; }
+	virtual InsetGraphics * asInsetGraphics() { return nullptr; }
 	/// is this inset based on the InsetGraphics class?
-	virtual InsetGraphics const * asInsetGraphics() const { return 0; }
+	virtual InsetGraphics const * asInsetGraphics() const { return nullptr; }
 
 	/// the real dispatcher
 	void dispatch(Cursor & cur, FuncRequest & cmd);
-- 
2.28.0.windows.1

-------------- next part --------------
From b1b99172bf7f47db255bd35d31ce7f4e1cdf9fa6 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Tue, 27 Oct 2020 14:16:07 +0200
Subject: [PATCH 3/5] Simplify DispatchResult ctors

---
 src/DispatchResult.h | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/src/DispatchResult.h b/src/DispatchResult.h
index ac1eb6c821..c41b4c5b67 100644
--- a/src/DispatchResult.h
+++ b/src/DispatchResult.h
@@ -24,21 +24,10 @@ class DispatchResult
 {
 public:
 	///
-	DispatchResult() :
-			dispatched_(false),
-			error_(false),
-			update_(Update::None),
-			need_buf_update_(false),
-			need_msg_update_(true)
-	{}
+	DispatchResult() = default;
 	///
 	DispatchResult(bool dispatched, Update::flags f) :
-			dispatched_(dispatched),
-			error_(false),
-			update_(f),
-			need_buf_update_(false),
-			need_msg_update_(true)
-	{}
+			dispatched_(dispatched), update_(f) {}
 	///
 	bool dispatched() const { return dispatched_; }
 	///
@@ -72,17 +61,17 @@ public:
 
 private:
 	/// was the event fully dispatched?
-	bool dispatched_;
+	bool dispatched_ = false;
 	/// was there an error?
-	bool error_;
+	bool error_ = false;
 	/// do we need to redraw the screen afterwards?
-	Update::flags update_;
+	Update::flags update_ = Update::None;
 	///
 	docstring message_;
 	///
-	bool need_buf_update_;
+	bool need_buf_update_ = false;
 	///
-	bool need_msg_update_;
+	bool need_msg_update_ = true;
 };
 
 
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list