diff options
author | Noel Grandin <noel@peralex.com> | 2014-03-06 15:29:08 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-03-18 08:32:26 +0200 |
commit | 86a32589e90ee983159fb5b2c6a594428ab7d422 (patch) | |
tree | 6de946fe2b9b25614f0d197af95e9d3aadcd1bd9 /starmath | |
parent | bb17844099ba98a77c8e5d7a25c0c416a4b0641e (diff) |
Find places where OUString and OString are passed by value.
It's not very efficient, because we generally end up copying it twice -
once into the parameter and again into the destination OUString.
So I create a clang plugin that finds such places and generates a
warning so that we can convert them to pass-by-reference.
Change-Id: I5341a6ea9e3190f4b4c05c42c85595e3dcd83361
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/ElementsDockingWindow.hxx | 4 | ||||
-rw-r--r-- | starmath/inc/cursor.hxx | 6 | ||||
-rw-r--r-- | starmath/source/ElementsDockingWindow.cxx | 4 | ||||
-rw-r--r-- | starmath/source/cursor.cxx | 8 |
4 files changed, 11 insertions, 11 deletions
diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index a5985d38b59d..ccd9d7c89937 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -34,7 +34,7 @@ public: Point mBoxLocation; Size mBoxSize; - SmElement(SmNodePointer pNode, OUString aText, OUString aHelpText); + SmElement(SmNodePointer pNode, const OUString& aText, const OUString& aHelpText); virtual ~SmElement(); SmNodePointer getNode(); @@ -96,7 +96,7 @@ class SmElementsControl : public Control Size maMaxElementDimensions; bool mbVerticalMode; - void addElement(OUString aElementVisual, OUString aElementSource, OUString aHelpText); + void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText); void addElements(const sal_uInt16 aElementsArray[][2], sal_uInt16 size); diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index b1f6e8b57929..ca3527dda94d 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -121,7 +121,7 @@ public: void DeletePrev(OutputDevice* pDev); /** Insert text at the current position */ - void InsertText(OUString aString); + void InsertText(const OUString& aString); /** Insert an element into the formula */ void InsertElement(SmFormulaElement element); @@ -137,7 +137,7 @@ public: * This will work for stuff like "A intersection B". But stuff spaning multiple lines * or dependent on the context which position is placed in will not work! */ - void InsertCommandText(OUString aCommandText); + void InsertCommandText(const OUString& aCommandText); /** Insert a special node created from aString * @@ -148,7 +148,7 @@ public: * For more complex expressions use InsertCommandText, this method doesn't * use SmParser, this means that it's faster, but not as strong. */ - void InsertSpecial(OUString aString); + void InsertSpecial(const OUString& aString); /** Create sub-/super script * diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index aaaba71a5fbf..d5e27725e7e2 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -31,7 +31,7 @@ SV_DECL_REF(SmDocShell) SV_IMPL_REF(SmDocShell) -SmElement::SmElement(SmNodePointer pNode, OUString aText, OUString aHelpText) : +SmElement::SmElement(SmNodePointer pNode, const OUString& aText, const OUString& aHelpText) : mpNode(pNode), maText(aText), maHelpText(aHelpText) @@ -397,7 +397,7 @@ void SmElementsControl::addSeparator() maElementList.push_back(pElement); } -void SmElementsControl::addElement(OUString aElementVisual, OUString aElementSource, OUString aHelpText) +void SmElementsControl::addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText) { SmNodePointer pNode(SmParser().ParseExpression(aElementVisual)); diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 4c770d0fd615..6704c2a8c91a 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -963,7 +963,7 @@ void SmCursor::InsertFraction() { FinishEdit(pLineList, pLineParent, nParentIndex, SmCaretPos(pSelectedNode, 1)); } -void SmCursor::InsertText(OUString aString) +void SmCursor::InsertText(const OUString& aString) { BeginEdit(); @@ -1092,12 +1092,12 @@ void SmCursor::InsertElement(SmFormulaElement element){ EndEdit(); } -void SmCursor::InsertSpecial(OUString aString) +void SmCursor::InsertSpecial(const OUString& _aString) { BeginEdit(); Delete(); - aString = comphelper::string::strip(aString, ' '); + OUString aString = comphelper::string::strip(_aString, ' '); //Create instance of special node SmToken token; @@ -1140,7 +1140,7 @@ void SmCursor::InsertCommand(sal_uInt16 nCommand) { } } -void SmCursor::InsertCommandText(OUString aCommandText) { +void SmCursor::InsertCommandText(const OUString& aCommandText) { //Parse the sub expression SmNode* pSubExpr = SmParser().ParseExpression(aCommandText); |