diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2016-06-30 18:00:05 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2016-07-01 05:13:54 +0000 |
commit | faddbce32ed863bda4238e54dd11df1b468ccd86 (patch) | |
tree | e51969246d4165369555518a1a420397c80aab8e /starmath | |
parent | loplugin:badstatics: new static only found with libc++ (diff) | |
download | core-faddbce32ed863bda4238e54dd11df1b468ccd86.tar.gz core-faddbce32ed863bda4238e54dd11df1b468ccd86.zip |
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@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/node.hxx | 35 | ||||
-rw-r--r-- | starmath/source/node.cxx | 3 |
2 files changed, 14 insertions, 24 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 72da13b2d50c..c93c978feaa2 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 fa0c7484e548..a8ae9e88339a 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); } |