mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-05 03:50:51 +01:00
Apply clang-tidy's performance-unnecessary-value-param, performance-for-
range-copy git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5448 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <QVariant>
|
||||
#include <QStringList>
|
||||
#include <utility>
|
||||
|
||||
namespace autonum
|
||||
{
|
||||
@@ -88,7 +89,7 @@ namespace autonum
|
||||
* @param tag_name : the tag name used for the QDomElement.
|
||||
* @return A QDomElement, if this sequential have no value, the returned QDomELement is empty
|
||||
*/
|
||||
QDomElement sequentialNumbers::toXml(QDomDocument &document, QString tag_name) const
|
||||
QDomElement sequentialNumbers::toXml(QDomDocument &document, const QString& tag_name) const
|
||||
{
|
||||
QDomElement element = document.createElement(tag_name);
|
||||
|
||||
@@ -161,7 +162,7 @@ namespace autonum
|
||||
*/
|
||||
QString AssignVariables::formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt)
|
||||
{
|
||||
AssignVariables av(formula, seqStruct, diagram, elmt);
|
||||
AssignVariables av(std::move(formula), seqStruct, diagram, elmt);
|
||||
seqStruct = av.m_seq_struct;
|
||||
return av.m_assigned_label;
|
||||
}
|
||||
@@ -193,7 +194,7 @@ namespace autonum
|
||||
return str;
|
||||
}
|
||||
|
||||
AssignVariables::AssignVariables(QString formula, sequentialNumbers seqStruct , Diagram *diagram, const Element *elmt):
|
||||
AssignVariables::AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt):
|
||||
m_diagram(diagram),
|
||||
m_arg_formula(formula),
|
||||
m_assigned_label(formula),
|
||||
@@ -293,7 +294,7 @@ namespace autonum
|
||||
* @param context : numerotation context to retrieve value
|
||||
* @param type : type of sequential (unit, unitfolio, ten, tenfolio, hundred, hundredfolio)
|
||||
*/
|
||||
void setSequentialToList(QStringList &list, NumerotationContext &context, QString type)
|
||||
void setSequentialToList(QStringList &list, NumerotationContext &context, const QString& type)
|
||||
{
|
||||
for (int i = 0; i < context.size(); i++)
|
||||
{
|
||||
@@ -317,7 +318,7 @@ namespace autonum
|
||||
* @param hash : hash to have values inserted
|
||||
* @param autoNumName : name to use as key of hash
|
||||
*/
|
||||
void setFolioSequentialToHash(QStringList &list, QHash<QString, QStringList> &hash, QString autoNumName)
|
||||
void setFolioSequentialToHash(QStringList &list, QHash<QString, QStringList> &hash, const QString& autoNumName)
|
||||
{
|
||||
if (hash.isEmpty() || !hash.contains(autoNumName))
|
||||
{
|
||||
@@ -354,7 +355,7 @@ namespace autonum
|
||||
* to keep up to date the current sequential of folio.
|
||||
* @param hashKey : the hash key used to store the sequential for folio type.
|
||||
*/
|
||||
void setSequential(QString label, sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, QString hashKey)
|
||||
void setSequential(const QString& label, sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, const QString& hashKey)
|
||||
{
|
||||
if (!context.isEmpty())
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace autonum
|
||||
bool operator== (const sequentialNumbers &other) const;
|
||||
bool operator!= (const sequentialNumbers &other) const;
|
||||
|
||||
QDomElement toXml(QDomDocument &document, QString tag_name = QString("sequentialNumbers")) const;
|
||||
QDomElement toXml(QDomDocument &document, const QString& tag_name = QString("sequentialNumbers")) const;
|
||||
void fromXml(const QDomElement &element);
|
||||
void clear();
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace autonum
|
||||
static QString replaceVariable (const QString &formula, const DiagramContext &dc);
|
||||
|
||||
private:
|
||||
AssignVariables(QString formula, sequentialNumbers seqStruct , Diagram *diagram, const Element *elmt = nullptr);
|
||||
AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt = nullptr);
|
||||
void assignTitleBlockVar();
|
||||
void assignProjectVar();
|
||||
void assignSequence();
|
||||
@@ -78,9 +78,9 @@ namespace autonum
|
||||
const Element *m_element = nullptr;
|
||||
};
|
||||
|
||||
void setSequentialToList(QStringList &list, NumerotationContext &nc, QString type);
|
||||
void setFolioSequentialToHash(QStringList &list, QHash<QString, QStringList> &hash, QString autoNumName);
|
||||
void setSequential(QString label, autonum::sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, QString hashKey);
|
||||
void setSequentialToList(QStringList &list, NumerotationContext &nc, const QString& type);
|
||||
void setFolioSequentialToHash(QStringList &list, QHash<QString, QStringList> &hash, const QString& autoNumName);
|
||||
void setSequential(const QString& label, autonum::sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, const QString& hashKey);
|
||||
QString numerotationContextToFormula(const NumerotationContext &nc);
|
||||
QString elementPrefixForLocation(const ElementsLocation &location);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
#include <utility>
|
||||
#include "qet.h"
|
||||
|
||||
/**
|
||||
@@ -130,7 +132,7 @@ bool NumerotationContext::keyIsNumber(const QString &type) const {
|
||||
* @brief NumerotationContext::toXml
|
||||
* Save the numerotation context in a QDomElement under the element name @str
|
||||
*/
|
||||
QDomElement NumerotationContext::toXml(QDomDocument &d, QString str) {
|
||||
QDomElement NumerotationContext::toXml(QDomDocument &d, const QString& str) {
|
||||
QDomElement num_auto = d.createElement(str);
|
||||
for (int i=0; i<content_.size(); ++i) {
|
||||
QStringList strl = itemAt(i);
|
||||
@@ -166,7 +168,7 @@ void NumerotationContext::fromXml(QDomElement &e) {
|
||||
void NumerotationContext::replaceValue(int index, QString content) {
|
||||
QString sep = "|";
|
||||
QString type = content_[index].split("|").at(0);
|
||||
QString value = content;
|
||||
const QString& value = std::move(content);
|
||||
QString increase = content_[index].split("|").at(2);
|
||||
QString initvalue = content_[index].split("|").at(3);
|
||||
content_[index].replace(content_[index], type + "|" + value + "|" + increase + "|" + initvalue);
|
||||
|
||||
@@ -43,7 +43,7 @@ class NumerotationContext
|
||||
QString validRegExpNumber() const;
|
||||
bool keyIsAcceptable (const QString &) const;
|
||||
bool keyIsNumber(const QString &) const;
|
||||
QDomElement toXml(QDomDocument &, QString);
|
||||
QDomElement toXml(QDomDocument &, const QString&);
|
||||
void fromXml(QDomElement &);
|
||||
void replaceValue(int, QString);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QtWidgets>
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -45,7 +46,7 @@ FormulaAutonumberingW::~FormulaAutonumberingW()
|
||||
* @brief FormulaAutonumberingW::setContext
|
||||
* @param formula to be inserted into context
|
||||
*/
|
||||
void FormulaAutonumberingW::setContext(QString formula) {
|
||||
void FormulaAutonumberingW::setContext(const QString& formula) {
|
||||
ui->m_formula_le->insert(formula);
|
||||
}
|
||||
|
||||
@@ -70,5 +71,5 @@ QString FormulaAutonumberingW::formula() {
|
||||
* Update Apply Button
|
||||
*/
|
||||
void FormulaAutonumberingW::on_m_formula_le_textChanged(QString text) {
|
||||
emit (textChanged(text));
|
||||
emit (textChanged(std::move(text)));
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class FormulaAutonumberingW : public QWidget
|
||||
explicit FormulaAutonumberingW(QWidget *parent = nullptr);
|
||||
~FormulaAutonumberingW() override;
|
||||
QString formula();
|
||||
void setContext(QString);
|
||||
void setContext(const QString&);
|
||||
void clearContext();
|
||||
Ui::FormulaAutonumberingW *ui;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user