diff options
author | Henning Baldersheim <balder@oath.com> | 2018-08-11 00:35:31 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-08-11 00:35:31 +0200 |
commit | e198573919f269bf62bb7ff22c0fb5797375ef9c (patch) | |
tree | 33b1c2b551290c70d6647c6c5b313758e5fe950c | |
parent | 9f1d806d415b458b2139ce0cbf6b03a3ae979539 (diff) |
Pass stringref by value
58 files changed, 85 insertions, 85 deletions
diff --git a/document/src/vespa/document/base/fieldpath.cpp b/document/src/vespa/document/base/fieldpath.cpp index d1603ca5c09..2606aa269ed 100644 --- a/document/src/vespa/document/base/fieldpath.cpp +++ b/document/src/vespa/document/base/fieldpath.cpp @@ -100,7 +100,7 @@ FieldPathEntry::FieldPathEntry(const DataType&, const DataType& keyType, setFillValue(*_dataType); } -FieldPathEntry::FieldPathEntry(const DataType & dataType, const vespalib::stringref & variableName) : +FieldPathEntry::FieldPathEntry(const DataType & dataType, vespalib::stringref variableName) : _type(VARIABLE), _name(""), _field(), diff --git a/document/src/vespa/document/base/fieldpath.h b/document/src/vespa/document/base/fieldpath.h index 42248bf2595..576c534e3db 100644 --- a/document/src/vespa/document/base/fieldpath.h +++ b/document/src/vespa/document/base/fieldpath.h @@ -64,7 +64,7 @@ public: /** Creates a field entry for an array, map or wset traversal using a variable. */ - FieldPathEntry(const DataType & dataType, const vespalib::stringref & variableName); + FieldPathEntry(const DataType & dataType, vespalib::stringref variableName); FieldPathEntry * clone() const { return new FieldPathEntry(*this); } diff --git a/document/src/vespa/document/datatype/annotationreferencedatatype.cpp b/document/src/vespa/document/datatype/annotationreferencedatatype.cpp index 9a787f943a5..609ba87826e 100644 --- a/document/src/vespa/document/datatype/annotationreferencedatatype.cpp +++ b/document/src/vespa/document/datatype/annotationreferencedatatype.cpp @@ -37,7 +37,7 @@ unique_ptr<FieldValue> AnnotationReferenceDataType::createFieldValue() const { return FieldValue::UP(new AnnotationReferenceFieldValue(*this, 0)); } -void AnnotationReferenceDataType::onBuildFieldPath(FieldPath &, const vespalib::stringref &) const { } +void AnnotationReferenceDataType::onBuildFieldPath(FieldPath &, vespalib::stringref ) const { } } // namespace document diff --git a/document/src/vespa/document/datatype/annotationreferencedatatype.h b/document/src/vespa/document/datatype/annotationreferencedatatype.h index 424d1e19736..2184a2873a2 100644 --- a/document/src/vespa/document/datatype/annotationreferencedatatype.h +++ b/document/src/vespa/document/datatype/annotationreferencedatatype.h @@ -20,7 +20,7 @@ public: void print(std::ostream &out, bool verbose, const std::string &indent) const override; AnnotationReferenceDataType *clone() const override; std::unique_ptr<FieldValue> createFieldValue() const override; - void onBuildFieldPath(FieldPath & path, const vespalib::stringref &remainFieldName) const override; + void onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const override; DECLARE_IDENTIFIABLE(AnnotationReferenceDataType); }; diff --git a/document/src/vespa/document/datatype/annotationtype.h b/document/src/vespa/document/datatype/annotationtype.h index 355da3fe85f..00d48d6e384 100644 --- a/document/src/vespa/document/datatype/annotationtype.h +++ b/document/src/vespa/document/datatype/annotationtype.h @@ -19,7 +19,7 @@ public: typedef std::unique_ptr<AnnotationType> UP; typedef std::shared_ptr<AnnotationType> SP; - AnnotationType(int id, const vespalib::stringref &name) + AnnotationType(int id, vespalib::stringref name) : _id(id), _name(name), _type(0) {} void setDataType(const DataType &type) { _type = &type; } diff --git a/document/src/vespa/document/datatype/arraydatatype.cpp b/document/src/vespa/document/datatype/arraydatatype.cpp index b49599ac620..8eb6a6ac875 100644 --- a/document/src/vespa/document/datatype/arraydatatype.cpp +++ b/document/src/vespa/document/datatype/arraydatatype.cpp @@ -43,7 +43,7 @@ ArrayDataType::operator==(const DataType& other) const } void -ArrayDataType::onBuildFieldPath(FieldPath & path, const vespalib::stringref & remainFieldName) const +ArrayDataType::onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const { if (remainFieldName[0] == '[') { size_t endPos = remainFieldName.find(']'); diff --git a/document/src/vespa/document/datatype/arraydatatype.h b/document/src/vespa/document/datatype/arraydatatype.h index 6be50302c3d..55b5af184dd 100644 --- a/document/src/vespa/document/datatype/arraydatatype.h +++ b/document/src/vespa/document/datatype/arraydatatype.h @@ -27,7 +27,7 @@ public: void print(std::ostream&, bool verbose, const std::string& indent) const override; bool operator==(const DataType& other) const override; ArrayDataType* clone() const override { return new ArrayDataType(*this); } - void onBuildFieldPath(FieldPath & path, const vespalib::stringref & remainFieldName) const override; + void onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const override; DECLARE_IDENTIFIABLE(ArrayDataType); }; diff --git a/document/src/vespa/document/datatype/datatype.cpp b/document/src/vespa/document/datatype/datatype.cpp index 18dd4b7a7a4..190f0213582 100644 --- a/document/src/vespa/document/datatype/datatype.cpp +++ b/document/src/vespa/document/datatype/datatype.cpp @@ -170,7 +170,7 @@ DataType::operator<(const DataType& other) const } void -DataType::buildFieldPath(FieldPath & path, const vespalib::stringref & remainFieldName) const +DataType::buildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const { if ( !remainFieldName.empty() ) { path.reserve(4); // Optimize for short paths diff --git a/document/src/vespa/document/datatype/datatype.h b/document/src/vespa/document/datatype/datatype.h index edb23d59e8b..357349b2eff 100644 --- a/document/src/vespa/document/datatype/datatype.h +++ b/document/src/vespa/document/datatype/datatype.h @@ -128,14 +128,14 @@ public: * MUST be null-terminated. * @return pointer to field path or null if an error occured */ - void buildFieldPath(FieldPath & fieldPath, const vespalib::stringref & remainFieldName) const; + void buildFieldPath(FieldPath & fieldPath, vespalib::stringref remainFieldName) const; /** @throws FieldNotFoundException if field does not exist. */ virtual const Field& getField(int fieldId) const; DECLARE_IDENTIFIABLE_ABSTRACT(DataType); private: - virtual void onBuildFieldPath(FieldPath & fieldPath, const vespalib::stringref & remainFieldName) const = 0; + virtual void onBuildFieldPath(FieldPath & fieldPath, vespalib::stringref remainFieldName) const = 0; }; } // document diff --git a/document/src/vespa/document/datatype/mapdatatype.cpp b/document/src/vespa/document/datatype/mapdatatype.cpp index 4598b96d970..01a0f44c457 100644 --- a/document/src/vespa/document/datatype/mapdatatype.cpp +++ b/document/src/vespa/document/datatype/mapdatatype.cpp @@ -57,7 +57,7 @@ MapDataType::operator==(const DataType& other) const void MapDataType::buildFieldPathImpl(FieldPath & path, const DataType &dataType, - const vespalib::stringref &remainFieldName, + vespalib::stringref remainFieldName, const DataType &keyType, const DataType &valueType) { if (!remainFieldName.empty() && remainFieldName[0] == '{') { @@ -97,7 +97,7 @@ MapDataType::buildFieldPathImpl(FieldPath & path, const DataType &dataType, } void -MapDataType::onBuildFieldPath(FieldPath & fieldPath, const vespalib::stringref &remainFieldName) const +MapDataType::onBuildFieldPath(FieldPath & fieldPath, vespalib::stringref remainFieldName) const { buildFieldPathImpl(fieldPath, *this, remainFieldName, getKeyType(), getValueType()); } diff --git a/document/src/vespa/document/datatype/mapdatatype.h b/document/src/vespa/document/datatype/mapdatatype.h index 9e7a32e29c0..a7f2cef8b68 100644 --- a/document/src/vespa/document/datatype/mapdatatype.h +++ b/document/src/vespa/document/datatype/mapdatatype.h @@ -28,9 +28,9 @@ public: bool operator==(const DataType& other) const override; MapDataType* clone() const override { return new MapDataType(*this); } - void onBuildFieldPath(FieldPath & path, const vespalib::stringref &remainFieldName) const override; + void onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const override; static void buildFieldPathImpl(FieldPath & path, const DataType& dataType, - const vespalib::stringref &remainFieldName, + vespalib::stringref remainFieldName, const DataType &keyType, const DataType &valueType); DECLARE_IDENTIFIABLE(MapDataType); diff --git a/document/src/vespa/document/datatype/primitivedatatype.cpp b/document/src/vespa/document/datatype/primitivedatatype.cpp index 3755ebc370e..e48e4464acf 100644 --- a/document/src/vespa/document/datatype/primitivedatatype.cpp +++ b/document/src/vespa/document/datatype/primitivedatatype.cpp @@ -79,7 +79,7 @@ PrimitiveDataType::print(std::ostream& out, bool verbose, const std::string& ind } void -PrimitiveDataType::onBuildFieldPath(FieldPath &, const vespalib::stringref & rest) const +PrimitiveDataType::onBuildFieldPath(FieldPath &, vespalib::stringref rest) const { if ( ! rest.empty()) { std::ostringstream ost; diff --git a/document/src/vespa/document/datatype/primitivedatatype.h b/document/src/vespa/document/datatype/primitivedatatype.h index 0d7e5c0c826..95e817f5692 100644 --- a/document/src/vespa/document/datatype/primitivedatatype.h +++ b/document/src/vespa/document/datatype/primitivedatatype.h @@ -20,7 +20,7 @@ namespace document { class PrimitiveDataType : public DataType { - void onBuildFieldPath(FieldPath & path, const vespalib::stringref & remainFieldName) const override; + void onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const override; public: PrimitiveDataType(Type _type); diff --git a/document/src/vespa/document/datatype/referencedatatype.cpp b/document/src/vespa/document/datatype/referencedatatype.cpp index 8f0c6a0a4c3..6792d95909c 100644 --- a/document/src/vespa/document/datatype/referencedatatype.cpp +++ b/document/src/vespa/document/datatype/referencedatatype.cpp @@ -33,7 +33,7 @@ ReferenceDataType* ReferenceDataType::clone() const { return new ReferenceDataType(_targetDocType, getId()); } -void ReferenceDataType::onBuildFieldPath(FieldPath &, const vespalib::stringref& remainingFieldName) const { +void ReferenceDataType::onBuildFieldPath(FieldPath &, vespalib::stringref remainingFieldName) const { if ( ! remainingFieldName.empty() ) { throw IllegalArgumentException(make_string("Reference data type does not support further field recursion: '%s'", vespalib::string(remainingFieldName).c_str()), VESPA_STRLOC); diff --git a/document/src/vespa/document/datatype/referencedatatype.h b/document/src/vespa/document/datatype/referencedatatype.h index f3e385c1614..d5804d09835 100644 --- a/document/src/vespa/document/datatype/referencedatatype.h +++ b/document/src/vespa/document/datatype/referencedatatype.h @@ -23,7 +23,7 @@ public: std::unique_ptr<FieldValue> createFieldValue() const override; void print(std::ostream&, bool verbose, const std::string& indent) const override; ReferenceDataType* clone() const override; - void onBuildFieldPath(FieldPath & path, const vespalib::stringref& remainingFieldName) const override; + void onBuildFieldPath(FieldPath & path, vespalib::stringref remainingFieldName) const override; }; } // document diff --git a/document/src/vespa/document/datatype/structureddatatype.cpp b/document/src/vespa/document/datatype/structureddatatype.cpp index bdd56b94d51..6553f450134 100644 --- a/document/src/vespa/document/datatype/structureddatatype.cpp +++ b/document/src/vespa/document/datatype/structureddatatype.cpp @@ -54,7 +54,7 @@ int32_t StructuredDataType::createId(vespalib::stringref name) } void -StructuredDataType::onBuildFieldPath(FieldPath & path, const vespalib::stringref & remainFieldName) const +StructuredDataType::onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const { vespalib::stringref currFieldName(remainFieldName); vespalib::stringref subFieldName; diff --git a/document/src/vespa/document/datatype/structureddatatype.h b/document/src/vespa/document/datatype/structureddatatype.h index c3c49765235..5cd9804bd64 100644 --- a/document/src/vespa/document/datatype/structureddatatype.h +++ b/document/src/vespa/document/datatype/structureddatatype.h @@ -16,7 +16,7 @@ namespace document { class StructuredDataType : public DataType { - void onBuildFieldPath(FieldPath & path, const vespalib::stringref & remainFieldName) const override; + void onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const override; protected: StructuredDataType(); diff --git a/document/src/vespa/document/datatype/weightedsetdatatype.cpp b/document/src/vespa/document/datatype/weightedsetdatatype.cpp index c2726ec6f5a..02e60cce88b 100644 --- a/document/src/vespa/document/datatype/weightedsetdatatype.cpp +++ b/document/src/vespa/document/datatype/weightedsetdatatype.cpp @@ -83,7 +83,7 @@ WeightedSetDataType::operator==(const DataType& other) const } void -WeightedSetDataType::onBuildFieldPath(FieldPath & path, const vespalib::stringref & remainFieldName) const +WeightedSetDataType::onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const { MapDataType::buildFieldPathImpl(path, *this, remainFieldName, getNestedType(), *DataType::INT); } diff --git a/document/src/vespa/document/datatype/weightedsetdatatype.h b/document/src/vespa/document/datatype/weightedsetdatatype.h index 91917ec990f..15d979a02bb 100644 --- a/document/src/vespa/document/datatype/weightedsetdatatype.h +++ b/document/src/vespa/document/datatype/weightedsetdatatype.h @@ -40,7 +40,7 @@ public: void print(std::ostream&, bool verbose, const std::string& indent) const override; bool operator==(const DataType& other) const override; WeightedSetDataType* clone() const override { return new WeightedSetDataType(*this); } - void onBuildFieldPath(FieldPath & path, const vespalib::stringref &remainFieldName) const override; + void onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const override; DECLARE_IDENTIFIABLE(WeightedSetDataType); }; diff --git a/document/src/vespa/document/fieldset/fieldsetrepo.cpp b/document/src/vespa/document/fieldset/fieldsetrepo.cpp index 93cb20445c6..0f30a70d766 100644 --- a/document/src/vespa/document/fieldset/fieldsetrepo.cpp +++ b/document/src/vespa/document/fieldset/fieldsetrepo.cpp @@ -38,8 +38,8 @@ parseSpecialValues(vespalib::stringref name) FieldSet::UP parseFieldCollection(const DocumentTypeRepo& repo, - const vespalib::stringref & docType, - const vespalib::stringref & fieldNames) + vespalib::stringref docType, + vespalib::stringref fieldNames) { const DocumentType* typePtr = repo.getDocumentType(docType); if (!typePtr) { @@ -68,7 +68,7 @@ parseFieldCollection(const DocumentTypeRepo& repo, } FieldSet::UP -FieldSetRepo::parse(const DocumentTypeRepo& repo, const vespalib::stringref & str) +FieldSetRepo::parse(const DocumentTypeRepo& repo, vespalib::stringref str) { if (str[0] == '[') { return parseSpecialValues(str); diff --git a/document/src/vespa/document/fieldset/fieldsetrepo.h b/document/src/vespa/document/fieldset/fieldsetrepo.h index d0bff0d60c8..a744aa572e5 100644 --- a/document/src/vespa/document/fieldset/fieldsetrepo.h +++ b/document/src/vespa/document/fieldset/fieldsetrepo.h @@ -17,7 +17,7 @@ class FieldSetRepo { public: static FieldSet::UP parse(const DocumentTypeRepo& repo, - const vespalib::stringref & fieldSetString); + vespalib::stringref fieldSetString); static vespalib::string serialize(const FieldSet& fs); }; diff --git a/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp b/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp index a09d5a25dd2..5ec4535ce68 100644 --- a/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp @@ -180,7 +180,7 @@ ArrayFieldValue::hasChanged() const fieldvalue::ModificationStatus ArrayFieldValue::iterateSubset(int startPos, int endPos, - const vespalib::stringref & variable, + vespalib::stringref variable, PathRange nested, fieldvalue::IteratorHandler& handler) const { diff --git a/document/src/vespa/document/fieldvalue/arrayfieldvalue.h b/document/src/vespa/document/fieldvalue/arrayfieldvalue.h index bf7075ce349..4d36d4f0176 100644 --- a/document/src/vespa/document/fieldvalue/arrayfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/arrayfieldvalue.h @@ -27,7 +27,7 @@ private: bool containsValue(const FieldValue& val) const override; bool removeValue(const FieldValue& val) override; fieldvalue::ModificationStatus iterateSubset( - int startPos, int endPos, const vespalib::stringref & variable, + int startPos, int endPos, vespalib::stringref variable, PathRange nested, fieldvalue::IteratorHandler& handler) const; fieldvalue::ModificationStatus onIterateNested(PathRange nested, fieldvalue::IteratorHandler & handler) const override; diff --git a/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp b/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp index 13db6ecbf46..d49f6e28a76 100644 --- a/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp @@ -109,7 +109,7 @@ FieldValue & StringFieldValue::assign(const FieldValue & rhs) if (rhs.inherits(StringFieldValue::classId)) { *this = static_cast<const StringFieldValue &>(rhs); } else { - *this = static_cast<const stringref &>(rhs.getAsString()); + *this = static_cast<stringref >(rhs.getAsString()); } return *this; } diff --git a/document/src/vespa/document/select/doctype.cpp b/document/src/vespa/document/select/doctype.cpp index 4b42d451f70..3770a9a9da4 100644 --- a/document/src/vespa/document/select/doctype.cpp +++ b/document/src/vespa/document/select/doctype.cpp @@ -11,7 +11,7 @@ namespace document::select { namespace { bool documentTypeEqualsName(const DocumentType& type, - const vespalib::stringref& name) + vespalib::stringref name) { if (type.getName() == name) return true; for (std::vector<const DocumentType *>::const_iterator it diff --git a/document/src/vespa/document/select/operator.cpp b/document/src/vespa/document/select/operator.cpp index 8deb19452f0..4d3999b0fd8 100644 --- a/document/src/vespa/document/select/operator.cpp +++ b/document/src/vespa/document/select/operator.cpp @@ -123,7 +123,7 @@ RegexOperator::traceImpl(const Value& a, const Value& b, std::ostream& out) cons } ResultList -RegexOperator::match(const vespalib::string& val, const vespalib::stringref & expr) const +RegexOperator::match(const vespalib::string& val, vespalib::stringref expr) const { // Should we catch this in parsing? if (expr.size() == 0) return ResultList(Result::True); diff --git a/document/src/vespa/document/select/operator.h b/document/src/vespa/document/select/operator.h index a841f91802a..de44fef628c 100644 --- a/document/src/vespa/document/select/operator.h +++ b/document/src/vespa/document/select/operator.h @@ -70,7 +70,7 @@ public: // Delegates to Value::regexCompare ResultList compare(const Value& a, const Value& b) const override; ResultList trace(const Value&, const Value&, std::ostream& trace) const override; - ResultList match(const vespalib::string & val, const vespalib::stringref & expr) const; + ResultList match(const vespalib::string & val, vespalib::stringref expr) const; static const RegexOperator REGEX; diff --git a/document/src/vespa/document/select/simpleparser.h b/document/src/vespa/document/select/simpleparser.h index a87c1938db9..de537c4afa9 100644 --- a/document/src/vespa/document/select/simpleparser.h +++ b/document/src/vespa/document/select/simpleparser.h @@ -12,7 +12,7 @@ class Parser { public: virtual ~Parser() { } virtual bool parse(vespalib::stringref s) = 0; - const vespalib::stringref & getRemaining() const { return _remaining; } + vespalib::stringref getRemaining() const { return _remaining; } protected: void setRemaining(vespalib::stringref s) { _remaining = s; } private: diff --git a/document/src/vespa/document/select/valuenodes.cpp b/document/src/vespa/document/select/valuenodes.cpp index 52df1ed6dcc..2ed147a1944 100644 --- a/document/src/vespa/document/select/valuenodes.cpp +++ b/document/src/vespa/document/select/valuenodes.cpp @@ -25,7 +25,7 @@ namespace { } namespace { - bool documentTypeEqualsName(const DocumentType& type, const vespalib::stringref& name) + bool documentTypeEqualsName(const DocumentType& type, vespalib::stringref name) { if (type.getName() == name) return true; for (std::vector<const DocumentType *>::const_iterator it @@ -434,7 +434,7 @@ FieldValueNode::traceValue(const Context &context, std::ostream& out) const } IdValueNode::IdValueNode(const BucketIdFactory& bucketIdFactory, - const vespalib::stringref & name, const vespalib::stringref & type, + vespalib::stringref name, vespalib::stringref type, int widthBits, int divisionBits) : _bucketIdFactory(bucketIdFactory), _id(name), @@ -857,7 +857,7 @@ FunctionValueNode::print(std::ostream& out, bool verbose, } ArithmeticValueNode::ArithmeticValueNode( - std::unique_ptr<ValueNode> left, const vespalib::stringref & op, + std::unique_ptr<ValueNode> left, vespalib::stringref op, std::unique_ptr<ValueNode> right) : _operator(), _left(std::move(left)), diff --git a/document/src/vespa/document/select/valuenodes.h b/document/src/vespa/document/select/valuenodes.h index 2f5031abce7..0b412eaeb0f 100644 --- a/document/src/vespa/document/select/valuenodes.h +++ b/document/src/vespa/document/select/valuenodes.h @@ -242,7 +242,7 @@ public: enum Type { SCHEME, NS, TYPE, USER, GROUP, GID, SPEC, BUCKET, ORDER, ALL }; IdValueNode(const BucketIdFactory& bucketIdFactory, - const vespalib::stringref & name, const vespalib::stringref & type, + vespalib::stringref name, vespalib::stringref type, int widthBits = -1, int divisionBits = -1); Type getType() const { return _type; } @@ -318,7 +318,7 @@ public: enum Operator { ADD, SUB, MUL, DIV, MOD }; ArithmeticValueNode(std::unique_ptr<ValueNode> left, - const vespalib::stringref & op, + vespalib::stringref op, std::unique_ptr<ValueNode> right); Operator getOperator() const { return _operator; } diff --git a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp index 399cadb4c7d..4f30851ac4c 100644 --- a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp +++ b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp @@ -249,7 +249,7 @@ void VespaDocumentDeserializer::read(PredicateFieldValue &value) { namespace { template <typename FV> -void setValue(FV &field_value, const stringref &val, bool use_ref) { +void setValue(FV &field_value, stringref val, bool use_ref) { if (use_ref) { field_value.setValueRef(val); } else { diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.cpp b/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.cpp index 53b1abc8dcb..821af8e256b 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.cpp @@ -20,7 +20,7 @@ GetDocumentMessage::GetDocumentMessage(const document::DocumentId &documentId, i } GetDocumentMessage::GetDocumentMessage(const document::DocumentId &documentId, - const vespalib::stringref & fieldSet) : + vespalib::stringref fieldSet) : DocumentMessage(), _documentId(documentId), _fieldSet(fieldSet) diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.h index 09ba8306b61..619367faf4d 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.h @@ -46,7 +46,7 @@ public: * @param fieldSet The fields to retrieve (comma-separated) */ GetDocumentMessage(const document::DocumentId &documentId, - const vespalib::stringref & fieldSet); + vespalib::stringref fieldSet); ~GetDocumentMessage(); diff --git a/messagebus/src/vespa/messagebus/routing/policydirective.cpp b/messagebus/src/vespa/messagebus/routing/policydirective.cpp index 64710d99b80..64041aa1cbc 100644 --- a/messagebus/src/vespa/messagebus/routing/policydirective.cpp +++ b/messagebus/src/vespa/messagebus/routing/policydirective.cpp @@ -6,7 +6,7 @@ using vespalib::make_string; namespace mbus { -PolicyDirective::PolicyDirective(vespalib::stringref name, const vespalib::stringref ¶m) : +PolicyDirective::PolicyDirective(vespalib::stringref name, vespalib::stringref param) : _name(name), _param(param) { } diff --git a/messagebus/src/vespa/messagebus/routing/policydirective.h b/messagebus/src/vespa/messagebus/routing/policydirective.h index ef9387e5015..d4471b5e219 100644 --- a/messagebus/src/vespa/messagebus/routing/policydirective.h +++ b/messagebus/src/vespa/messagebus/routing/policydirective.h @@ -25,7 +25,7 @@ public: * @param name The name of the policy to invoke. * @param param The parameter to pass to the name constructor. */ - PolicyDirective(vespalib::stringref name, const vespalib::stringref ¶m); + PolicyDirective(vespalib::stringref name, vespalib::stringref param); ~PolicyDirective(); /** diff --git a/messagebus/src/vespa/messagebus/routing/tcpdirective.cpp b/messagebus/src/vespa/messagebus/routing/tcpdirective.cpp index 7dd7672712d..764f26c24da 100644 --- a/messagebus/src/vespa/messagebus/routing/tcpdirective.cpp +++ b/messagebus/src/vespa/messagebus/routing/tcpdirective.cpp @@ -5,7 +5,7 @@ namespace mbus { -TcpDirective::TcpDirective(vespalib::stringref host, uint32_t port, const vespalib::stringref &session) : +TcpDirective::TcpDirective(vespalib::stringref host, uint32_t port, vespalib::stringref session) : _host(host), _port(port), _session(session) diff --git a/messagebus/src/vespa/messagebus/routing/tcpdirective.h b/messagebus/src/vespa/messagebus/routing/tcpdirective.h index c38d131b6a3..3fbd933c775 100644 --- a/messagebus/src/vespa/messagebus/routing/tcpdirective.h +++ b/messagebus/src/vespa/messagebus/routing/tcpdirective.h @@ -26,7 +26,7 @@ public: * @param port The port to connect to. * @param session The session to route to. */ - TcpDirective(vespalib::stringref host, uint32_t port, const vespalib::stringref &session); + TcpDirective(vespalib::stringref host, uint32_t port, vespalib::stringref session); /** * Returns the host to connect to. This may be an ip address or a name. diff --git a/metrics/src/vespa/metrics/countmetric.h b/metrics/src/vespa/metrics/countmetric.h index 4de1674c5ed..dd4c9e6fc92 100644 --- a/metrics/src/vespa/metrics/countmetric.h +++ b/metrics/src/vespa/metrics/countmetric.h @@ -111,11 +111,11 @@ public: const std::string& indent, uint64_t secondsPassed) const override; // Only one metric in valuemetric, so return it on any id. - int64_t getLongValue(const stringref & id) const override { + int64_t getLongValue(stringref id) const override { (void) id; return static_cast<int64_t>(getValue()); } - double getDoubleValue(const stringref & id) const override { + double getDoubleValue(stringref id) const override { (void) id; return static_cast<double>(getValue()); } diff --git a/metrics/src/vespa/metrics/countmetricvalues.h b/metrics/src/vespa/metrics/countmetricvalues.h index 226d1a53ddb..cef2a0ee123 100644 --- a/metrics/src/vespa/metrics/countmetricvalues.h +++ b/metrics/src/vespa/metrics/countmetricvalues.h @@ -37,8 +37,8 @@ struct CountMetricValues : public MetricValueClass { CountMetricValues() : _value(0) {} std::string toString() const; - double getDoubleValue(const stringref &) const override; - uint64_t getLongValue(const stringref &) const override; + double getDoubleValue(stringref ) const override; + uint64_t getLongValue(stringref ) const override; void output(const std::string&, std::ostream& out) const override; void output(const std::string&, vespalib::JsonStream& stream) const override; bool inUse() const { return (_value != 0); } diff --git a/metrics/src/vespa/metrics/countmetricvalues.hpp b/metrics/src/vespa/metrics/countmetricvalues.hpp index 15732a7c1d5..66c0fbc6c46 100644 --- a/metrics/src/vespa/metrics/countmetricvalues.hpp +++ b/metrics/src/vespa/metrics/countmetricvalues.hpp @@ -15,12 +15,12 @@ CountMetricValues<T>::toString() const { } template <typename T> double -CountMetricValues<T>::getDoubleValue(const stringref &) const { +CountMetricValues<T>::getDoubleValue(stringref ) const { return static_cast<double>(_value); } template <typename T> uint64_t -CountMetricValues<T>::getLongValue(const stringref &) const { +CountMetricValues<T>::getLongValue(stringref ) const { return static_cast<uint64_t>(_value); } template <typename T> diff --git a/metrics/src/vespa/metrics/metric.h b/metrics/src/vespa/metrics/metric.h index 1b97dcb7d27..5b617e68a7f 100644 --- a/metrics/src/vespa/metrics/metric.h +++ b/metrics/src/vespa/metrics/metric.h @@ -180,8 +180,8 @@ public: * @param id The part of the metric to extract. For instance, an average * metric have average, */ - virtual int64_t getLongValue(const stringref & id) const = 0; - virtual double getDoubleValue(const stringref & id) const = 0; + virtual int64_t getLongValue(stringref id) const = 0; + virtual double getDoubleValue(stringref id) const = 0; /** * When snapshotting we need to be able to add data from one set of metrics diff --git a/metrics/src/vespa/metrics/metricset.cpp b/metrics/src/vespa/metrics/metricset.cpp index 6ac27ba38c9..696062013e8 100644 --- a/metrics/src/vespa/metrics/metricset.cpp +++ b/metrics/src/vespa/metrics/metricset.cpp @@ -76,11 +76,11 @@ MetricSet::getMetricInternal(const String& name) const return 0; } -int64_t MetricSet::getLongValue(const stringref &) const { +int64_t MetricSet::getLongValue(stringref ) const { assert(false); return 0; } -double MetricSet::getDoubleValue(const stringref &) const { +double MetricSet::getDoubleValue(stringref ) const { assert(false); return 0; } diff --git a/metrics/src/vespa/metrics/metricset.h b/metrics/src/vespa/metrics/metricset.h index e6f7cfc0deb..9671aaffbfc 100644 --- a/metrics/src/vespa/metrics/metricset.h +++ b/metrics/src/vespa/metrics/metricset.h @@ -63,8 +63,8 @@ public: void print(std::ostream&, bool verbose, const std::string& indent, uint64_t secondsPassed) const override; // These should never be called on metrics set. - int64_t getLongValue(const stringref & id) const override; - double getDoubleValue(const stringref & id) const override; + int64_t getLongValue(stringref id) const override; + double getDoubleValue(stringref id) const override; const Metric* getMetric(const String& name) const; Metric* getMetric(const String& name) { diff --git a/metrics/src/vespa/metrics/metricvalueset.h b/metrics/src/vespa/metrics/metricvalueset.h index 41498b6503c..2463990378e 100644 --- a/metrics/src/vespa/metrics/metricvalueset.h +++ b/metrics/src/vespa/metrics/metricvalueset.h @@ -39,8 +39,8 @@ struct MetricValueClass { using stringref = vespalib::stringref; virtual ~MetricValueClass() {} - virtual double getDoubleValue(const stringref & id) const = 0; - virtual uint64_t getLongValue(const stringref & id) const = 0; + virtual double getDoubleValue(stringref id) const = 0; + virtual uint64_t getLongValue(stringref id) const = 0; virtual void output(const std::string& id, std::ostream&) const = 0; virtual void output(const std::string& id, vespalib::JsonStream&) const = 0; std::string toString(const std::string& id); diff --git a/metrics/src/vespa/metrics/summetric.h b/metrics/src/vespa/metrics/summetric.h index 784ae1f20e7..3dc58d32bef 100644 --- a/metrics/src/vespa/metrics/summetric.h +++ b/metrics/src/vespa/metrics/summetric.h @@ -61,8 +61,8 @@ public: bool logEvent(const String& fullName) const override; void print(std::ostream&, bool verbose, const std::string& indent, uint64_t secondsPassed) const override; - int64_t getLongValue(const stringref & id) const override; - double getDoubleValue(const stringref & id) const override; + int64_t getLongValue(stringref id) const override; + double getDoubleValue(stringref id) const override; void reset() override {} bool visit(MetricVisitor& visitor, bool tagAsAutoGenerated = false) const override; bool used() const override; diff --git a/metrics/src/vespa/metrics/summetric.hpp b/metrics/src/vespa/metrics/summetric.hpp index 761b369fb57..8e558eb94ee 100644 --- a/metrics/src/vespa/metrics/summetric.hpp +++ b/metrics/src/vespa/metrics/summetric.hpp @@ -234,7 +234,7 @@ SumMetric<AddendMetric>::generateSum() const template<typename AddendMetric> int64_t -SumMetric<AddendMetric>::getLongValue(const stringref & id) const +SumMetric<AddendMetric>::getLongValue(stringref id) const { std::pair<std::vector<Metric::UP>, Metric::UP> sum(generateSum()); if (sum.second.get() == 0) return 0; @@ -243,7 +243,7 @@ SumMetric<AddendMetric>::getLongValue(const stringref & id) const template<typename AddendMetric> double -SumMetric<AddendMetric>::getDoubleValue(const stringref & id) const +SumMetric<AddendMetric>::getDoubleValue(stringref id) const { std::pair<std::vector<Metric::UP>, Metric::UP> sum(generateSum()); if (sum.second.get() == 0) return 0.0; diff --git a/metrics/src/vespa/metrics/valuemetric.h b/metrics/src/vespa/metrics/valuemetric.h index 0c40a0fa5ea..57baa36c26a 100644 --- a/metrics/src/vespa/metrics/valuemetric.h +++ b/metrics/src/vespa/metrics/valuemetric.h @@ -147,8 +147,8 @@ public: void print(std::ostream&, bool verbose, const std::string& indent, uint64_t secondsPassed) const override; - int64_t getLongValue(const stringref & id) const override; - double getDoubleValue(const stringref & id) const override; + int64_t getLongValue(stringref id) const override; + double getDoubleValue(stringref id) const override; bool inUse(const MetricValueClass& v) const override { const Values& values(static_cast<const Values&>(v)); diff --git a/metrics/src/vespa/metrics/valuemetric.hpp b/metrics/src/vespa/metrics/valuemetric.hpp index f8b4d1626ab..60ed219edec 100644 --- a/metrics/src/vespa/metrics/valuemetric.hpp +++ b/metrics/src/vespa/metrics/valuemetric.hpp @@ -226,7 +226,7 @@ ValueMetric<AvgVal, TotVal, SumOnAdd>::print( template<typename AvgVal, typename TotVal, bool SumOnAdd> int64_t -ValueMetric<AvgVal, TotVal, SumOnAdd>::getLongValue(const stringref & id) const +ValueMetric<AvgVal, TotVal, SumOnAdd>::getLongValue(stringref id) const { Values values(_values.getValues()); if (id == "last" || (SumOnAdd && id == "value")) @@ -245,7 +245,7 @@ ValueMetric<AvgVal, TotVal, SumOnAdd>::getLongValue(const stringref & id) const template<typename AvgVal, typename TotVal, bool SumOnAdd> double -ValueMetric<AvgVal, TotVal, SumOnAdd>::getDoubleValue(const stringref & id) const +ValueMetric<AvgVal, TotVal, SumOnAdd>::getDoubleValue(stringref id) const { Values values(_values.getValues()); if (id == "last" || (SumOnAdd && id == "value")) diff --git a/metrics/src/vespa/metrics/valuemetricvalues.h b/metrics/src/vespa/metrics/valuemetricvalues.h index 391b9c9d588..567f0d0ae0f 100644 --- a/metrics/src/vespa/metrics/valuemetricvalues.h +++ b/metrics/src/vespa/metrics/valuemetricvalues.h @@ -37,9 +37,9 @@ struct ValueMetricValues : MetricValueClass { void relaxedLoadFrom(const AtomicImpl& source) noexcept; template<typename T> - T getValue(const stringref & id) const; - double getDoubleValue(const stringref & id) const override; - uint64_t getLongValue(const stringref & id) const override; + T getValue(stringref id) const; + double getDoubleValue(stringref id) const override; + uint64_t getLongValue(stringref id) const override; void output(const std::string& id, std::ostream& out) const override; void output(const std::string& id, vespalib::JsonStream& stream) const override; template<typename A, typename T> diff --git a/metrics/src/vespa/metrics/valuemetricvalues.hpp b/metrics/src/vespa/metrics/valuemetricvalues.hpp index 9f63898d4f3..b33e636b120 100644 --- a/metrics/src/vespa/metrics/valuemetricvalues.hpp +++ b/metrics/src/vespa/metrics/valuemetricvalues.hpp @@ -48,7 +48,7 @@ void ValueMetricValues<AvgVal, TotVal>::relaxedLoadFrom(const AtomicImpl& source template<typename AvgVal, typename TotVal> template<typename T> -T ValueMetricValues<AvgVal, TotVal>::getValue(const stringref & id) const { +T ValueMetricValues<AvgVal, TotVal>::getValue(stringref id) const { if (id == "last") return static_cast<T>(_last); if (id == "count") return static_cast<T>(_count); if (id == "total") return static_cast<T>(_total); @@ -58,11 +58,11 @@ T ValueMetricValues<AvgVal, TotVal>::getValue(const stringref & id) const { } template<typename AvgVal, typename TotVal> -double ValueMetricValues<AvgVal, TotVal>::getDoubleValue(const stringref & id) const { +double ValueMetricValues<AvgVal, TotVal>::getDoubleValue(stringref id) const { return getValue<double>(id); } template<typename AvgVal, typename TotVal> -uint64_t ValueMetricValues<AvgVal, TotVal>::getLongValue(const stringref & id) const { +uint64_t ValueMetricValues<AvgVal, TotVal>::getLongValue(stringref id) const { return getValue<uint64_t>(id); } template<typename AvgVal, typename TotVal> diff --git a/searchcommon/src/vespa/searchcommon/common/schema.cpp b/searchcommon/src/vespa/searchcommon/common/schema.cpp index 775199694c0..31362c80a94 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.cpp +++ b/searchcommon/src/vespa/searchcommon/common/schema.cpp @@ -17,7 +17,7 @@ namespace { template <typename T> void writeFields(vespalib::asciistream & os, - const vespalib::stringref &prefix, + vespalib::stringref prefix, const std::vector<T> & fields) { os << prefix << "[" << fields.size() << "]\n"; @@ -100,7 +100,7 @@ Schema::Field::Field(const std::vector<vespalib::string> & lines) Schema::Field::~Field() { } void -Schema::Field::write(vespalib::asciistream & os, const vespalib::stringref & prefix) const +Schema::Field::write(vespalib::asciistream & os, vespalib::stringref prefix) const { os << prefix << "name " << _name << "\n"; os << prefix << "datatype " << getTypeName(_dataType) << "\n"; @@ -157,7 +157,7 @@ Schema::IndexField::IndexField(const std::vector<vespalib::string> &lines) } void -Schema::IndexField::write(vespalib::asciistream & os, const vespalib::stringref & prefix) const +Schema::IndexField::write(vespalib::asciistream & os, vespalib::stringref prefix) const { Field::write(os, prefix); os << prefix << "prefix " << (_prefix ? "true" : "false") << "\n"; diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h index 52de8646cc1..6a1dc2827fa 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.h +++ b/searchcommon/src/vespa/searchcommon/common/schema.h @@ -52,7 +52,7 @@ public: virtual void write(vespalib::asciistream & os, - const vespalib::stringref & prefix) const; + vespalib::stringref prefix) const; const vespalib::string &getName() const { return _name; } DataType getDataType() const { return _dataType; } @@ -97,7 +97,7 @@ public: void write(vespalib::asciistream &os, - const vespalib::stringref &prefix) const override; + vespalib::stringref prefix) const override; bool hasPrefix() const { return _prefix; } bool hasPhrases() const { return _phrases; } diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp index 0a520044985..56596ec5bb6 100644 --- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp @@ -38,7 +38,7 @@ class MySearchHandler : public ISearchHandler { std::string _name; stringref _reply; public: - MySearchHandler(const std::string &name = "my", const stringref &reply = MYREPLY) + MySearchHandler(const std::string &name = "my", stringref reply = MYREPLY) : _name(name), _reply(reply) {} @@ -181,7 +181,7 @@ TEST("requireThatHandlersAreStored") { } bool -assertDocsumReply(SummaryEngine &engine, const std::string &searchDocType, const stringref &expReply) { +assertDocsumReply(SummaryEngine &engine, const std::string &searchDocType, stringref expReply) { DocsumRequest::UP request(createRequest()); request->propertiesMap.lookupCreate(search::MapNames::MATCH).add("documentdb.searchdoctype", searchDocType); MyDocsumClient client; diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/query.h b/searchcore/src/vespa/searchcore/fdispatch/search/query.h index 0e5d6008c36..315e087b4d7 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/query.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/query.h @@ -67,7 +67,7 @@ private: return (strcmp(a, b) == 0); } static bool cmp_str_ref(vespalib::stringref a, - const vespalib::stringref &b) + vespalib::stringref b) { return (a.size() == b.size() && memcmp(a.data(), b.data(), a.size()) == 0); diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp index fe10c1d51c3..055bc5fe1c2 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp @@ -147,7 +147,7 @@ MatchToolsFactory(QueryLimiter & queryLimiter, const vespalib::Doom & hardDoom, ISearchContext & searchContext, IAttributeContext & attributeContext, - const vespalib::stringref & queryStack, + vespalib::stringref queryStack, const vespalib::string & location, const ViewResolver & viewResolver, const IDocumentMetaStore & metaStore, diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h index 97baafb8bc3..0615c334628 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h @@ -92,7 +92,7 @@ public: const vespalib::Doom & hardDoom, ISearchContext &searchContext, search::attribute::IAttributeContext &attributeContext, - const vespalib::stringref &queryStack, + vespalib::stringref queryStack, const vespalib::string &location, const ViewResolver &viewResolver, const search::IDocumentMetaStore &metaStore, diff --git a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp index d8676357633..87e6c4db12d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.cpp @@ -7,7 +7,7 @@ namespace proton::matching { ViewResolver & ViewResolver::add(vespalib::stringref view, - const vespalib::stringref &field) + vespalib::stringref field) { _map[view].push_back(field); return *this; diff --git a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h index 3899167ebc0..edff7a696c3 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h +++ b/searchcore/src/vespa/searchcore/proton/matching/viewresolver.h @@ -35,7 +35,7 @@ public: * @param field the name of the field **/ ViewResolver &add(vespalib::stringref view, - const vespalib::stringref &field); + vespalib::stringref field); /** * Resolve a view to obtain the set of fields it |