summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <[email protected]>2017-07-24 05:37:03 +0200
committerFriedrich W. H. Kossebau <[email protected]>2017-07-24 05:37:03 +0200
commitfbfb0dd93d6fd59bd89e39d72aaa0115b4b86e55 (patch)
tree92cd6a25422451ff92bafe1b71b785d3cc2107e8
parentadd6f769d049581180d0d91a9cd7b78961a1a0af (diff)
More const ref for passing complex types
-rw-r--r--kasten/controllers/test/locktooffsettest.cpp2
-rw-r--r--kasten/controllers/view/structures/datatypes/array/abstractarraydata.h2
-rw-r--r--kasten/controllers/view/structures/datatypes/array/arraydatainformation.h4
-rw-r--r--kasten/controllers/view/structures/datatypes/array/complexarraydata.cpp2
-rw-r--r--kasten/controllers/view/structures/datatypes/array/complexarraydata.h2
-rw-r--r--kasten/controllers/view/structures/datatypes/array/primitivearraydata.cpp2
-rw-r--r--kasten/controllers/view/structures/datatypes/array/primitivearraydata.h2
-rw-r--r--kasten/controllers/view/structures/datatypes/datainformation.cpp2
-rw-r--r--kasten/controllers/view/structures/datatypes/datainformation.h2
-rw-r--r--kasten/controllers/view/structures/datatypes/datainformationwithchildren.cpp2
-rw-r--r--kasten/controllers/view/structures/datatypes/datainformationwithchildren.h2
-rw-r--r--kasten/controllers/view/structures/datatypes/primitive/enumdatainformation.h4
-rw-r--r--kasten/controllers/view/structures/datatypes/primitive/enumdefinition.h6
-rw-r--r--kasten/controllers/view/structures/datatypes/primitive/pointerdatainformation.cpp2
-rw-r--r--kasten/controllers/view/structures/datatypes/primitive/pointerdatainformation.h2
-rw-r--r--kasten/controllers/view/structures/datatypes/structuredatainformation.cpp2
-rw-r--r--kasten/controllers/view/structures/datatypes/structuredatainformation.h2
-rw-r--r--kasten/controllers/view/structures/parsers/datainformationfactory.cpp4
-rw-r--r--kasten/controllers/view/structures/parsers/osdparser.cpp4
-rw-r--r--kasten/controllers/view/structures/parsers/osdparser.h6
-rw-r--r--kasten/controllers/view/structures/structuredefinitionfile.cpp2
-rw-r--r--kasten/controllers/view/structures/structuredefinitionfile.h2
22 files changed, 30 insertions, 30 deletions
diff --git a/kasten/controllers/test/locktooffsettest.cpp b/kasten/controllers/test/locktooffsettest.cpp
index 1a2a8f6..458ae3f 100644
--- a/kasten/controllers/test/locktooffsettest.cpp
+++ b/kasten/controllers/test/locktooffsettest.cpp
@@ -120,7 +120,7 @@ Q_DECLARE_METATYPE(Okteta::AbstractByteArrayModel*)
Q_DECLARE_METATYPE(TopLevelDataInformation*)
static inline void addRow(const char* tag, TopLevelDataInformation* structure, Okteta::Address addr,
- Okteta::AbstractByteArrayModel* model, Okteta::ArrayChangeMetricsList changes, bool expected)
+ Okteta::AbstractByteArrayModel* model, const Okteta::ArrayChangeMetricsList& changes, bool expected)
{
QTest::newRow(tag) << structure << addr << model << changes << expected;
}
diff --git a/kasten/controllers/view/structures/datatypes/array/abstractarraydata.h b/kasten/controllers/view/structures/datatypes/array/abstractarraydata.h
index 1466b28..a7720b4 100644
--- a/kasten/controllers/view/structures/datatypes/array/abstractarraydata.h
+++ b/kasten/controllers/view/structures/datatypes/array/abstractarraydata.h
@@ -72,7 +72,7 @@ public:
virtual int indexOf(const DataInformation* data) const = 0;
virtual BitCount64 offset(const DataInformation* child) const = 0;
virtual qint64 readData(Okteta::AbstractByteArrayModel* input, Okteta::Address address, BitCount64 bitsRemaining) = 0;
- virtual bool setChildData(uint row, QVariant value, Okteta::AbstractByteArrayModel* out,
+ virtual bool setChildData(uint row, const QVariant& value, Okteta::AbstractByteArrayModel* out,
Okteta::Address address, BitCount64 bitsRemaining) = 0;
virtual BitCount32 sizeAt(uint index) = 0;
virtual Qt::ItemFlags childFlags(int row, int column, bool fileLoaded) = 0;
diff --git a/kasten/controllers/view/structures/datatypes/array/arraydatainformation.h b/kasten/controllers/view/structures/datatypes/array/arraydatainformation.h
index 184d451..be376a5 100644
--- a/kasten/controllers/view/structures/datatypes/array/arraydatainformation.h
+++ b/kasten/controllers/view/structures/datatypes/array/arraydatainformation.h
@@ -84,7 +84,7 @@ public:
QScriptValue childType() const;
QScriptValue lengthFunction() const;
- void setLengthFunction(QScriptValue newFunc);
+ void setLengthFunction(const QScriptValue& newFunc);
QScriptValue childToScriptValue(uint index, QScriptEngine* engine, ScriptHandlerInfo* handlerInfo) const;
virtual BitCount64 childPosition(const DataInformation* child, Okteta::Address start) const;
private:
@@ -175,7 +175,7 @@ inline QScriptValue ArrayDataInformation::lengthFunction() const
return mAdditionalData.get(AdditionalData::ArrayLengthFunction).value<QScriptValue>();
}
-inline void ArrayDataInformation::setLengthFunction(QScriptValue newFunc)
+inline void ArrayDataInformation::setLengthFunction(const QScriptValue& newFunc)
{
setAdditionalFunction(AdditionalData::ArrayLengthFunction, newFunc, "array length function");
}
diff --git a/kasten/controllers/view/structures/datatypes/array/complexarraydata.cpp b/kasten/controllers/view/structures/datatypes/array/complexarraydata.cpp
index 8a2e2ba..824104f 100644
--- a/kasten/controllers/view/structures/datatypes/array/complexarraydata.cpp
+++ b/kasten/controllers/view/structures/datatypes/array/complexarraydata.cpp
@@ -155,7 +155,7 @@ qint64 ComplexArrayData::readData(Okteta::AbstractByteArrayModel* input, Okteta:
return readBits;
}
-bool ComplexArrayData::setChildData(uint row, QVariant value, Okteta::AbstractByteArrayModel* out,
+bool ComplexArrayData::setChildData(uint row, const QVariant& value, Okteta::AbstractByteArrayModel* out,
Okteta::Address address, BitCount64 bitsRemaining)
{
Q_ASSERT(row < unsigned(mChildren.size()));
diff --git a/kasten/controllers/view/structures/datatypes/array/complexarraydata.h b/kasten/controllers/view/structures/datatypes/array/complexarraydata.h
index 66ab807..c115bb4 100644
--- a/kasten/controllers/view/structures/datatypes/array/complexarraydata.h
+++ b/kasten/controllers/view/structures/datatypes/array/complexarraydata.h
@@ -59,7 +59,7 @@ public:
virtual QScriptValue toScriptValue(uint index, QScriptEngine* engine, ScriptHandlerInfo* handlerInfo);
virtual qint64 readData(Okteta::AbstractByteArrayModel* input, Okteta::Address address, BitCount64 bitsRemaining);
- virtual bool setChildData(uint row, QVariant value, Okteta::AbstractByteArrayModel* out,
+ virtual bool setChildData(uint row, const QVariant& value, Okteta::AbstractByteArrayModel* out,
Okteta::Address address, BitCount64 bitsRemaining);
virtual QWidget* createChildEditWidget(uint index, QWidget* parent) const;
diff --git a/kasten/controllers/view/structures/datatypes/array/primitivearraydata.cpp b/kasten/controllers/view/structures/datatypes/array/primitivearraydata.cpp
index ba28364..f7e6b36 100644
--- a/kasten/controllers/view/structures/datatypes/array/primitivearraydata.cpp
+++ b/kasten/controllers/view/structures/datatypes/array/primitivearraydata.cpp
@@ -102,7 +102,7 @@ void PrimitiveArrayData<type>::readDataNonNativeOrder(uint numItems, Okteta::Abs
}
template<PrimitiveDataTypeEnum type>
-bool PrimitiveArrayData<type>::setChildData(uint row, QVariant value, Okteta::AbstractByteArrayModel* out,
+bool PrimitiveArrayData<type>::setChildData(uint row, const QVariant& value, Okteta::AbstractByteArrayModel* out,
Okteta::Address address, BitCount64 bitsRemaining)
{
Q_ASSERT(row < length());
diff --git a/kasten/controllers/view/structures/datatypes/array/primitivearraydata.h b/kasten/controllers/view/structures/datatypes/array/primitivearraydata.h
index c697aea..048ecec 100644
--- a/kasten/controllers/view/structures/datatypes/array/primitivearraydata.h
+++ b/kasten/controllers/view/structures/datatypes/array/primitivearraydata.h
@@ -42,7 +42,7 @@ public:
virtual qint64 readData(Okteta::AbstractByteArrayModel* input, Okteta::Address address,
BitCount64 bitsRemaining);
- virtual bool setChildData(uint row, QVariant value, Okteta::AbstractByteArrayModel* out,
+ virtual bool setChildData(uint row, const QVariant& value, Okteta::AbstractByteArrayModel* out,
Okteta::Address address, BitCount64 bitsRemaining);
virtual DataInformation* childAt(unsigned int idx);
diff --git a/kasten/controllers/view/structures/datatypes/datainformation.cpp b/kasten/controllers/view/structures/datatypes/datainformation.cpp
index 93a141f..273866a 100644
--- a/kasten/controllers/view/structures/datatypes/datainformation.cpp
+++ b/kasten/controllers/view/structures/datatypes/datainformation.cpp
@@ -92,7 +92,7 @@ DataInformation* DataInformation::mainStructure()
}
-void DataInformation::setValidationError(QString errorMessage)
+void DataInformation::setValidationError(const QString& errorMessage)
{
if (errorMessage.isEmpty())
mAdditionalData.remove(AdditionalData::ValidationError);
diff --git a/kasten/controllers/view/structures/datatypes/datainformation.h b/kasten/controllers/view/structures/datatypes/datainformation.h
index fb1a859..8563a85 100644
--- a/kasten/controllers/view/structures/datatypes/datainformation.h
+++ b/kasten/controllers/view/structures/datatypes/datainformation.h
@@ -230,7 +230,7 @@ private:
/** So that this object can be wrapped by the correct javascript object*/
virtual QScriptClass* scriptClass(ScriptHandlerInfo* handlerInfo) const = 0;
private:
- void setValidationError(QString errorMessage); //only called by ScriptHandler
+ void setValidationError(const QString& errorMessage); //only called by ScriptHandler
QSysInfo::Endian byteOrderFromSettings() const; //so there is no need to include structviewpreferences.h here
QString customToString(const QScriptValue& func) const;
protected:
diff --git a/kasten/controllers/view/structures/datatypes/datainformationwithchildren.cpp b/kasten/controllers/view/structures/datatypes/datainformationwithchildren.cpp
index a62861e..3a40334 100644
--- a/kasten/controllers/view/structures/datatypes/datainformationwithchildren.cpp
+++ b/kasten/controllers/view/structures/datatypes/datainformationwithchildren.cpp
@@ -149,7 +149,7 @@ void DataInformationWithChildren::setChildren(const QVector<DataInformation*>& n
topLevelDataInformation()->_childCountChanged(this, 0, count);
}
-void DataInformationWithChildren::setChildren(QScriptValue children)
+void DataInformationWithChildren::setChildren(const QScriptValue& children)
{
if (children.isNull() || children.isUndefined())
{
diff --git a/kasten/controllers/view/structures/datatypes/datainformationwithchildren.h b/kasten/controllers/view/structures/datatypes/datainformationwithchildren.h
index f970c09..f598047 100644
--- a/kasten/controllers/view/structures/datatypes/datainformationwithchildren.h
+++ b/kasten/controllers/view/structures/datatypes/datainformationwithchildren.h
@@ -69,7 +69,7 @@ public:
/** Takes ownership of all elements */
void appendChildren(const QVector<DataInformation*>& newChildren, bool emitSignal = true);
void setChildren(const QVector<DataInformation*>& newChildren);
- void setChildren(QScriptValue newChildren);
+ void setChildren(const QScriptValue& newChildren);
static QVector<DataInformation*> cloneList(const QVector<DataInformation*>& other, DataInformation* parent);
protected:
diff --git a/kasten/controllers/view/structures/datatypes/primitive/enumdatainformation.h b/kasten/controllers/view/structures/datatypes/primitive/enumdatainformation.h
index e59a62b..227938d 100644
--- a/kasten/controllers/view/structures/datatypes/primitive/enumdatainformation.h
+++ b/kasten/controllers/view/structures/datatypes/primitive/enumdatainformation.h
@@ -38,7 +38,7 @@ public:
virtual bool isEnum() const;
EnumDefinition::Ptr enumValues() const;
- void setEnumValues(QMap<AllPrimitiveTypes, QString> newValues);
+ void setEnumValues(const QMap<AllPrimitiveTypes, QString>& newValues);
private:
virtual QScriptClass* scriptClass(ScriptHandlerInfo* handlerInfo) const;
virtual QString valueStringImpl() const;
@@ -57,7 +57,7 @@ inline EnumDefinition::Ptr EnumDataInformation::enumValues() const
return mEnum;
}
-inline void EnumDataInformation::setEnumValues(QMap<AllPrimitiveTypes, QString> newValues)
+inline void EnumDataInformation::setEnumValues(const QMap<AllPrimitiveTypes, QString>& newValues)
{
mEnum->setValues(newValues);
}
diff --git a/kasten/controllers/view/structures/datatypes/primitive/enumdefinition.h b/kasten/controllers/view/structures/datatypes/primitive/enumdefinition.h
index 7d22696..94f30b9 100644
--- a/kasten/controllers/view/structures/datatypes/primitive/enumdefinition.h
+++ b/kasten/controllers/view/structures/datatypes/primitive/enumdefinition.h
@@ -38,7 +38,7 @@ class EnumDefinition: public QSharedData
{
public:
typedef QSharedDataPointer<EnumDefinition> Ptr;
- EnumDefinition(const QMap<AllPrimitiveTypes, QString> values, const QString& name,
+ EnumDefinition(const QMap<AllPrimitiveTypes, QString>& values, const QString& name,
PrimitiveDataType type) :
QSharedData(), mName(name), mValues(values), mType(type) {}
EnumDefinition(const EnumDefinition& e) :
@@ -49,7 +49,7 @@ public:
const QString value(AllPrimitiveTypes key) const;
PrimitiveDataType type() const;
const QString& name() const;
- void setValues(QMap< AllPrimitiveTypes, QString > newValues);
+ void setValues(const QMap<AllPrimitiveTypes, QString>& newValues);
static QMap<AllPrimitiveTypes, QString> parseEnumValues(const QScriptValue& val,
const LoggerWithContext& logger, PrimitiveDataType type = Type_UInt64);
@@ -88,7 +88,7 @@ inline const QString& EnumDefinition::name() const
return mName;
}
-inline void EnumDefinition::setValues(QMap<AllPrimitiveTypes, QString> newValues)
+inline void EnumDefinition::setValues(const QMap<AllPrimitiveTypes, QString>& newValues)
{
mValues = newValues; //causes the QSharedPointer to detach and copy
}
diff --git a/kasten/controllers/view/structures/datatypes/primitive/pointerdatainformation.cpp b/kasten/controllers/view/structures/datatypes/primitive/pointerdatainformation.cpp
index b9dafcd..67c44d1 100644
--- a/kasten/controllers/view/structures/datatypes/primitive/pointerdatainformation.cpp
+++ b/kasten/controllers/view/structures/datatypes/primitive/pointerdatainformation.cpp
@@ -34,7 +34,7 @@
#include <limits>
-PointerDataInformation::PointerDataInformation(QString name, DataInformation* childType,
+PointerDataInformation::PointerDataInformation(const QString& name, DataInformation* childType,
PrimitiveDataInformation* valueType, DataInformation* parent)
: PrimitiveDataInformationWrapper(name, valueType, parent), mPointerTarget(childType)
{
diff --git a/kasten/controllers/view/structures/datatypes/primitive/pointerdatainformation.h b/kasten/controllers/view/structures/datatypes/primitive/pointerdatainformation.h
index b545c2a..e24adad 100644
--- a/kasten/controllers/view/structures/datatypes/primitive/pointerdatainformation.h
+++ b/kasten/controllers/view/structures/datatypes/primitive/pointerdatainformation.h
@@ -34,7 +34,7 @@ public:
/** creates a new pointer
* takes ownership over @p childType and @p valueType
*/
- PointerDataInformation(QString name, DataInformation* childType,
+ PointerDataInformation(const QString& name, DataInformation* childType,
PrimitiveDataInformation* valueType, DataInformation* parent);
virtual ~PointerDataInformation();
diff --git a/kasten/controllers/view/structures/datatypes/structuredatainformation.cpp b/kasten/controllers/view/structures/datatypes/structuredatainformation.cpp
index 74a0d70..10be4e8 100644
--- a/kasten/controllers/view/structures/datatypes/structuredatainformation.cpp
+++ b/kasten/controllers/view/structures/datatypes/structuredatainformation.cpp
@@ -68,7 +68,7 @@ BitCount64 StructureDataInformation::childPosition(const DataInformation* child,
return mParent->asDataInformation()->childPosition(this, start) + offset;
}
-bool StructureDataInformation::readChildren(const QVector<DataInformation*> children,
+bool StructureDataInformation::readChildren(const QVector<DataInformation*>& children,
Okteta::AbstractByteArrayModel* input, Okteta::Address address, BitCount64 bitsRemaining,
quint8* bitOffset, qint64* readBitsPtr, TopLevelDataInformation* top)
{
diff --git a/kasten/controllers/view/structures/datatypes/structuredatainformation.h b/kasten/controllers/view/structures/datatypes/structuredatainformation.h
index e1647a8..f6b3004 100644
--- a/kasten/controllers/view/structures/datatypes/structuredatainformation.h
+++ b/kasten/controllers/view/structures/datatypes/structuredatainformation.h
@@ -39,7 +39,7 @@ public:
virtual BitCount64 childPosition(const DataInformation* child, Okteta::Address start) const;
- static bool readChildren(const QVector<DataInformation*> children, Okteta::AbstractByteArrayModel *input,
+ static bool readChildren(const QVector<DataInformation*>& children, Okteta::AbstractByteArrayModel *input,
Okteta::Address address, BitCount64 bitsRemaining, quint8* bitOffset, qint64* readBitsPtr,
TopLevelDataInformation* top);
private:
diff --git a/kasten/controllers/view/structures/parsers/datainformationfactory.cpp b/kasten/controllers/view/structures/parsers/datainformationfactory.cpp
index d54bf31..2d50938 100644
--- a/kasten/controllers/view/structures/parsers/datainformationfactory.cpp
+++ b/kasten/controllers/view/structures/parsers/datainformationfactory.cpp
@@ -145,8 +145,8 @@ T* newStructOrUnion(const StructOrUnionParsedData& supd)
return structOrUnion;
}
-QString generateLengthFunction(DataInformation* current, DataInformation* last, QString elemName,
- QString currentString, const ParserInfo& info)
+QString generateLengthFunction(DataInformation* current, DataInformation* last, const QString& elemName,
+ const QString& currentString, const ParserInfo& info)
{
if (!current) //reached top
return QString();
diff --git a/kasten/controllers/view/structures/parsers/osdparser.cpp b/kasten/controllers/view/structures/parsers/osdparser.cpp
index 10670f3..b6c2d8d 100644
--- a/kasten/controllers/view/structures/parsers/osdparser.cpp
+++ b/kasten/controllers/view/structures/parsers/osdparser.cpp
@@ -554,7 +554,7 @@ TaggedUnionDataInformation* OsdParser::taggedUnionFromXML(const QDomElement& xml
return DataInformationFactory::newTaggedUnion(tpd);
}
-OsdChildrenParser::OsdChildrenParser(const OsdParserInfo& info, QDomElement firstChild)
+OsdChildrenParser::OsdChildrenParser(const OsdParserInfo& info, const QDomElement& firstChild)
: mInfo(info), mElem(firstChild)
{
}
@@ -595,7 +595,7 @@ void OsdChildrenParser::setParent(DataInformation* newParent)
mInfo.parent = newParent;
}
-SingleElementOsdChildrenParser::SingleElementOsdChildrenParser(const OsdParserInfo& info, QDomElement element)
+SingleElementOsdChildrenParser::SingleElementOsdChildrenParser(const OsdParserInfo& info, const QDomElement& element)
: OsdChildrenParser(info, element), mParsed(false)
{
if (mElem.isNull())
diff --git a/kasten/controllers/view/structures/parsers/osdparser.h b/kasten/controllers/view/structures/parsers/osdparser.h
index efde1b2..73b97c8 100644
--- a/kasten/controllers/view/structures/parsers/osdparser.h
+++ b/kasten/controllers/view/structures/parsers/osdparser.h
@@ -43,7 +43,7 @@ class ScriptLogger;
struct OsdParserInfo : public ParserInfo {
inline OsdParserInfo(const QString& name, ScriptLogger* logger, DataInformation* parent,
- QScriptEngine* engine, QVector<EnumDefinition::Ptr> enums)
+ QScriptEngine* engine, const QVector<EnumDefinition::Ptr>& enums)
: ParserInfo(name, logger, parent, engine), enums(enums) {}
inline OsdParserInfo(const OsdParserInfo& i) : ParserInfo(i), enums(i.enums) {}
inline ~OsdParserInfo() {}
@@ -99,7 +99,7 @@ private:
class OsdChildrenParser : public ChildrenParser {
public:
- OsdChildrenParser(const OsdParserInfo& info, QDomElement firstChild);
+ OsdChildrenParser(const OsdParserInfo& info, const QDomElement& firstChild);
virtual ~OsdChildrenParser();
virtual DataInformation* next();
virtual bool hasNext();
@@ -111,7 +111,7 @@ protected:
class SingleElementOsdChildrenParser : public OsdChildrenParser {
public:
- SingleElementOsdChildrenParser(const OsdParserInfo& info, QDomElement element);
+ SingleElementOsdChildrenParser(const OsdParserInfo& info, const QDomElement& element);
virtual ~SingleElementOsdChildrenParser();
virtual DataInformation* next();
virtual bool hasNext();
diff --git a/kasten/controllers/view/structures/structuredefinitionfile.cpp b/kasten/controllers/view/structures/structuredefinitionfile.cpp
index 4138eda..4fffe78 100644
--- a/kasten/controllers/view/structures/structuredefinitionfile.cpp
+++ b/kasten/controllers/view/structures/structuredefinitionfile.cpp
@@ -35,7 +35,7 @@
namespace Kasten
{
-StructureDefinitionFile::StructureDefinitionFile(KPluginInfo info)
+StructureDefinitionFile::StructureDefinitionFile(const KPluginInfo& info)
: mPluginInfo(info)
{
const QFileInfo tmp(info.entryPath());
diff --git a/kasten/controllers/view/structures/structuredefinitionfile.h b/kasten/controllers/view/structures/structuredefinitionfile.h
index 5d31c34..509fe0a 100644
--- a/kasten/controllers/view/structures/structuredefinitionfile.h
+++ b/kasten/controllers/view/structures/structuredefinitionfile.h
@@ -49,7 +49,7 @@ public:
* @param info the information about this structure definition
* (passed by value so nothing bad can happen)
*/
- explicit StructureDefinitionFile(KPluginInfo info);
+ explicit StructureDefinitionFile(const KPluginInfo& info);
virtual ~StructureDefinitionFile();
QVector<TopLevelDataInformation*> structures() const;