aboutsummaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-08-10 23:35:50 +0200
committerHenning Baldersheim <balder@oath.com>2018-08-10 23:35:50 +0200
commit822e3e3d0630b3af1d76079da8c3e1d161c3ca1a (patch)
treeb6a4ff21d628a2e0214cabe6917d9dc0b0b620f2 /searchcommon
parent4be58f582e0cb3313eedc0abedc86170ab41580c (diff)
Pass stringref by value
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/vespa/searchcommon/common/datatype.cpp4
-rw-r--r--searchcommon/src/vespa/searchcommon/common/datatype.h4
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schema.cpp18
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schema.h26
4 files changed, 26 insertions, 26 deletions
diff --git a/searchcommon/src/vespa/searchcommon/common/datatype.cpp b/searchcommon/src/vespa/searchcommon/common/datatype.cpp
index 81e6b8a1f34..f3b2099294e 100644
--- a/searchcommon/src/vespa/searchcommon/common/datatype.cpp
+++ b/searchcommon/src/vespa/searchcommon/common/datatype.cpp
@@ -10,7 +10,7 @@ namespace search::index::schema {
using config::InvalidConfigException;
DataType
-dataTypeFromName(const vespalib::stringref &name) {
+dataTypeFromName(vespalib::stringref name) {
if (name == "UINT1") { return DataType::UINT1; }
else if (name == "UINT2") { return DataType::UINT2; }
else if (name == "UINT4") { return DataType::UINT4; }
@@ -65,7 +65,7 @@ operator<<(std::ostream &os, const DataType &type)
}
CollectionType
-collectionTypeFromName(const vespalib::stringref &name) {
+collectionTypeFromName(vespalib::stringref name) {
if (name == "SINGLE") { return CollectionType::SINGLE; }
else if (name == "ARRAY") { return CollectionType::ARRAY; }
else if (name == "WEIGHTEDSET") { return CollectionType::WEIGHTEDSET; }
diff --git a/searchcommon/src/vespa/searchcommon/common/datatype.h b/searchcommon/src/vespa/searchcommon/common/datatype.h
index ad762b9acc4..f21b6b9d5e9 100644
--- a/searchcommon/src/vespa/searchcommon/common/datatype.h
+++ b/searchcommon/src/vespa/searchcommon/common/datatype.h
@@ -34,11 +34,11 @@ enum class CollectionType { SINGLE = 0,
WEIGHTEDSET = 2
};
-DataType dataTypeFromName(const vespalib::stringref &name);
+DataType dataTypeFromName(vespalib::stringref name);
vespalib::string getTypeName(DataType type);
std::ostream &operator<<(std::ostream &os, const DataType &type);
-CollectionType collectionTypeFromName(const vespalib::stringref &n);
+CollectionType collectionTypeFromName(vespalib::stringref n);
vespalib::string getTypeName(CollectionType type);
std::ostream &operator<<(std::ostream &os, const CollectionType &type);
diff --git a/searchcommon/src/vespa/searchcommon/common/schema.cpp b/searchcommon/src/vespa/searchcommon/common/schema.cpp
index 6cd9d87fa77..775199694c0 100644
--- a/searchcommon/src/vespa/searchcommon/common/schema.cpp
+++ b/searchcommon/src/vespa/searchcommon/common/schema.cpp
@@ -55,7 +55,7 @@ struct FieldName {
template <typename T>
uint32_t
-getFieldId(const vespalib::stringref & name, const T &map)
+getFieldId(vespalib::stringref name, const T &map)
{
typename T::const_iterator it = map.find(name);
return (it != map.end()) ? it->second : Schema::UNKNOWN_FIELD_ID;
@@ -68,7 +68,7 @@ namespace index {
const uint32_t Schema::UNKNOWN_FIELD_ID(std::numeric_limits<uint32_t>::max());
-Schema::Field::Field(const vespalib::stringref &n, DataType dt)
+Schema::Field::Field(vespalib::stringref n, DataType dt)
: _name(n),
_dataType(dt),
_collectionType(schema::CollectionType::SINGLE),
@@ -76,7 +76,7 @@ Schema::Field::Field(const vespalib::stringref &n, DataType dt)
{
}
-Schema::Field::Field(const vespalib::stringref &n,
+Schema::Field::Field(vespalib::stringref n,
DataType dt, CollectionType ct)
: _name(n),
_dataType(dt),
@@ -128,7 +128,7 @@ Schema::Field::operator!=(const Field &rhs) const
_timestamp != rhs._timestamp;
}
-Schema::IndexField::IndexField(const vespalib::stringref &name, DataType dt)
+Schema::IndexField::IndexField(vespalib::stringref name, DataType dt)
: Field(name, dt),
_prefix(false),
_phrases(false),
@@ -137,7 +137,7 @@ Schema::IndexField::IndexField(const vespalib::stringref &name, DataType dt)
{
}
-Schema::IndexField::IndexField(const vespalib::stringref &name, DataType dt,
+Schema::IndexField::IndexField(vespalib::stringref name, DataType dt,
CollectionType ct)
: Field(name, dt, ct),
_prefix(false),
@@ -398,25 +398,25 @@ Schema::addFieldSet(const FieldSet &fieldSet)
}
uint32_t
-Schema::getIndexFieldId(const vespalib::stringref & name) const
+Schema::getIndexFieldId(vespalib::stringref name) const
{
return getFieldId(name, _indexIds);
}
uint32_t
-Schema::getAttributeFieldId(const vespalib::stringref & name) const
+Schema::getAttributeFieldId(vespalib::stringref name) const
{
return getFieldId(name, _attributeIds);
}
uint32_t
-Schema::getSummaryFieldId(const vespalib::stringref & name) const
+Schema::getSummaryFieldId(vespalib::stringref name) const
{
return getFieldId(name, _summaryIds);
}
uint32_t
-Schema::getFieldSetId(const vespalib::stringref &name) const
+Schema::getFieldSetId(vespalib::stringref name) const
{
return getFieldId(name, _fieldSetIds);
}
diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h
index 1c3ab3ccd56..52de8646cc1 100644
--- a/searchcommon/src/vespa/searchcommon/common/schema.h
+++ b/searchcommon/src/vespa/searchcommon/common/schema.h
@@ -38,8 +38,8 @@ public:
fastos::TimeStamp _timestamp;
public:
- Field(const vespalib::stringref &n, DataType dt);
- Field(const vespalib::stringref &n, DataType dt, CollectionType ct);
+ Field(vespalib::stringref n, DataType dt);
+ Field(vespalib::stringref n, DataType dt, CollectionType ct);
/**
* Create this field based on the given config lines.
@@ -81,8 +81,8 @@ public:
uint32_t _avgElemLen;
public:
- IndexField(const vespalib::stringref &name, DataType dt);
- IndexField(const vespalib::stringref &name, DataType dt, CollectionType ct);
+ IndexField(vespalib::stringref name, DataType dt);
+ IndexField(vespalib::stringref name, DataType dt, CollectionType ct);
/**
* Create this index field based on the given config lines.
**/
@@ -122,7 +122,7 @@ public:
std::vector<vespalib::string> _fields;
public:
- FieldSet(const vespalib::stringref & n) : _name(n), _fields() {}
+ FieldSet(vespalib::stringref n) : _name(n), _fields() {}
/**
* Create this field collection based on the given config lines.
@@ -131,7 +131,7 @@ public:
~FieldSet();
- FieldSet &addField(const vespalib::stringref &fieldName) {
+ FieldSet &addField(vespalib::stringref fieldName) {
_fields.push_back(fieldName);
return *this;
}
@@ -285,7 +285,7 @@ public:
* @return the field id or UNKNOWN_FIELD_ID if not found.
* @param name the name of the field.
**/
- uint32_t getIndexFieldId(const vespalib::stringref & name) const;
+ uint32_t getIndexFieldId(vespalib::stringref name) const;
/**
* Check if a field is an index
@@ -294,7 +294,7 @@ public:
* @param name the name of the field.
**/
bool
- isIndexField(const vespalib::stringref & name) const
+ isIndexField(vespalib::stringref name) const
{
return _indexIds.find(name) != _indexIds.end();
}
@@ -306,7 +306,7 @@ public:
* @param name the name of the field.
**/
bool
- isSummaryField(const vespalib::stringref & name) const
+ isSummaryField(vespalib::stringref name) const
{
return _summaryIds.find(name) != _summaryIds.end();
}
@@ -317,7 +317,7 @@ public:
* @param name the name of the field.
**/
bool
- isAttributeField(const vespalib::stringref & name) const
+ isAttributeField(vespalib::stringref name) const
{
return _attributeIds.find(name) != _attributeIds.end();
}
@@ -347,7 +347,7 @@ public:
* @return the field id or UNKNOWN_FIELD_ID if not found.
* @param name the name of the field.
**/
- uint32_t getAttributeFieldId(const vespalib::stringref & name) const;
+ uint32_t getAttributeFieldId(vespalib::stringref name) const;
/**
* Get information about a specific summary field using the given fieldId.
@@ -374,7 +374,7 @@ public:
* @return the field id or UNKNOWN_FIELD_ID if not found.
* @param name the name of the field.
**/
- uint32_t getSummaryFieldId(const vespalib::stringref & name) const;
+ uint32_t getSummaryFieldId(vespalib::stringref name) const;
/**
* Get information about a specific field set
@@ -395,7 +395,7 @@ public:
* @param name the name of the field set.
**/
uint32_t
- getFieldSetId(const vespalib::stringref &name) const;
+ getFieldSetId(vespalib::stringref name) const;
const std::vector<ImportedAttributeField> &getImportedAttributeFields() const {
return _importedAttributeFields;