[Libreoffice-commits] core.git: starmath/inc starmath/source

Takeshi Abe tabe at fixedpoint.jp
Fri Jul 1 05:14:22 UTC 2016


 starmath/inc/node.hxx    |   35 +++++++++++++----------------------
 starmath/source/node.cxx |    3 +--
 2 files changed, 14 insertions(+), 24 deletions(-)

New commits:
commit faddbce32ed863bda4238e54dd11df1b468ccd86
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu Jun 30 18:00:05 2016 +0900

    Make SmStructureNode's ctor initialize the number of sub nodes
    
    This also drops newly unused SetNumSubNodes() as a result.
    
    Change-Id: I9b33cb547eb6883da4b45dc5760144cce8fa14ee
    Reviewed-on: https://gerrit.libreoffice.org/26795
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>

diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 72da13b..c93c978 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -286,8 +286,9 @@ class SmStructureNode : public SmNode
     SmNodeArray  aSubNodes;
 
 protected:
-    SmStructureNode(SmNodeType eNodeType, const SmToken &rNodeToken)
-    :   SmNode(eNodeType, rNodeToken)
+    SmStructureNode(SmNodeType eNodeType, const SmToken &rNodeToken, size_t nSize = 0)
+        : SmNode(eNodeType, rNodeToken)
+        , aSubNodes(nSize)
     {}
 
 public:
@@ -296,7 +297,6 @@ public:
     virtual bool        IsVisible() const override;
 
     virtual sal_uInt16      GetNumSubNodes() const override;
-            void        SetNumSubNodes(sal_uInt16 nSize) { aSubNodes.resize(nSize); }
 
     using   SmNode::GetSubNode;
     virtual SmNode *    GetSubNode(sal_uInt16 nIndex) override;
@@ -745,9 +745,8 @@ class SmUnHorNode : public SmStructureNode
 {
 public:
     explicit SmUnHorNode(const SmToken &rNodeToken)
-    :   SmStructureNode(NUNHOR, rNodeToken)
+        : SmStructureNode(NUNHOR, rNodeToken, 2)
     {
-        SetNumSubNodes(2);
     }
 
     virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
@@ -775,9 +774,8 @@ protected:
 
 public:
     explicit SmRootNode(const SmToken &rNodeToken)
-    :   SmStructureNode(NROOT, rNodeToken)
+        : SmStructureNode(NROOT, rNodeToken, 3)
     {
-        SetNumSubNodes(3);
     }
 
     virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
@@ -805,9 +803,8 @@ class SmDynIntegralNode : public SmStructureNode
 {
 public:
     explicit SmDynIntegralNode(const SmToken &rNodeToken)
-    :   SmStructureNode(NDYNINT, rNodeToken)
+        : SmStructureNode(NDYNINT, rNodeToken, 2)
     {
-        SetNumSubNodes(2);
     }
 
     virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
@@ -836,9 +833,8 @@ class SmBinHorNode : public SmStructureNode
 {
 public:
     explicit SmBinHorNode(const SmToken &rNodeToken)
-    :   SmStructureNode(NBINHOR, rNodeToken)
+        : SmStructureNode(NBINHOR, rNodeToken, 3)
     {
-        SetNumSubNodes(3);
     }
 
     virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
@@ -869,9 +865,8 @@ class SmBinVerNode : public SmStructureNode
 {
 public:
     explicit SmBinVerNode(const SmToken &rNodeToken)
-    :   SmStructureNode(NBINVER, rNodeToken)
+        : SmStructureNode(NBINVER, rNodeToken, 3)
     {
-        SetNumSubNodes(3);
     }
 
     virtual const SmNode * GetLeftMost() const override;
@@ -956,9 +951,8 @@ class SmSubSupNode : public SmStructureNode
 
 public:
     explicit SmSubSupNode(const SmToken &rNodeToken)
-    :   SmStructureNode(NSUBSUP, rNodeToken)
+        : SmStructureNode(NSUBSUP, rNodeToken, 1 + SUBSUP_NUM_ENTRIES)
     {
-        SetNumSubNodes(1 + SUBSUP_NUM_ENTRIES);
         bUseLimits = false;
     }
 
@@ -1007,9 +1001,8 @@ class SmBraceNode : public SmStructureNode
 {
 public:
     explicit SmBraceNode(const SmToken &rNodeToken)
-    :   SmStructureNode(NBRACE, rNodeToken)
+        : SmStructureNode(NBRACE, rNodeToken, 3)
     {
-        SetNumSubNodes(3);
     }
 
     SmMathSymbolNode* OpeningBrace();
@@ -1083,10 +1076,9 @@ public:
 };
 
 
-inline SmVerticalBraceNode::SmVerticalBraceNode(const SmToken &rNodeToken) :
-    SmStructureNode(NVERTICAL_BRACE, rNodeToken)
+inline SmVerticalBraceNode::SmVerticalBraceNode(const SmToken &rNodeToken)
+    : SmStructureNode(NVERTICAL_BRACE, rNodeToken, 3)
 {
-    SetNumSubNodes(3);
 }
 
 
@@ -1104,9 +1096,8 @@ class SmOperNode : public SmStructureNode
 {
 public:
     explicit SmOperNode(const SmToken &rNodeToken)
-    :   SmStructureNode(NOPER, rNodeToken)
+        : SmStructureNode(NOPER, rNodeToken, 2)
     {
-        SetNumSubNodes(2);
     }
 
     SmNode *       GetSymbol();
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index fa0c748..a8ae9e8 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -1018,10 +1018,9 @@ sal_uInt16 GetLineIntersectionPoint(Point &rResult,
 
 
 SmBinDiagonalNode::SmBinDiagonalNode(const SmToken &rNodeToken)
-:   SmStructureNode(NBINDIAGONAL, rNodeToken)
+    : SmStructureNode(NBINDIAGONAL, rNodeToken, 3)
 {
     bAscending = false;
-    SetNumSubNodes(3);
 }
 
 


More information about the Libreoffice-commits mailing list