aboutsummaryrefslogtreecommitdiffstats
path: root/document
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 /document
parent4be58f582e0cb3313eedc0abedc86170ab41580c (diff)
Pass stringref by value
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/documentselectparsertest.cpp4
-rw-r--r--document/src/vespa/document/annotation/spantree.h2
-rw-r--r--document/src/vespa/document/base/field.cpp4
-rw-r--r--document/src/vespa/document/base/field.h4
-rw-r--r--document/src/vespa/document/base/globalid.cpp2
-rw-r--r--document/src/vespa/document/base/globalid.h2
-rw-r--r--document/src/vespa/document/base/idstring.cpp42
-rw-r--r--document/src/vespa/document/base/idstring.h18
-rw-r--r--document/src/vespa/document/datatype/collectiondatatype.cpp4
-rw-r--r--document/src/vespa/document/datatype/collectiondatatype.h4
-rw-r--r--document/src/vespa/document/datatype/datatype.cpp8
-rw-r--r--document/src/vespa/document/datatype/datatype.h4
-rw-r--r--document/src/vespa/document/datatype/documenttype.cpp12
-rw-r--r--document/src/vespa/document/datatype/documenttype.h12
-rw-r--r--document/src/vespa/document/datatype/structdatatype.cpp8
-rw-r--r--document/src/vespa/document/datatype/structdatatype.h8
-rw-r--r--document/src/vespa/document/datatype/structureddatatype.cpp8
-rw-r--r--document/src/vespa/document/datatype/structureddatatype.h10
-rw-r--r--document/src/vespa/document/fieldset/fieldsetrepo.cpp2
-rw-r--r--document/src/vespa/document/fieldvalue/collectionfieldvalue.h6
-rw-r--r--document/src/vespa/document/fieldvalue/document.cpp4
-rw-r--r--document/src/vespa/document/fieldvalue/document.h4
-rw-r--r--document/src/vespa/document/fieldvalue/fieldvalue.cpp2
-rw-r--r--document/src/vespa/document/fieldvalue/fieldvalue.h2
-rw-r--r--document/src/vespa/document/fieldvalue/literalfieldvalue.cpp2
-rw-r--r--document/src/vespa/document/fieldvalue/literalfieldvalue.h8
-rw-r--r--document/src/vespa/document/fieldvalue/numericfieldvalue.h2
-rw-r--r--document/src/vespa/document/fieldvalue/numericfieldvalue.hpp2
-rw-r--r--document/src/vespa/document/fieldvalue/stringfieldvalue.cpp4
-rw-r--r--document/src/vespa/document/fieldvalue/stringfieldvalue.h4
-rw-r--r--document/src/vespa/document/fieldvalue/structfieldvalue.cpp4
-rw-r--r--document/src/vespa/document/fieldvalue/structfieldvalue.h4
-rw-r--r--document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp12
-rw-r--r--document/src/vespa/document/fieldvalue/structuredfieldvalue.h14
-rw-r--r--document/src/vespa/document/fieldvalue/structuredfieldvalue.hpp2
-rw-r--r--document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h8
-rw-r--r--document/src/vespa/document/repo/documenttyperepo.cpp8
-rw-r--r--document/src/vespa/document/repo/documenttyperepo.h4
-rw-r--r--document/src/vespa/document/select/branch.h2
-rw-r--r--document/src/vespa/document/select/doctype.cpp2
-rw-r--r--document/src/vespa/document/select/doctype.h2
-rw-r--r--document/src/vespa/document/select/invalidconstant.cpp2
-rw-r--r--document/src/vespa/document/select/invalidconstant.h2
-rw-r--r--document/src/vespa/document/select/node.h2
-rw-r--r--document/src/vespa/document/select/operator.cpp12
-rw-r--r--document/src/vespa/document/select/operator.h14
-rw-r--r--document/src/vespa/document/select/simpleparser.cpp10
-rw-r--r--document/src/vespa/document/select/simpleparser.h14
-rw-r--r--document/src/vespa/document/select/value.cpp2
-rw-r--r--document/src/vespa/document/select/value.h2
-rw-r--r--document/src/vespa/document/select/valuenodes.cpp6
-rw-r--r--document/src/vespa/document/select/valuenodes.h6
-rw-r--r--document/src/vespa/document/util/stringutil.cpp2
-rw-r--r--document/src/vespa/document/util/stringutil.h2
54 files changed, 166 insertions, 170 deletions
diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp
index 2433bfecdab..56c4e66cd1c 100644
--- a/document/src/tests/documentselectparsertest.cpp
+++ b/document/src/tests/documentselectparsertest.cpp
@@ -67,7 +67,7 @@ class DocumentSelectParserTest : public CppUnit::TestFixture {
parseFieldValue(const std::string& expression);
template <typename ContainsType>
- select::ResultList doParse(const vespalib::stringref& expr,
+ select::ResultList doParse(vespalib::stringref expr,
const ContainsType& t);
std::string parse_to_tree(const std::string& str);
@@ -526,7 +526,7 @@ void DocumentSelectParserTest::testParseBranches()
template <typename ContainsType>
select::ResultList
-DocumentSelectParserTest::doParse(const vespalib::stringref& expr,
+DocumentSelectParserTest::doParse(vespalib::stringref expr,
const ContainsType& t)
{
std::unique_ptr<select::Node> root(_parser->parse(expr));
diff --git a/document/src/vespa/document/annotation/spantree.h b/document/src/vespa/document/annotation/spantree.h
index e2839c4793b..4acd39b4793 100644
--- a/document/src/vespa/document/annotation/spantree.h
+++ b/document/src/vespa/document/annotation/spantree.h
@@ -21,7 +21,7 @@ public:
typedef AnnotationVector::const_iterator const_iterator;
template <typename T>
- SpanTree(const vespalib::stringref &name, std::unique_ptr<T> root)
+ SpanTree(vespalib::stringref name, std::unique_ptr<T> root)
: _name(name),
_root(std::move(root)) {
assert(_root.get());
diff --git a/document/src/vespa/document/base/field.cpp b/document/src/vespa/document/base/field.cpp
index 578294df7b0..c9173aa7457 100644
--- a/document/src/vespa/document/base/field.cpp
+++ b/document/src/vespa/document/base/field.cpp
@@ -11,7 +11,7 @@ namespace document {
Field::Field() : Field("", 0, *DataType::INT, false) { }
-Field::Field(const vespalib::stringref & name, int fieldId,
+Field::Field(vespalib::stringref name, int fieldId,
const DataType& dataType, bool headerField)
: FieldBase(name),
_dataType(&dataType),
@@ -19,7 +19,7 @@ Field::Field(const vespalib::stringref & name, int fieldId,
_isHeaderField(headerField)
{ }
-Field::Field(const vespalib::stringref & name,
+Field::Field(vespalib::stringref name,
const DataType& dataType, bool headerField)
: FieldBase(name),
_dataType(&dataType),
diff --git a/document/src/vespa/document/base/field.h b/document/src/vespa/document/base/field.h
index cb16538c4f1..9f4bc09015f 100644
--- a/document/src/vespa/document/base/field.h
+++ b/document/src/vespa/document/base/field.h
@@ -48,7 +48,7 @@ public:
* @param type The datatype of the field.
* @param headerField Whether or not this is a "header" field.
*/
- Field(const vespalib::stringref & name, int fieldId,
+ Field(vespalib::stringref name, int fieldId,
const DataType &type, bool headerField);
Field();
@@ -61,7 +61,7 @@ public:
* @param dataType The datatype of the field.
* @param headerField Whether or not this is a "header" field.
*/
- Field(const vespalib::stringref & name, const DataType &dataType, bool headerField);
+ Field(vespalib::stringref name, const DataType &dataType, bool headerField);
Field* clone() const override { return new Field(*this); }
std::unique_ptr<FieldValue> createValue() const;
diff --git a/document/src/vespa/document/base/globalid.cpp b/document/src/vespa/document/base/globalid.cpp
index 5211647e848..ca5235fac0b 100644
--- a/document/src/vespa/document/base/globalid.cpp
+++ b/document/src/vespa/document/base/globalid.cpp
@@ -85,7 +85,7 @@ vespalib::string GlobalId::toString() const {
}
GlobalId
-GlobalId::parse(const vespalib::stringref & source)
+GlobalId::parse(vespalib::stringref source)
{
if (source.substr(0, 6) != "gid(0x") {
throw vespalib::IllegalArgumentException(
diff --git a/document/src/vespa/document/base/globalid.h b/document/src/vespa/document/base/globalid.h
index 6c8d0123a95..dd1d061dbf7 100644
--- a/document/src/vespa/document/base/globalid.h
+++ b/document/src/vespa/document/base/globalid.h
@@ -159,7 +159,7 @@ public:
* @param str The string to parse.
* @throws vespalib::IllegalArgumentException Thrown if input is not in GID format.
*/
- static GlobalId parse(const vespalib::stringref &str);
+ static GlobalId parse(vespalib::stringref str);
/**
* Returns the most specified bucket id to which this global id belongs.
diff --git a/document/src/vespa/document/base/idstring.cpp b/document/src/vespa/document/base/idstring.cpp
index 175fb653542..eee8d3c38a2 100644
--- a/document/src/vespa/document/base/idstring.cpp
+++ b/document/src/vespa/document/base/idstring.cpp
@@ -49,8 +49,8 @@ IdString::toString() const
namespace {
void reportError(const char* part) __attribute__((noinline));
-void reportError(const stringref & s) __attribute__((noinline));
-void reportError(const stringref & s, const char* part) __attribute__((noinline));
+void reportError(stringref s) __attribute__((noinline));
+void reportError(stringref s, const char* part) __attribute__((noinline));
void reportTooShortDocId(const char * id, size_t sz) __attribute__((noinline));
void reportNoSchemeSeparator(const char * id) __attribute__((noinline));
@@ -58,13 +58,12 @@ void reportError(const char* part)
{
throw IdParseException(make_string("Unparseable id: No %s separator ':' found", part), VESPA_STRLOC);
}
-void reportError(const stringref & s, const char* part)
+void reportError(stringref s, const char* part)
{
- throw IdParseException(make_string("Unparseable %s '%s': Not an unsigned 64-bit number", part,
- string(s).c_str()), VESPA_STRLOC);
+ throw IdParseException(make_string("Unparseable %s '%s': Not an unsigned 64-bit number", part, string(s).c_str()), VESPA_STRLOC);
}
-void reportError(const stringref & s)
+void reportError(stringref s)
{
throw IdParseException(make_string("Unparseable order doc scheme '%s': Scheme must contain parameters on the form (width, division)",
string(s).c_str()), VESPA_STRLOC);
@@ -76,13 +75,10 @@ void reportNoSchemeSeparator(const char * id)
void reportTooShortDocId(const char * id, size_t sz)
{
- throw IdParseException(
- make_string(
- "Unparseable id '%s': It is too short(%li) "
- "to make any sense", id, sz), VESPA_STRLOC);
+ throw IdParseException( make_string( "Unparseable id '%s': It is too short(%li) " "to make any sense", id, sz), VESPA_STRLOC);
}
-uint64_t getAsNumber(const stringref & s, const char* part) {
+uint64_t getAsNumber(stringref s, const char* part) {
char* errPos = NULL;
uint64_t value = strtoull(s.data(), &errPos, 10);
@@ -93,7 +89,7 @@ uint64_t getAsNumber(const stringref & s, const char* part) {
}
void
-getOrderDocBits(const stringref& scheme, uint16_t & widthBits, uint16_t & divisionBits)
+getOrderDocBits(stringref scheme, uint16_t & widthBits, uint16_t & divisionBits)
{
const char* parenPos = reinterpret_cast<const char*>(
memchr(scheme.data(), '(', scheme.size()));
@@ -194,7 +190,7 @@ fmemchr(const char * s, const char * e)
} // namespace
-IdString::Offsets::Offsets(uint32_t maxComponents, uint32_t namespaceOffset, const stringref & id)
+IdString::Offsets::Offsets(uint32_t maxComponents, uint32_t namespaceOffset, stringref id)
{
_offsets[0] = namespaceOffset;
size_t index(1);
@@ -213,7 +209,7 @@ IdString::Offsets::Offsets(uint32_t maxComponents, uint32_t namespaceOffset, con
_offsets[maxComponents] = id.size() + 1; // 1 is added due to the implicitt accounting for ':'
}
-IdString::IdString(uint32_t maxComponents, uint32_t namespaceOffset, const stringref & rawId) :
+IdString::IdString(uint32_t maxComponents, uint32_t namespaceOffset, stringref rawId) :
_offsets(maxComponents, namespaceOffset, rawId),
_rawId(rawId)
{
@@ -274,13 +270,13 @@ union LocationUnion {
IdString::LocationType _location[2];
};
-IdString::LocationType makeLocation(const stringref &s) {
+IdString::LocationType makeLocation(stringref s) {
LocationUnion location;
fastc_md5sum(reinterpret_cast<const unsigned char*>(s.data()), s.size(), location._key);
return location._location[0];
}
-uint64_t parseNumber(const stringref &number) {
+uint64_t parseNumber(stringref number) {
char* errPos = NULL;
errno = 0;
uint64_t n = strtoul(number.data(), &errPos, 10);
@@ -297,7 +293,7 @@ uint64_t parseNumber(const stringref &number) {
}
void setLocation(IdString::LocationType &loc, IdString::LocationType val,
- bool &has_set_location, const stringref &key_values) {
+ bool &has_set_location, stringref key_values) {
if (has_set_location) {
throw IdParseException("Illegal key combination in "
+ key_values);
@@ -309,7 +305,7 @@ void setLocation(IdString::LocationType &loc, IdString::LocationType val,
} // namespace
-IdIdString::IdIdString(const stringref & id)
+IdIdString::IdIdString(stringref id)
: IdString(4, 3, id),
_location(0),
_groupOffset(0),
@@ -364,26 +360,26 @@ GroupDocIdString::getLocation() const
return makeLocation(getGroup());
}
-DocIdString::DocIdString(const stringref & ns, const stringref & id) :
+DocIdString::DocIdString(stringref ns, stringref id) :
IdString(2, 4, "doc:" + ns + ":" + id)
{
validate();
}
-DocIdString::DocIdString(const stringref & rawId) :
+DocIdString::DocIdString(stringref rawId) :
IdString(2, 4, rawId)
{
validate();
}
-UserDocIdString::UserDocIdString(const stringref & rawId) :
+UserDocIdString::UserDocIdString(stringref rawId) :
IdString(3, 8, rawId),
_userId(getAsNumber(rawId.substr(offset(1), offset(2) - offset(1) - 1), "userid"))
{
validate();
}
-GroupDocIdString::GroupDocIdString(const stringref & rawId) :
+GroupDocIdString::GroupDocIdString(stringref rawId) :
IdString(3, 9, rawId)
{
validate();
@@ -395,7 +391,7 @@ GroupDocIdString::locationFromGroupName(vespalib::stringref name)
return makeLocation(name);
}
-OrderDocIdString::OrderDocIdString(const stringref & rawId) :
+OrderDocIdString::OrderDocIdString(stringref rawId) :
IdString(4, static_cast<const char *>(memchr(rawId.data(), ':', rawId.size())) - rawId.data() + 1, rawId),
_widthBits(0),
_divisionBits(0),
diff --git a/document/src/vespa/document/base/idstring.h b/document/src/vespa/document/base/idstring.h
index b1a14cfec94..27e49c6f6ff 100644
--- a/document/src/vespa/document/base/idstring.h
+++ b/document/src/vespa/document/base/idstring.h
@@ -24,7 +24,7 @@ public:
static const vespalib::string & getTypeName(Type t);
/** @throws document::IdParseException If parsing of id scheme failed. */
- static IdString::UP createIdString(const vespalib::stringref & id) { return createIdString(id.data(), id.size()); }
+ static IdString::UP createIdString(vespalib::stringref id) { return createIdString(id.data(), id.size()); }
static IdString::UP createIdString(const char *id, size_t sz);
~IdString() {}
@@ -48,7 +48,7 @@ public:
const vespalib::string & toString() const;
protected:
- IdString(uint32_t maxComponents, uint32_t namespaceOffset, const vespalib::stringref & rawId);
+ IdString(uint32_t maxComponents, uint32_t namespaceOffset, vespalib::stringref rawId);
virtual vespalib::string getSchemeName() const;
size_t offset(size_t index) const { return _offsets[index]; }
size_t size(size_t index) const { return _offsets[index+1] - _offsets[index] - 1; }
@@ -60,7 +60,7 @@ protected:
private:
class Offsets {
public:
- Offsets(uint32_t maxComponents, uint32_t first, const vespalib::stringref & id);
+ Offsets(uint32_t maxComponents, uint32_t first, vespalib::stringref id);
uint16_t first() const { return _offsets[0]; }
uint16_t operator [] (size_t i) const { return _offsets[i]; }
size_t numComponents() const { return _numComponents; }
@@ -100,7 +100,7 @@ class IdIdString final : public IdString {
bool _has_number;
public:
- IdIdString(const vespalib::stringref &ns);
+ IdIdString(vespalib::stringref ns);
bool hasDocType() const override { return true; }
vespalib::stringref getDocType() const override { return getComponent(1); }
@@ -129,8 +129,8 @@ private:
*/
class DocIdString final : public IdString {
public:
- DocIdString(const vespalib::stringref & ns, const vespalib::stringref & id);
- DocIdString(const vespalib::stringref & rawId);
+ DocIdString(vespalib::stringref ns, vespalib::stringref id);
+ DocIdString(vespalib::stringref rawId);
private:
DocIdString* clone() const override { return new DocIdString(*this); }
Type getType() const override { return DOC; }
@@ -150,7 +150,7 @@ private:
*/
class UserDocIdString final : public IdString {
public:
- UserDocIdString(const vespalib::stringref & rawId);
+ UserDocIdString(vespalib::stringref rawId);
virtual int64_t getUserId() const { return _userId; }
bool hasNumber() const override { return true; }
@@ -172,7 +172,7 @@ private:
*/
class OrderDocIdString final : public IdString {
public:
- OrderDocIdString(const vespalib::stringref& rawId);
+ OrderDocIdString(vespalib::stringref rawId);
int64_t getUserId() const { return _location; }
uint16_t getWidthBits() const { return _widthBits; }
@@ -207,7 +207,7 @@ private:
*/
class GroupDocIdString : public IdString {
public:
- GroupDocIdString(const vespalib::stringref & rawId);
+ GroupDocIdString(vespalib::stringref rawId);
bool hasGroup() const override { return true; }
vespalib::stringref getGroup() const override { return getComponent(1); }
LocationType getLocation() const override;
diff --git a/document/src/vespa/document/datatype/collectiondatatype.cpp b/document/src/vespa/document/datatype/collectiondatatype.cpp
index f09aebb0be5..4642ce31b13 100644
--- a/document/src/vespa/document/datatype/collectiondatatype.cpp
+++ b/document/src/vespa/document/datatype/collectiondatatype.cpp
@@ -24,13 +24,13 @@ CollectionDataType::operator=(const CollectionDataType& other)
return *this;
}
-CollectionDataType::CollectionDataType(const vespalib::stringref& name,
+CollectionDataType::CollectionDataType(vespalib::stringref name,
const DataType& nestedType)
: DataType(name),
_nestedType(&nestedType) {
}
-CollectionDataType::CollectionDataType(const vespalib::stringref& name,
+CollectionDataType::CollectionDataType(vespalib::stringref name,
const DataType& nestedType,
int32_t id)
: DataType(name, id),
diff --git a/document/src/vespa/document/datatype/collectiondatatype.h b/document/src/vespa/document/datatype/collectiondatatype.h
index 0e258e3e0cf..3f59a09e876 100644
--- a/document/src/vespa/document/datatype/collectiondatatype.h
+++ b/document/src/vespa/document/datatype/collectiondatatype.h
@@ -20,9 +20,9 @@ protected:
CollectionDataType() : _nestedType(0) {}
CollectionDataType(const CollectionDataType&);
CollectionDataType& operator=(const CollectionDataType&);
- CollectionDataType(const vespalib::stringref & name,
+ CollectionDataType(vespalib::stringref name,
const DataType &nestedType);
- CollectionDataType(const vespalib::stringref & name,
+ CollectionDataType(vespalib::stringref name,
const DataType &nestedType, int32_t id);
public:
diff --git a/document/src/vespa/document/datatype/datatype.cpp b/document/src/vespa/document/datatype/datatype.cpp
index 3b56942b61e..18dd4b7a7a4 100644
--- a/document/src/vespa/document/datatype/datatype.cpp
+++ b/document/src/vespa/document/datatype/datatype.cpp
@@ -118,7 +118,7 @@ namespace {
// ASCII characters. Probably screwed up otherwise, but generated ids
// should only be used in testing anyways. In production this will be
// set from the document manager config.
-uint32_t crappyJavaStringHash(const vespalib::stringref & value) {
+uint32_t crappyJavaStringHash(vespalib::stringref value) {
uint32_t h = 0;
for (uint32_t i = 0; i < value.size(); ++i) {
h = 31 * h + value[i];
@@ -126,7 +126,7 @@ uint32_t crappyJavaStringHash(const vespalib::stringref & value) {
return h;
}
-int32_t createId(const vespalib::stringref & name)
+int32_t createId(vespalib::stringref name)
{
if (name == "Tag") {
return DataType::T_TAG;
@@ -142,13 +142,13 @@ DataType::DataType()
{
}
-DataType::DataType(const vespalib::stringref & name, int dataTypeId)
+DataType::DataType(vespalib::stringref name, int dataTypeId)
: _dataTypeId(dataTypeId),
_name(name)
{
}
-DataType::DataType(const vespalib::stringref & name)
+DataType::DataType(vespalib::stringref name)
: _dataTypeId(createId(name)),
_name(name)
{
diff --git a/document/src/vespa/document/datatype/datatype.h b/document/src/vespa/document/datatype/datatype.h
index 5857157c218..edb23d59e8b 100644
--- a/document/src/vespa/document/datatype/datatype.h
+++ b/document/src/vespa/document/datatype/datatype.h
@@ -38,12 +38,12 @@ protected:
* everyone to be able to use them. Only tests and the type manager reading
* config should need to create datatypes.
*/
- DataType(const vespalib::stringref& name, int dataTypeId);
+ DataType(vespalib::stringref name, int dataTypeId);
/**
* Creates a datatype using the hash of name as the id.
*/
- explicit DataType(const vespalib::stringref& name);
+ explicit DataType(vespalib::stringref name);
public:
virtual ~DataType();
diff --git a/document/src/vespa/document/datatype/documenttype.cpp b/document/src/vespa/document/datatype/documenttype.cpp
index 2be5acaf3db..8198abfc7b1 100644
--- a/document/src/vespa/document/datatype/documenttype.cpp
+++ b/document/src/vespa/document/datatype/documenttype.cpp
@@ -22,7 +22,7 @@ DocumentType::DocumentType()
{
}
-DocumentType::DocumentType(const stringref& name, int32_t id)
+DocumentType::DocumentType(stringref name, int32_t id)
: StructuredDataType(name, id),
_inheritedTypes(),
_ownedFields(new StructDataType(name + ".header")),
@@ -34,7 +34,7 @@ DocumentType::DocumentType(const stringref& name, int32_t id)
}
}
-DocumentType::DocumentType(const stringref& name, int32_t id, const StructDataType& fields)
+DocumentType::DocumentType(stringref name, int32_t id, const StructDataType& fields)
: StructuredDataType(name, id),
_inheritedTypes(),
_fields(&fields),
@@ -45,7 +45,7 @@ DocumentType::DocumentType(const stringref& name, int32_t id, const StructDataTy
}
}
-DocumentType::DocumentType(const stringref& name)
+DocumentType::DocumentType(stringref name)
: StructuredDataType(name),
_inheritedTypes(),
_ownedFields(new StructDataType(name + ".header")),
@@ -57,7 +57,7 @@ DocumentType::DocumentType(const stringref& name)
}
}
-DocumentType::DocumentType(const stringref& name, const StructDataType& fields)
+DocumentType::DocumentType(stringref name, const StructDataType& fields)
: StructuredDataType(name),
_inheritedTypes(),
_fields(&fields),
@@ -210,7 +210,7 @@ DocumentType::operator==(const DataType& other) const
}
const Field&
-DocumentType::getField(const stringref& name) const
+DocumentType::getField(stringref name) const
{
return _fields->getField(name);
}
@@ -221,7 +221,7 @@ DocumentType::getField(int fieldId) const
return _fields->getField(fieldId);
}
-bool DocumentType::hasField(const stringref &name) const {
+bool DocumentType::hasField(stringref name) const {
return _fields->hasField(name);
}
diff --git a/document/src/vespa/document/datatype/documenttype.h b/document/src/vespa/document/datatype/documenttype.h
index 89034a86810..78abd3077e6 100644
--- a/document/src/vespa/document/datatype/documenttype.h
+++ b/document/src/vespa/document/datatype/documenttype.h
@@ -50,12 +50,12 @@ public:
typedef std::shared_ptr<DocumentType> SP;
DocumentType();
- DocumentType(const vespalib::stringref &name, int32_t id);
- DocumentType(const vespalib::stringref &name, int32_t id,
+ DocumentType(vespalib::stringref name, int32_t id);
+ DocumentType(vespalib::stringref name, int32_t id,
const StructDataType& fields);
- DocumentType(const vespalib::stringref &name);
- DocumentType(const vespalib::stringref &name,
+ DocumentType(vespalib::stringref name);
+ DocumentType(vespalib::stringref name,
const StructDataType& fields);
~DocumentType();
@@ -82,9 +82,9 @@ public:
uint32_t getFieldCount() const override {
return _fields->getFieldCount();
}
- const Field & getField(const vespalib::stringref & name) const override;
+ const Field & getField(vespalib::stringref name) const override;
const Field & getField(int fieldId) const override;
- bool hasField(const vespalib::stringref &name) const override;
+ bool hasField(vespalib::stringref name) const override;
bool hasField(int fieldId) const override;
Field::Set getFieldSet() const override;
DocumentType* clone() const override;
diff --git a/document/src/vespa/document/datatype/structdatatype.cpp b/document/src/vespa/document/datatype/structdatatype.cpp
index 9ff0b7e0b0a..35cd02dab88 100644
--- a/document/src/vespa/document/datatype/structdatatype.cpp
+++ b/document/src/vespa/document/datatype/structdatatype.cpp
@@ -26,14 +26,14 @@ StructDataType::StructDataType() :
_compressionConfig()
{ }
-StructDataType::StructDataType(const vespalib::stringref &name)
+StructDataType::StructDataType(vespalib::stringref name)
: StructuredDataType(name),
_nameFieldMap(),
_idFieldMap(),
_compressionConfig()
{ }
-StructDataType::StructDataType(const vespalib::stringref & name, int32_t dataTypeId)
+StructDataType::StructDataType(vespalib::stringref name, int32_t dataTypeId)
: StructuredDataType(name, dataTypeId),
_nameFieldMap(),
_idFieldMap(),
@@ -122,7 +122,7 @@ StructDataType::createFieldValue() const
}
const Field&
-StructDataType::getField(const vespalib::stringref & name) const
+StructDataType::getField(vespalib::stringref name) const
{
StringFieldMap::const_iterator it(_nameFieldMap.find(name));
if (it == _nameFieldMap.end()) {
@@ -153,7 +153,7 @@ StructDataType::getField(int32_t fieldId) const
return *it->second;
}
-bool StructDataType::hasField(const vespalib::stringref &name) const {
+bool StructDataType::hasField(vespalib::stringref name) const {
return _nameFieldMap.find(name) != _nameFieldMap.end();
}
diff --git a/document/src/vespa/document/datatype/structdatatype.h b/document/src/vespa/document/datatype/structdatatype.h
index 0f1c58316c9..5dc39639831 100644
--- a/document/src/vespa/document/datatype/structdatatype.h
+++ b/document/src/vespa/document/datatype/structdatatype.h
@@ -23,8 +23,8 @@ public:
using CompressionConfig = vespalib::compression::CompressionConfig;
StructDataType();
- StructDataType(const vespalib::stringref &name);
- StructDataType(const vespalib::stringref &name, int32_t id);
+ StructDataType(vespalib::stringref name);
+ StructDataType(vespalib::stringref name, int32_t id);
~StructDataType();
/**
@@ -48,7 +48,7 @@ public:
void print(std::ostream&, bool verbose, const std::string& indent) const override;
uint32_t getFieldCount() const override { return _idFieldMap.size(); }
- const Field& getField(const vespalib::stringref & name) const override;
+ const Field& getField(vespalib::stringref name) const override;
/**
* Retrieves a field based on its ID. To determine which ID to use, we also
@@ -56,7 +56,7 @@ public:
*/
const Field& getField(int32_t fieldId) const override;
- bool hasField(const vespalib::stringref &name) const override;
+ bool hasField(vespalib::stringref name) const override;
bool hasField(int32_t fieldId) const override;
bool hasField(const Field& f) const {
return hasField(f.getId());
diff --git a/document/src/vespa/document/datatype/structureddatatype.cpp b/document/src/vespa/document/datatype/structureddatatype.cpp
index 604b4cad045..bdd56b94d51 100644
--- a/document/src/vespa/document/datatype/structureddatatype.cpp
+++ b/document/src/vespa/document/datatype/structureddatatype.cpp
@@ -13,12 +13,12 @@ IMPLEMENT_IDENTIFIABLE_ABSTRACT(StructuredDataType, DataType);
StructuredDataType::StructuredDataType() = default;
-StructuredDataType::StructuredDataType(const vespalib::stringref &name)
+StructuredDataType::StructuredDataType(vespalib::stringref name)
: DataType(name, createId(name))
{
}
-StructuredDataType::StructuredDataType(const vespalib::stringref &name, int dataTypeId)
+StructuredDataType::StructuredDataType(vespalib::stringref name, int dataTypeId)
: DataType(name, dataTypeId)
{
}
@@ -30,7 +30,7 @@ bool StructuredDataType::operator==(const DataType& type) const
}
namespace {
-uint32_t crappyJavaStringHash(const vespalib::stringref &value) {
+uint32_t crappyJavaStringHash(vespalib::stringref value) {
uint32_t h = 0;
for (uint32_t i = 0; i < value.size(); ++i) {
h = 31 * h + value[i];
@@ -39,7 +39,7 @@ uint32_t crappyJavaStringHash(const vespalib::stringref &value) {
}
} // namespace
-int32_t StructuredDataType::createId(const vespalib::stringref &name)
+int32_t StructuredDataType::createId(vespalib::stringref name)
{
if (name == "document") {
return 8;
diff --git a/document/src/vespa/document/datatype/structureddatatype.h b/document/src/vespa/document/datatype/structureddatatype.h
index 31de0d93680..c3c49765235 100644
--- a/document/src/vespa/document/datatype/structureddatatype.h
+++ b/document/src/vespa/document/datatype/structureddatatype.h
@@ -20,17 +20,17 @@ class StructuredDataType : public DataType {
protected:
StructuredDataType();
- StructuredDataType(const vespalib::stringref & name);
- StructuredDataType(const vespalib::stringref & name, int32_t dataTypeId);
+ StructuredDataType(vespalib::stringref name);
+ StructuredDataType(vespalib::stringref name, int32_t dataTypeId);
public:
virtual uint32_t getFieldCount() const = 0;
/** @throws FieldNotFoundException if field does not exist. */
- virtual const Field& getField(const vespalib::stringref & name) const = 0;
+ virtual const Field& getField(vespalib::stringref name) const = 0;
- virtual bool hasField(const vespalib::stringref & name) const = 0;
+ virtual bool hasField(vespalib::stringref name) const = 0;
virtual bool hasField(int32_t fieldId) const = 0;
virtual Field::Set getFieldSet() const = 0;
@@ -38,7 +38,7 @@ public:
virtual StructuredDataType* clone() const override = 0;
bool operator==(const DataType& type) const override;
- static int32_t createId(const vespalib::stringref &name);
+ static int32_t createId(vespalib::stringref name);
DECLARE_IDENTIFIABLE_ABSTRACT(StructuredDataType);
diff --git a/document/src/vespa/document/fieldset/fieldsetrepo.cpp b/document/src/vespa/document/fieldset/fieldsetrepo.cpp
index e1e2ed35ca6..93cb20445c6 100644
--- a/document/src/vespa/document/fieldset/fieldsetrepo.cpp
+++ b/document/src/vespa/document/fieldset/fieldsetrepo.cpp
@@ -13,7 +13,7 @@ namespace document {
namespace {
FieldSet::UP
-parseSpecialValues(const vespalib::stringref & name)
+parseSpecialValues(vespalib::stringref name)
{
FieldSet::UP fs;
if ((name.size() == 4) && (name[1] == 'i') && (name[2] == 'd') && (name[3] == ']')) {
diff --git a/document/src/vespa/document/fieldvalue/collectionfieldvalue.h b/document/src/vespa/document/fieldvalue/collectionfieldvalue.h
index a94fe89e549..bc4950793a4 100644
--- a/document/src/vespa/document/fieldvalue/collectionfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/collectionfieldvalue.h
@@ -64,7 +64,7 @@ public:
// Convenience functions for using primitives directly
- bool add(const vespalib::stringref & val)
+ bool add(vespalib::stringref val)
{ return addValue(*createNested() = val); }
bool add(int32_t val)
{ return addValue(*createNested() = val); }
@@ -75,7 +75,7 @@ public:
bool add(double val)
{ return addValue(*createNested() = val); }
- bool contains(const vespalib::stringref & val)
+ bool contains(vespalib::stringref val)
{ return containsValue(*createNested() = val); }
bool contains(int32_t val)
{ return containsValue(*createNested() = val); }
@@ -86,7 +86,7 @@ public:
bool contains(double val)
{ return containsValue(*createNested() = val); }
- bool remove(const vespalib::stringref & val)
+ bool remove(vespalib::stringref val)
{ return removeValue(*createNested() = val); }
bool remove(int32_t val)
{ return removeValue(*createNested() = val); }
diff --git a/document/src/vespa/document/fieldvalue/document.cpp b/document/src/vespa/document/fieldvalue/document.cpp
index 51ba135b826..b2cae1613de 100644
--- a/document/src/vespa/document/fieldvalue/document.cpp
+++ b/document/src/vespa/document/fieldvalue/document.cpp
@@ -28,10 +28,10 @@ bool isLegalVersion(uint16_t version) {
return (6 <= version) && (version <= 8);
}
-void documentTypeError(const vespalib::stringref & name) __attribute__((noinline));
+void documentTypeError(vespalib::stringref name) __attribute__((noinline));
void throwTypeMismatch(vespalib::stringref type, vespalib::stringref docidType) __attribute__((noinline));
-void documentTypeError(const vespalib::stringref & name) {
+void documentTypeError(vespalib::stringref name) {
throw IllegalArgumentException(make_string("Cannot generate a document with non-document type %s.",
vespalib::string(name).c_str()), VESPA_STRLOC);
}
diff --git a/document/src/vespa/document/fieldvalue/document.h b/document/src/vespa/document/fieldvalue/document.h
index e0a35411f9b..b5e2643ce80 100644
--- a/document/src/vespa/document/fieldvalue/document.h
+++ b/document/src/vespa/document/fieldvalue/document.h
@@ -79,8 +79,8 @@ public:
const StructFieldValue& getFields() const { return _fields; }
StructFieldValue& getFields() { return _fields; }
- const Field& getField(const vespalib::stringref & name) const override { return _fields.getField(name); }
- bool hasField(const vespalib::stringref & name) const override { return _fields.hasField(name); }
+ const Field& getField(vespalib::stringref name) const override { return _fields.getField(name); }
+ bool hasField(vespalib::stringref name) const override { return _fields.hasField(name); }
void clear() override;
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
index 44de51e7fe1..f5cd92ddc06 100644
--- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
@@ -106,7 +106,7 @@ FieldValue::toXml(const std::string& indent) const
// Subtypes should implement the conversion functions that make sense
-FieldValue& FieldValue::operator=(const vespalib::stringref &)
+FieldValue& FieldValue::operator=(vespalib::stringref )
{
throw vespalib::IllegalArgumentException(
"Cannot assign string to datatype " + getDataType()->toString(),
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.h b/document/src/vespa/document/fieldvalue/fieldvalue.h
index 0f7e1fb432c..8fe47d64981 100644
--- a/document/src/vespa/document/fieldvalue/fieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/fieldvalue.h
@@ -113,7 +113,7 @@ public:
virtual std::string toXml(const std::string& indent = "") const;
// Utility functions to set commonly used value types.
- virtual FieldValue& operator=(const vespalib::stringref &);
+ virtual FieldValue& operator=(vespalib::stringref );
virtual FieldValue& operator=(int32_t);
virtual FieldValue& operator=(int64_t);
virtual FieldValue& operator=(float);
diff --git a/document/src/vespa/document/fieldvalue/literalfieldvalue.cpp b/document/src/vespa/document/fieldvalue/literalfieldvalue.cpp
index 5614330a495..0ae1e5fa0dd 100644
--- a/document/src/vespa/document/fieldvalue/literalfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/literalfieldvalue.cpp
@@ -91,7 +91,7 @@ print(std::ostream& out, bool, const std::string&) const
}
FieldValue&
-LiteralFieldValueB::operator=(const vespalib::stringref & value)
+LiteralFieldValueB::operator=(vespalib::stringref value)
{
setValue(value);
return *this;
diff --git a/document/src/vespa/document/fieldvalue/literalfieldvalue.h b/document/src/vespa/document/fieldvalue/literalfieldvalue.h
index 2f9050eb13c..a37b612acbb 100644
--- a/document/src/vespa/document/fieldvalue/literalfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/literalfieldvalue.h
@@ -14,8 +14,8 @@
*/
#pragma once
+#include "fieldvalue.h"
#include <vespa/document/datatype/primitivedatatype.h>
-#include <vespa/document/fieldvalue/fieldvalue.h>
#include <vespa/vespalib/stllike/hash_fun.h>
namespace document {
@@ -44,12 +44,12 @@ public:
LiteralFieldValueB & operator=(const LiteralFieldValueB &);
- void setValueRef(const stringref & value) {
+ void setValueRef(stringref value) {
_value = value;
_altered = true;
}
- void setValue(const stringref & value) {
+ void setValue(stringref value) {
_backing = value;
_value = _backing;
_altered = true;
@@ -68,7 +68,7 @@ public:
FieldValue& assign(const FieldValue&) override;
bool hasChanged() const override{ return _altered; }
- FieldValue& operator=(const vespalib::stringref &) override;
+ FieldValue& operator=(vespalib::stringref ) override;
FieldValue& operator=(int32_t) override;
FieldValue& operator=(int64_t) override;
FieldValue& operator=(float) override;
diff --git a/document/src/vespa/document/fieldvalue/numericfieldvalue.h b/document/src/vespa/document/fieldvalue/numericfieldvalue.h
index 2f44153c09c..5e6689e35cd 100644
--- a/document/src/vespa/document/fieldvalue/numericfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/numericfieldvalue.h
@@ -40,7 +40,7 @@ public:
int compare(const FieldValue& other) const override;
int fastCompare(const FieldValue& other) const override final;
- FieldValue& operator=(const vespalib::stringref &) override;
+ FieldValue& operator=(vespalib::stringref ) override;
FieldValue& operator=(int32_t) override;
FieldValue& operator=(int64_t) override;
FieldValue& operator=(float) override;
diff --git a/document/src/vespa/document/fieldvalue/numericfieldvalue.hpp b/document/src/vespa/document/fieldvalue/numericfieldvalue.hpp
index c3ef6781706..cba0e587a94 100644
--- a/document/src/vespa/document/fieldvalue/numericfieldvalue.hpp
+++ b/document/src/vespa/document/fieldvalue/numericfieldvalue.hpp
@@ -78,7 +78,7 @@ NumericFieldValue<Number>::print(std::ostream& out, bool, const std::string&) co
template<typename Number>
FieldValue&
-NumericFieldValue<Number>::operator=(const vespalib::stringref & value)
+NumericFieldValue<Number>::operator=(vespalib::stringref value)
{
// Lexical cast doesn't allow hex syntax we use in XML,
// so detect these in front.
diff --git a/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp b/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp
index 5ee0acfb6f9..13db6ecbf46 100644
--- a/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp
@@ -87,7 +87,7 @@ StringFieldValue::doClearSpanTrees() {
_annotationData.reset();
}
-const SpanTree * StringFieldValue::findTree(const SpanTrees & trees, const stringref & name)
+const SpanTree * StringFieldValue::findTree(const SpanTrees & trees, stringref name)
{
for(const auto & tree : trees) {
if (tree->getName() == name) {
@@ -97,7 +97,7 @@ const SpanTree * StringFieldValue::findTree(const SpanTrees & trees, const strin
return nullptr;
}
-StringFieldValue &StringFieldValue::operator=(const stringref& value)
+StringFieldValue &StringFieldValue::operator=(stringref value)
{
setValue(value);
_annotationData.reset();
diff --git a/document/src/vespa/document/fieldvalue/stringfieldvalue.h b/document/src/vespa/document/fieldvalue/stringfieldvalue.h
index 14b67838787..015fcd5ba22 100644
--- a/document/src/vespa/document/fieldvalue/stringfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/stringfieldvalue.h
@@ -30,7 +30,7 @@ public:
StringFieldValue(const StringFieldValue &rhs);
StringFieldValue &operator=(const StringFieldValue &rhs);
- StringFieldValue &operator=(const vespalib::stringref &value) override;
+ StringFieldValue &operator=(vespalib::stringref value) override;
~StringFieldValue();
FieldValue &assign(const FieldValue &) override;
@@ -48,7 +48,7 @@ public:
return _annotationData ? _annotationData->getSerializedAnnotations() : vespalib::ConstBufferRef();
}
bool hasSpanTrees() const { return _annotationData ? _annotationData->hasSpanTrees() : false; }
- static const SpanTree *findTree(const SpanTrees &trees, const vespalib::stringref &name);
+ static const SpanTree *findTree(const SpanTrees &trees, vespalib::stringref name);
void clearSpanTrees() {
if (_annotationData) {
doClearSpanTrees();
diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
index 7f88229e1ba..febd0dc355c 100644
--- a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
@@ -159,13 +159,13 @@ StructFieldValue::getRawFieldIds(vector<int> &raw_ids,
}
bool
-StructFieldValue::hasField(const vespalib::stringref & name) const
+StructFieldValue::hasField(vespalib::stringref name) const
{
return getStructType().hasField(name);
}
const Field&
-StructFieldValue::getField(const vespalib::stringref & name) const
+StructFieldValue::getField(vespalib::stringref name) const
{
return getStructType().getField(name);
}
diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.h b/document/src/vespa/document/fieldvalue/structfieldvalue.h
index bb6956cf012..3f21feafcbb 100644
--- a/document/src/vespa/document/fieldvalue/structfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/structfieldvalue.h
@@ -83,8 +83,8 @@ public:
void accept(FieldValueVisitor &visitor) override { visitor.visit(*this); }
void accept(ConstFieldValueVisitor &visitor) const override { visitor.visit(*this); }
- bool hasField(const vespalib::stringref & name) const override;
- const Field& getField(const vespalib::stringref & name) const override;
+ bool hasField(vespalib::stringref name) const override;
+ const Field& getField(vespalib::stringref name) const override;
void clear() override;
const CompressionConfig &getCompressionConfig() const;
diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp
index c193b0919ea..8ed13104dd6 100644
--- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp
@@ -244,12 +244,12 @@ StructuredFieldValue::commitTransaction() {
}
using ConstCharP = const char *;
-template void StructuredFieldValue::set(const vespalib::stringref & field, int32_t value);
-template void StructuredFieldValue::set(const vespalib::stringref & field, int64_t value);
-template void StructuredFieldValue::set(const vespalib::stringref & field, double value);
-template void StructuredFieldValue::set(const vespalib::stringref & field, ConstCharP value);
-template void StructuredFieldValue::set(const vespalib::stringref & field, vespalib::stringref value);
-template void StructuredFieldValue::set(const vespalib::stringref & field, vespalib::string value);
+template void StructuredFieldValue::set(vespalib::stringref field, int32_t value);
+template void StructuredFieldValue::set(vespalib::stringref field, int64_t value);
+template void StructuredFieldValue::set(vespalib::stringref field, double value);
+template void StructuredFieldValue::set(vespalib::stringref field, ConstCharP value);
+template void StructuredFieldValue::set(vespalib::stringref field, vespalib::stringref value);
+template void StructuredFieldValue::set(vespalib::stringref field, vespalib::string value);
template std::unique_ptr<MapFieldValue> StructuredFieldValue::getAs<MapFieldValue>(const Field &field) const;
template std::unique_ptr<ArrayFieldValue> StructuredFieldValue::getAs<ArrayFieldValue>(const Field &field) const;
diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h
index d93bee9b093..b415596b292 100644
--- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h
@@ -112,12 +112,12 @@ public:
const DataType *getDataType() const override { return _type; }
/** Wrapper for DataType's hasField() function. */
- virtual bool hasField(const vespalib::stringref & name) const = 0;
+ virtual bool hasField(vespalib::stringref name) const = 0;
/**
* Wrapper for DataType's getField() function.
* @throws FieldNotFoundException If no field with given name exist.
*/
- virtual const Field& getField(const vespalib::stringref & name) const = 0;
+ virtual const Field& getField(vespalib::stringref name) const = 0;
void beginTransaction();
void commitTransaction();
@@ -136,7 +136,7 @@ public:
return getFieldValue(field);
}
/** @return Retrieve value of given field. Null pointer if not set. */
- FieldValue::UP getValue(const vespalib::stringref & name) const {
+ FieldValue::UP getValue(vespalib::stringref name) const {
return getFieldValue(getField(name));
}
/** @return True if value is set. */
@@ -159,16 +159,16 @@ public:
virtual void clear() = 0;
// Utility functions for easy but less efficient access
- bool hasValue(const vespalib::stringref & fieldName) const
+ bool hasValue(vespalib::stringref fieldName) const
{ return hasFieldValue(getField(fieldName)); }
- void remove(const vespalib::stringref & fieldName)
+ void remove(vespalib::stringref fieldName)
{ removeFieldValue(getField(fieldName)); }
- void setValue(const vespalib::stringref & fieldName, const FieldValue& value)
+ void setValue(vespalib::stringref fieldName, const FieldValue& value)
{ setFieldValue(getField(fieldName), value); }
template<typename PrimitiveType>
void set(const Field& field, PrimitiveType value);
template<typename PrimitiveType>
- void set(const vespalib::stringref & fieldName, PrimitiveType value);
+ void set(vespalib::stringref fieldName, PrimitiveType value);
size_t getSetFieldCount() const {
size_t count = 0;
diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.hpp b/document/src/vespa/document/fieldvalue/structuredfieldvalue.hpp
index 3e23619be60..8d20cce9e66 100644
--- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.hpp
+++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.hpp
@@ -31,7 +31,7 @@ StructuredFieldValue::set(const Field& field, PrimitiveType value)
template<typename PrimitiveType>
void
-StructuredFieldValue::set(const vespalib::stringref & fieldName, PrimitiveType value)
+StructuredFieldValue::set(vespalib::stringref fieldName, PrimitiveType value)
{
set(getField(fieldName), value);
}
diff --git a/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h b/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h
index 0f73e2602d3..fafe8f15e0e 100644
--- a/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h
@@ -97,7 +97,7 @@ public:
// Utility functions for easy use of weighted sets of primitives
- bool add(const vespalib::stringref & val, int32_t weight = 1)
+ bool add(vespalib::stringref val, int32_t weight = 1)
{ return add(*createNested() = val, weight); }
bool add(int32_t val, int32_t weight = 1)
{ return add(*createNested() = val, weight); }
@@ -108,7 +108,7 @@ public:
bool add(double val, int32_t weight = 1)
{ return add(*createNested() = val, weight); }
- int32_t get(const vespalib::stringref & val) const
+ int32_t get(vespalib::stringref val) const
{ return get(*createNested() = val); }
int32_t get(int32_t val) const
{ return get(*createNested() = val); }
@@ -119,7 +119,7 @@ public:
int32_t get(double val) const
{ return get(*createNested() = val); }
- void increment(const vespalib::stringref & val, int32_t weight = 1)
+ void increment(vespalib::stringref val, int32_t weight = 1)
{ increment(*createNested() = val, weight); }
void increment(int32_t val, int32_t weight = 1)
{ increment(*createNested() = val, weight); }
@@ -130,7 +130,7 @@ public:
void increment(double val, int32_t weight = 1)
{ increment(*createNested() = val, weight); }
- void decrement(const vespalib::stringref & val, int32_t weight = 1)
+ void decrement(vespalib::stringref val, int32_t weight = 1)
{ decrement(*createNested() = val, weight); }
void decrement(int32_t val, int32_t weight = 1)
{ decrement(*createNested() = val, weight); }
diff --git a/document/src/vespa/document/repo/documenttyperepo.cpp b/document/src/vespa/document/repo/documenttyperepo.cpp
index a2f5aeb8f0b..03b7660efbe 100644
--- a/document/src/vespa/document/repo/documenttyperepo.cpp
+++ b/document/src/vespa/document/repo/documenttyperepo.cpp
@@ -76,7 +76,7 @@ public:
template <typename T> void addDataType(unique_ptr<T> type);
const DataType *lookup(int32_t id) const;
- const DataType *lookup(const stringref &name) const;
+ const DataType *lookup(stringref name) const;
const DataType &findOrThrow(int32_t id) const;
};
@@ -127,7 +127,7 @@ const DataType *Repo::lookup(int32_t id) const {
return FindPtr(_types, id);
}
-const DataType *Repo::lookup(const stringref &n) const {
+const DataType *Repo::lookup(stringref n) const {
return FindPtr(_name_map, n);
}
@@ -523,7 +523,7 @@ DocumentTypeRepo::getDocumentType(int32_t type_id) const {
}
const DocumentType *
-DocumentTypeRepo::getDocumentType(const stringref &name) const {
+DocumentTypeRepo::getDocumentType(stringref name) const {
DocumentTypeMap::const_iterator it = _doc_types->find(DocumentType::createId(name));
if (it != _doc_types->end() && it->second->doc_type->getName() == name) {
@@ -544,7 +544,7 @@ DocumentTypeRepo::getDataType(const DocumentType &doc_type, int32_t id) const {
}
const DataType *
-DocumentTypeRepo::getDataType(const DocumentType &doc_type, const stringref &name) const {
+DocumentTypeRepo::getDataType(const DocumentType &doc_type, stringref name) const {
const DataTypeRepo *dt_repo = FindPtr(*_doc_types, doc_type.getId());
return dt_repo ? dt_repo->repo.lookup(name) : nullptr;
}
diff --git a/document/src/vespa/document/repo/documenttyperepo.h b/document/src/vespa/document/repo/documenttyperepo.h
index c1c25204b3f..68e4087ca49 100644
--- a/document/src/vespa/document/repo/documenttyperepo.h
+++ b/document/src/vespa/document/repo/documenttyperepo.h
@@ -35,9 +35,9 @@ public:
~DocumentTypeRepo();
const DocumentType *getDocumentType(int32_t doc_type_id) const;
- const DocumentType *getDocumentType(const vespalib::stringref &name) const;
+ const DocumentType *getDocumentType(vespalib::stringref name) const;
const DataType *getDataType(const DocumentType &doc_type, int32_t id) const;
- const DataType *getDataType(const DocumentType &doc_type, const vespalib::stringref &name) const;
+ const DataType *getDataType(const DocumentType &doc_type, vespalib::stringref name) const;
const AnnotationType *getAnnotationType(const DocumentType &doc_type, int32_t id) const;
void forEachDocumentType(vespalib::Closure1<const DocumentType &> &c) const;
const DocumentType *getDefaultDocType() const { return _default; }
diff --git a/document/src/vespa/document/select/branch.h b/document/src/vespa/document/select/branch.h
index 5c010dfde8c..63c4cbe24d8 100644
--- a/document/src/vespa/document/select/branch.h
+++ b/document/src/vespa/document/select/branch.h
@@ -22,7 +22,7 @@ namespace select {
class Branch : public Node
{
public:
- Branch(const vespalib::stringref & name) : Node(name) {}
+ Branch(vespalib::stringref name) : Node(name) {}
bool isLeafNode() const override { return false; }
};
diff --git a/document/src/vespa/document/select/doctype.cpp b/document/src/vespa/document/select/doctype.cpp
index 4ecb388f60d..4b42d451f70 100644
--- a/document/src/vespa/document/select/doctype.cpp
+++ b/document/src/vespa/document/select/doctype.cpp
@@ -24,7 +24,7 @@ namespace {
}
}
-DocType::DocType(const vespalib::stringref& doctype)
+DocType::DocType(vespalib::stringref doctype)
: Node("DocType"),
_doctype(doctype)
{
diff --git a/document/src/vespa/document/select/doctype.h b/document/src/vespa/document/select/doctype.h
index c53794aba15..160a3461746 100644
--- a/document/src/vespa/document/select/doctype.h
+++ b/document/src/vespa/document/select/doctype.h
@@ -23,7 +23,7 @@ private:
vespalib::string _doctype;
public:
- DocType(const vespalib::stringref& doctype);
+ DocType(vespalib::stringref doctype);
ResultList contains(const Context&) const override;
ResultList trace(const Context&, std::ostream& trace) const override;
diff --git a/document/src/vespa/document/select/invalidconstant.cpp b/document/src/vespa/document/select/invalidconstant.cpp
index 06271efe8bf..e0b5e61e1ba 100644
--- a/document/src/vespa/document/select/invalidconstant.cpp
+++ b/document/src/vespa/document/select/invalidconstant.cpp
@@ -6,7 +6,7 @@
namespace document::select {
-InvalidConstant::InvalidConstant(const vespalib::stringref & value)
+InvalidConstant::InvalidConstant(vespalib::stringref value)
: Node(value)
{ }
diff --git a/document/src/vespa/document/select/invalidconstant.h b/document/src/vespa/document/select/invalidconstant.h
index 75a0ca7235b..b99d0f5a066 100644
--- a/document/src/vespa/document/select/invalidconstant.h
+++ b/document/src/vespa/document/select/invalidconstant.h
@@ -20,7 +20,7 @@ namespace select {
class InvalidConstant : public Node
{
public:
- explicit InvalidConstant(const vespalib::stringref &value);
+ explicit InvalidConstant(vespalib::stringref value);
ResultList contains(const Context&) const override { return ResultList(Result::Invalid); }
ResultList trace(const Context&, std::ostream& trace) const override;
diff --git a/document/src/vespa/document/select/node.h b/document/src/vespa/document/select/node.h
index 83e2ea3542d..24c0897ba95 100644
--- a/document/src/vespa/document/select/node.h
+++ b/document/src/vespa/document/select/node.h
@@ -30,7 +30,7 @@ public:
typedef std::unique_ptr<Node> UP;
typedef std::shared_ptr<Node> SP;
- Node(const vespalib::stringref & name) : _name(name), _parentheses(false) {}
+ Node(vespalib::stringref name) : _name(name), _parentheses(false) {}
~Node() override {}
void setParentheses() { _parentheses = true; }
diff --git a/document/src/vespa/document/select/operator.cpp b/document/src/vespa/document/select/operator.cpp
index b2e7ddd82b8..8deb19452f0 100644
--- a/document/src/vespa/document/select/operator.cpp
+++ b/document/src/vespa/document/select/operator.cpp
@@ -13,7 +13,7 @@ namespace document::select {
Operator::OperatorMap Operator::_operators;
-Operator::Operator(const vespalib::stringref & name)
+Operator::Operator(vespalib::stringref name)
: _name(name)
{
OperatorMap::iterator it = _operators.find(name);
@@ -24,7 +24,7 @@ Operator::Operator(const vespalib::stringref & name)
}
const Operator&
-Operator::get(const vespalib::stringref & name)
+Operator::get(vespalib::stringref name)
{
OperatorMap::iterator it = _operators.find(name);
if (it == _operators.end()) {
@@ -75,7 +75,7 @@ FunctionOperator::LT("<", &Value::operator<);
const FunctionOperator
FunctionOperator::NE("!=", &Value::operator!=);
-RegexOperator::RegexOperator(const vespalib::stringref & name)
+RegexOperator::RegexOperator(vespalib::stringref name)
: Operator(name)
{
}
@@ -133,7 +133,7 @@ RegexOperator::match(const vespalib::string& val, const vespalib::stringref & ex
const RegexOperator RegexOperator::REGEX("=~");
-GlobOperator::GlobOperator(const vespalib::stringref & name)
+GlobOperator::GlobOperator(vespalib::stringref name)
: RegexOperator(name)
{
}
@@ -187,7 +187,7 @@ GlobOperator::traceImpl(const Value& a, const Value& b, std::ostream& ost) const
}
vespalib::string
-GlobOperator::convertToRegex(const vespalib::stringref & globpattern) const
+GlobOperator::convertToRegex(vespalib::stringref globpattern) const
{
vespalib::asciistream ost;
ost << '^';
@@ -219,7 +219,7 @@ GlobOperator::convertToRegex(const vespalib::stringref & globpattern) const
}
bool
-GlobOperator::containsVariables(const vespalib::stringref & expression)
+GlobOperator::containsVariables(vespalib::stringref expression)
{
for (size_t i=0, n=expression.size(); i<n; ++i) {
if (expression[i] == '*' || expression[i] == '?') {
diff --git a/document/src/vespa/document/select/operator.h b/document/src/vespa/document/select/operator.h
index e4a696c523c..a841f91802a 100644
--- a/document/src/vespa/document/select/operator.h
+++ b/document/src/vespa/document/select/operator.h
@@ -25,7 +25,7 @@ private:
vespalib::string _name;
public:
- Operator(const vespalib::stringref & name);
+ Operator(vespalib::stringref name);
virtual ~Operator() {}
virtual ResultList compare(const Value&, const Value&) const = 0;
@@ -33,7 +33,7 @@ public:
std::ostream& trace) const = 0;
const vespalib::string& getName() const { return _name; }
- static const Operator& get(const vespalib::stringref & name);
+ static const Operator& get(vespalib::stringref name);
bool operator==(const Operator& op) const
{ return (_name == op._name); }
@@ -48,7 +48,7 @@ private:
ResultList (Value::*_comparator)(const Value&) const;
public:
- FunctionOperator(const vespalib::stringref & name,
+ FunctionOperator(vespalib::stringref name,
ResultList (Value::*comparator)(const Value&) const)
: Operator(name), _comparator(comparator) {}
@@ -65,7 +65,7 @@ public:
class RegexOperator : public Operator {
public:
- RegexOperator(const vespalib::stringref & name);
+ RegexOperator(vespalib::stringref name);
// Delegates to Value::regexCompare
ResultList compare(const Value& a, const Value& b) const override;
@@ -84,13 +84,13 @@ private:
class GlobOperator : public RegexOperator {
public:
- GlobOperator(const vespalib::stringref & name);
+ GlobOperator(vespalib::stringref name);
// Delegates to Value::globCompare
ResultList compare(const Value& a, const Value& b) const override;
ResultList trace(const Value&, const Value&, std::ostream& trace) const override;
- vespalib::string convertToRegex(const vespalib::stringref & globpattern) const;
- static bool containsVariables(const vespalib::stringref & expression);
+ vespalib::string convertToRegex(vespalib::stringref globpattern) const;
+ static bool containsVariables(vespalib::stringref expression);
static const GlobOperator GLOB;
private:
diff --git a/document/src/vespa/document/select/simpleparser.cpp b/document/src/vespa/document/select/simpleparser.cpp
index 349c1c17362..3c8821271fb 100644
--- a/document/src/vespa/document/select/simpleparser.cpp
+++ b/document/src/vespa/document/select/simpleparser.cpp
@@ -21,7 +21,7 @@ bool icmp(char c, char l)
return tolower(c) == l;
}
-bool IdSpecParser::parse(const vespalib::stringref & s)
+bool IdSpecParser::parse(vespalib::stringref s)
{
bool retval(false);
size_t pos(eatWhite(s.data(), s.size()));
@@ -74,7 +74,7 @@ bool IdSpecParser::parse(const vespalib::stringref & s)
return retval;
}
-bool OperatorParser::parse(const vespalib::stringref & s)
+bool OperatorParser::parse(vespalib::stringref s)
{
bool retval(false);
size_t pos(eatWhite(s.data(), s.size()));
@@ -118,7 +118,7 @@ bool OperatorParser::parse(const vespalib::stringref & s)
return retval;
}
-bool StringParser::parse(const vespalib::stringref & s)
+bool StringParser::parse(vespalib::stringref s)
{
bool retval(false);
setRemaining(s);
@@ -143,7 +143,7 @@ bool StringParser::parse(const vespalib::stringref & s)
return retval;
}
-bool IntegerParser::parse(const vespalib::stringref & s)
+bool IntegerParser::parse(vespalib::stringref s)
{
bool retval(false);
size_t pos(eatWhite(s.data(), s.size()));
@@ -165,7 +165,7 @@ bool IntegerParser::parse(const vespalib::stringref & s)
return retval;
}
-bool SelectionParser::parse(const vespalib::stringref & s)
+bool SelectionParser::parse(vespalib::stringref s)
{
bool retval(false);
IdSpecParser id(_bucketIdFactory);
diff --git a/document/src/vespa/document/select/simpleparser.h b/document/src/vespa/document/select/simpleparser.h
index 28406f0a6ab..a87c1938db9 100644
--- a/document/src/vespa/document/select/simpleparser.h
+++ b/document/src/vespa/document/select/simpleparser.h
@@ -11,10 +11,10 @@ namespace document::select::simple {
class Parser {
public:
virtual ~Parser() { }
- virtual bool parse(const vespalib::stringref & s) = 0;
+ virtual bool parse(vespalib::stringref s) = 0;
const vespalib::stringref & getRemaining() const { return _remaining; }
protected:
- void setRemaining(const vespalib::stringref & s) { _remaining = s; }
+ void setRemaining(vespalib::stringref s) { _remaining = s; }
private:
vespalib::stringref _remaining;
};
@@ -44,7 +44,7 @@ public:
IdSpecParser(const BucketIdFactory& bucketIdFactory) :
_bucketIdFactory(bucketIdFactory)
{}
- bool parse(const vespalib::stringref & s) override;
+ bool parse(vespalib::stringref s) override;
const IdValueNode & getId() const { return static_cast<const IdValueNode &>(getValue()); }
bool isUserSpec() const { return getId().getType() == IdValueNode::USER; }
private:
@@ -54,7 +54,7 @@ private:
class OperatorParser : public Parser
{
public:
- bool parse(const vespalib::stringref & s) override;
+ bool parse(vespalib::stringref s) override;
const Operator * getOperator() const { return _operator; }
private:
const Operator *_operator;
@@ -63,13 +63,13 @@ private:
class StringParser : public Parser, public ValueResult
{
public:
- bool parse(const vespalib::stringref & s) override;
+ bool parse(vespalib::stringref s) override;
};
class IntegerParser : public Parser, public ValueResult
{
public:
- bool parse(const vespalib::stringref & s) override;
+ bool parse(vespalib::stringref s) override;
};
class SelectionParser : public Parser, public NodeResult
@@ -78,7 +78,7 @@ public:
SelectionParser(const BucketIdFactory& bucketIdFactory) :
_bucketIdFactory(bucketIdFactory)
{}
- bool parse(const vespalib::stringref & s) override;
+ bool parse(vespalib::stringref s) override;
private:
const BucketIdFactory & _bucketIdFactory;
};
diff --git a/document/src/vespa/document/select/value.cpp b/document/src/vespa/document/select/value.cpp
index e20d6859c18..d6c94216bca 100644
--- a/document/src/vespa/document/select/value.cpp
+++ b/document/src/vespa/document/select/value.cpp
@@ -96,7 +96,7 @@ NullValue::print(std::ostream& out, bool verbose,
out << "nil";
}
-StringValue::StringValue(const vespalib::stringref & val)
+StringValue::StringValue(vespalib::stringref val)
: Value(String),
_value(val)
{
diff --git a/document/src/vespa/document/select/value.h b/document/src/vespa/document/select/value.h
index 6976bc40d63..f240f2ba5d7 100644
--- a/document/src/vespa/document/select/value.h
+++ b/document/src/vespa/document/select/value.h
@@ -91,7 +91,7 @@ class StringValue : public Value
vespalib::string _value;
public:
- StringValue(const vespalib::stringref & val);
+ StringValue(vespalib::stringref val);
const vespalib::string& getValue() const { return _value; }
ResultList operator<(const Value& value) const override;
diff --git a/document/src/vespa/document/select/valuenodes.cpp b/document/src/vespa/document/select/valuenodes.cpp
index f9cf3472110..52df1ed6dcc 100644
--- a/document/src/vespa/document/select/valuenodes.cpp
+++ b/document/src/vespa/document/select/valuenodes.cpp
@@ -38,7 +38,7 @@ namespace {
}
}
-InvalidValueNode::InvalidValueNode(const vespalib::stringref & name)
+InvalidValueNode::InvalidValueNode(vespalib::stringref name)
: _name(name)
{ }
@@ -79,7 +79,7 @@ NullValueNode::print(std::ostream& out, bool verbose,
if (hadParentheses()) out << ')';
}
-StringValueNode::StringValueNode(const vespalib::stringref & val)
+StringValueNode::StringValueNode(vespalib::stringref val)
: _value(val)
{
}
@@ -686,7 +686,7 @@ namespace {
}
}
-FunctionValueNode::FunctionValueNode(const vespalib::stringref & name,
+FunctionValueNode::FunctionValueNode(vespalib::stringref name,
std::unique_ptr<ValueNode> src)
: _function(),
_funcname(name),
diff --git a/document/src/vespa/document/select/valuenodes.h b/document/src/vespa/document/select/valuenodes.h
index bc1ec0e01e8..2f5031abce7 100644
--- a/document/src/vespa/document/select/valuenodes.h
+++ b/document/src/vespa/document/select/valuenodes.h
@@ -19,7 +19,7 @@ class InvalidValueNode : public ValueNode
{
vespalib::string _name;
public:
- InvalidValueNode(const vespalib::stringref & name);
+ InvalidValueNode(vespalib::stringref name);
std::unique_ptr<Value> getValue(const Context&) const override {
return std::unique_ptr<Value>(new InvalidValue());
@@ -55,7 +55,7 @@ class StringValueNode : public ValueNode
{
vespalib::string _value;
public:
- explicit StringValueNode(const vespalib::stringref & val);
+ explicit StringValueNode(vespalib::stringref val);
const vespalib::string& getValue() const { return _value; }
@@ -280,7 +280,7 @@ class FunctionValueNode : public ValueNode
public:
enum Function { LOWERCASE, HASH, ABS };
- FunctionValueNode(const vespalib::stringref & name, std::unique_ptr<ValueNode> src);
+ FunctionValueNode(vespalib::stringref name, std::unique_ptr<ValueNode> src);
Function getFunction() const { return _function; }
const vespalib::string &getFunctionName(void) const { return _funcname; }
diff --git a/document/src/vespa/document/util/stringutil.cpp b/document/src/vespa/document/util/stringutil.cpp
index a80f3ead21e..60bc2516b77 100644
--- a/document/src/vespa/document/util/stringutil.cpp
+++ b/document/src/vespa/document/util/stringutil.cpp
@@ -127,7 +127,7 @@ const vespalib::string & StringUtil::escape(const vespalib::string & source, ves
return source;
}
-vespalib::string StringUtil::unescape(const vespalib::stringref & source)
+vespalib::string StringUtil::unescape(vespalib::stringref source)
{
vespalib::asciistream ost;
for (unsigned int i=0; i<source.size(); ++i) {
diff --git a/document/src/vespa/document/util/stringutil.h b/document/src/vespa/document/util/stringutil.h
index 9fc136f0ce2..afe942e2c62 100644
--- a/document/src/vespa/document/util/stringutil.h
+++ b/document/src/vespa/document/util/stringutil.h
@@ -35,7 +35,7 @@ public:
* Unescape a string, replacing \\\\ \\n \\t \\f \\r or \\x## with their
* ascii value counterparts.
*/
- static vespalib::string unescape(const vespalib::stringref & source);
+ static vespalib::string unescape(vespalib::stringref source);
/**
* Print whatever source points to in a readable format.