diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-04 16:35:02 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-04 16:36:18 +0200 |
commit | 9204052b04f33c47f62acb8d01161726268990d5 (patch) | |
tree | 49e0e9819bd9a73c316694d791b93700a694db92 /document | |
parent | 31fa22ae90c6481c6e70eb2381d63ecc9b6c6d42 (diff) |
Use override
Diffstat (limited to 'document')
21 files changed, 153 insertions, 337 deletions
diff --git a/document/src/vespa/document/datatype/arraydatatype.h b/document/src/vespa/document/datatype/arraydatatype.h index 706579ae2f6..b7183b42c5c 100644 --- a/document/src/vespa/document/datatype/arraydatatype.h +++ b/document/src/vespa/document/datatype/arraydatatype.h @@ -7,7 +7,7 @@ */ #pragma once -#include <vespa/document/datatype/collectiondatatype.h> +#include "collectiondatatype.h" namespace document { @@ -23,15 +23,11 @@ public: explicit ArrayDataType(const DataType &nestedType); ArrayDataType(const DataType &nestedType, int32_t id); - // CollectionDataType implementation - virtual std::unique_ptr<FieldValue> createFieldValue() const; - virtual void print(std::ostream&, bool verbose, - const std::string& indent) const; - virtual bool operator==(const DataType& other) const; - virtual ArrayDataType* clone() const { return new ArrayDataType(*this); } - - FieldPath::UP onBuildFieldPath( - const vespalib::stringref & remainFieldName) const; + std::unique_ptr<FieldValue> createFieldValue() const override; + 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); } + FieldPath::UP onBuildFieldPath(const vespalib::stringref & remainFieldName) const override; DECLARE_IDENTIFIABLE(ArrayDataType); }; diff --git a/document/src/vespa/document/fieldvalue/shortfieldvalue.h b/document/src/vespa/document/fieldvalue/shortfieldvalue.h index 329e33d0189..6fb848064db 100644 --- a/document/src/vespa/document/fieldvalue/shortfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/shortfieldvalue.h @@ -7,8 +7,8 @@ */ #pragma once +#include "numericfieldvalue.h" #include <vespa/document/datatype/numericdatatype.h> -#include <vespa/document/fieldvalue/numericfieldvalue.h> namespace document { @@ -23,9 +23,8 @@ public: void accept(FieldValueVisitor &visitor) override { visitor.visit(*this); } void accept(ConstFieldValueVisitor &visitor) const override { visitor.visit(*this); } - virtual const DataType *getDataType() const { return DataType::SHORT; } - - virtual ShortFieldValue* clone() const { return new ShortFieldValue(*this); } + const DataType *getDataType() const override { return DataType::SHORT; } + ShortFieldValue* clone() const override { return new ShortFieldValue(*this); } using NumericFieldValue<Number>::operator=; diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp index bf8eb9e7eb5..079b730c8cc 100644 --- a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp @@ -383,7 +383,7 @@ struct StructFieldValue::FieldIterator : public StructuredIterator { } } - virtual const Field* getNextField() { + const Field* getNextField() override { while (_cur != _ids.end()) { int id = *_cur++; try { diff --git a/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h b/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h index 83ceb1f1238..efa1c718d64 100644 --- a/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h @@ -74,10 +74,8 @@ public: void reserve(size_t sz) { _map.reserve(sz); } void resize(size_t sz) { _map.resize(sz); } - // FieldValue implementation - virtual FieldValue& assign(const FieldValue&); - virtual WeightedSetFieldValue* clone() const - { return new WeightedSetFieldValue(*this); } + FieldValue& assign(const FieldValue&) override; + WeightedSetFieldValue* clone() const override { return new WeightedSetFieldValue(*this); } virtual int compare(const FieldValue&) const override; virtual void printXml(XmlOutputStream& out) const override; virtual void print(std::ostream& out, bool verbose, diff --git a/document/src/vespa/document/select/bodyfielddetector.h b/document/src/vespa/document/select/bodyfielddetector.h index a4716d1a175..3758766edd3 100644 --- a/document/src/vespa/document/select/bodyfielddetector.h +++ b/document/src/vespa/document/select/bodyfielddetector.h @@ -24,22 +24,22 @@ public: bool foundBodyField; bool foundHeaderField; - virtual void visitDocumentType(const DocType&) { + void visitDocumentType(const DocType&) override { // Need to deserialize header to know document type foundHeaderField = true; } - void visitFieldValueNode(const FieldValueNode& expr); + void visitFieldValueNode(const FieldValueNode& expr) override; }; class NeedDocumentDetector : public TraversingVisitor { private: bool _needDocument; - virtual void visitDocumentType(const DocType &) { + void visitDocumentType(const DocType &) override { _needDocument = true; } - virtual void visitFieldValueNode(const FieldValueNode &) { + void visitFieldValueNode(const FieldValueNode &) override { _needDocument = true; } public: diff --git a/document/src/vespa/document/select/cloningvisitor.h b/document/src/vespa/document/select/cloningvisitor.h index 45101f39dc8..0cfab62bb98 100644 --- a/document/src/vespa/document/select/cloningvisitor.h +++ b/document/src/vespa/document/select/cloningvisitor.h @@ -47,100 +47,40 @@ protected: static const int SearchColPriority = 1000; public: - CloningVisitor(void); - - virtual - ~CloningVisitor(void); - - virtual void - visitAndBranch(const And &expr); - - virtual void - visitOrBranch(const Or &expr); - - virtual void - visitNotBranch(const Not &expr); - - virtual void - visitComparison(const Compare &expr); - - virtual void - visitArithmeticValueNode(const ArithmeticValueNode &expr); - - virtual void - visitFunctionValueNode(const FunctionValueNode &expr); - - virtual void - visitConstant(const Constant &expr); - - virtual void - visitInvalidConstant(const InvalidConstant &expr); - - virtual void - visitDocumentType(const DocType &expr); - - virtual void - visitIdValueNode(const IdValueNode &expr); - - virtual void - visitSearchColumnValueNode(const SearchColumnValueNode &expr); - - virtual void - visitFieldValueNode(const FieldValueNode &expr); - - virtual void - visitFloatValueNode(const FloatValueNode &expr); - - virtual void - visitVariableValueNode(const VariableValueNode &expr); - - virtual void - visitIntegerValueNode(const IntegerValueNode &expr); - - virtual void - visitCurrentTimeValueNode(const CurrentTimeValueNode &expr); - - virtual void - visitStringValueNode(const StringValueNode &expr); - - virtual void - visitNullValueNode(const NullValueNode &expr); - - virtual void - visitInvalidValueNode(const InvalidValueNode &expr); - - std::unique_ptr<Node> & - getNode(void) - { - return _node; - } - - std::unique_ptr<ValueNode> & - getValueNode(void) - { - return _valueNode; - } - - void - setNodeParentheses(int priority); - - void - setValueNodeParentheses(int priority); - - void - setArithmeticValueNode(const ArithmeticValueNode &expr, - std::unique_ptr<ValueNode> lhs, - int lhsPriority, - bool lhsConstVal, - std::unique_ptr<ValueNode> rhs, - int rhsPriority, - bool rhsConstVal); - - void - swap(CloningVisitor &rhs); - - void - revisit(void); + CloningVisitor(); + ~CloningVisitor(); + + void visitAndBranch(const And &expr) override; + void visitOrBranch(const Or &expr) override; + void visitNotBranch(const Not &expr) override; + void visitComparison(const Compare &expr) override; + void visitArithmeticValueNode(const ArithmeticValueNode &expr) override; + void visitFunctionValueNode(const FunctionValueNode &expr) override; + void visitConstant(const Constant &expr) override; + void visitInvalidConstant(const InvalidConstant &expr) override; + void visitDocumentType(const DocType &expr) override; + void visitIdValueNode(const IdValueNode &expr) override; + void visitSearchColumnValueNode(const SearchColumnValueNode &expr) override; + void visitFieldValueNode(const FieldValueNode &expr) override; + void visitFloatValueNode(const FloatValueNode &expr) override; + void visitVariableValueNode(const VariableValueNode &expr) override; + void visitIntegerValueNode(const IntegerValueNode &expr) override; + void visitCurrentTimeValueNode(const CurrentTimeValueNode &expr) override; + void visitStringValueNode(const StringValueNode &expr) override; + void visitNullValueNode(const NullValueNode &expr) override; + void visitInvalidValueNode(const InvalidValueNode &expr) override; + + std::unique_ptr<Node> &getNode() { return _node; } + std::unique_ptr<ValueNode> &getValueNode() { return _valueNode; } + + void setNodeParentheses(int priority); + void setValueNodeParentheses(int priority); + void setArithmeticValueNode(const ArithmeticValueNode &expr, std::unique_ptr<ValueNode> lhs, + int lhsPriority, bool lhsConstVal, std::unique_ptr<ValueNode> rhs, + int rhsPriority, bool rhsConstVal); + + void swap(CloningVisitor &rhs); + void revisit(void); }; } diff --git a/document/src/vespa/document/select/invalidconstant.h b/document/src/vespa/document/select/invalidconstant.h index 14bd681b97a..1d19d069d12 100644 --- a/document/src/vespa/document/select/invalidconstant.h +++ b/document/src/vespa/document/select/invalidconstant.h @@ -22,14 +22,12 @@ class InvalidConstant : public Node public: explicit InvalidConstant(const vespalib::stringref &value); - virtual ResultList contains(const Context&) const - { return ResultList(Result::Invalid); } - virtual ResultList trace(const Context&, std::ostream& trace) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - virtual void visit(Visitor& v) const; - - Node::UP clone() const { return wrapParens(new InvalidConstant(_name)); } + ResultList contains(const Context&) const override { return ResultList(Result::Invalid); } + ResultList trace(const Context&, std::ostream& trace) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void visit(Visitor& v) const override; + + Node::UP clone() const override { return wrapParens(new InvalidConstant(_name)); } }; diff --git a/document/src/vespa/document/select/orderingselector.cpp b/document/src/vespa/document/select/orderingselector.cpp index 8875b09f848..32a1f0a8adf 100644 --- a/document/src/vespa/document/select/orderingselector.cpp +++ b/document/src/vespa/document/select/orderingselector.cpp @@ -45,7 +45,7 @@ namespace { return OrderingSpecification::UP(); } - void visitAndBranch(const document::select::And& node) { + void visitAndBranch(const document::select::And& node) override { OrderingVisitor left(_order); node.getLeft().visit(left); node.getRight().visit(*this); @@ -64,7 +64,7 @@ namespace { _spec = pickOrdering(*_spec, *left._spec, true); } - void visitOrBranch(const document::select::Or& node) { + void visitOrBranch(const document::select::Or& node) override { OrderingVisitor left(_order); node.getLeft().visit(left); node.getRight().visit(*this); @@ -77,8 +77,7 @@ namespace { _spec = pickOrdering(*_spec, *left._spec, false); } - void visitNotBranch(const document::select::Not&) { - } + void visitNotBranch(const document::select::Not&) override {} void compare(const select::IdValueNode& node, const select::ValueNode& valnode, @@ -120,7 +119,7 @@ namespace { } } - void visitComparison(const document::select::Compare& node) { + void visitComparison(const document::select::Compare& node) override { const IdValueNode* lid(dynamic_cast<const IdValueNode*>( &node.getLeft())); if (lid) { @@ -134,76 +133,21 @@ namespace { } } - void visitConstant(const document::select::Constant&) { - } - - virtual void - visitInvalidConstant(const document::select::InvalidConstant &) - { - } - - void visitDocumentType(const document::select::DocType&) { - } - - virtual void - visitArithmeticValueNode(const ArithmeticValueNode &) - { - } - - virtual void - visitFunctionValueNode(const FunctionValueNode &) - { - } - - virtual void - visitIdValueNode(const IdValueNode &) - { - } - - virtual void - visitSearchColumnValueNode(const SearchColumnValueNode &) - { - } - - virtual void - visitFieldValueNode(const FieldValueNode &) - { - } - - virtual void - visitFloatValueNode(const FloatValueNode &) - { - } - - virtual void - visitVariableValueNode(const VariableValueNode &) - { - } - - virtual void - visitIntegerValueNode(const IntegerValueNode &) - { - } - - virtual void - visitCurrentTimeValueNode(const CurrentTimeValueNode &) - { - } - - virtual void - visitStringValueNode(const StringValueNode &) - { - } - - virtual void - visitNullValueNode(const NullValueNode &) - { - } - - virtual void - visitInvalidValueNode(const InvalidValueNode &) - { - } + void visitConstant(const document::select::Constant&) override {} + void visitInvalidConstant(const document::select::InvalidConstant &) override {} + void visitDocumentType(const document::select::DocType&) override {} + void visitArithmeticValueNode(const ArithmeticValueNode &) override {} + void visitFunctionValueNode(const FunctionValueNode &) override {} + void visitIdValueNode(const IdValueNode &) override {} + void visitSearchColumnValueNode(const SearchColumnValueNode &) override {} + void visitFieldValueNode(const FieldValueNode &) override {} + void visitFloatValueNode(const FloatValueNode &) override {} + void visitVariableValueNode(const VariableValueNode &) override {} + void visitIntegerValueNode(const IntegerValueNode &) override {} + void visitCurrentTimeValueNode(const CurrentTimeValueNode &) override {} + void visitStringValueNode(const StringValueNode &) override {} + void visitNullValueNode(const NullValueNode &) override {} + void visitInvalidValueNode(const InvalidValueNode &) override {} }; } diff --git a/document/src/vespa/document/select/simpleparser.h b/document/src/vespa/document/select/simpleparser.h index 742a7638175..e6457c3dec7 100644 --- a/document/src/vespa/document/select/simpleparser.h +++ b/document/src/vespa/document/select/simpleparser.h @@ -50,7 +50,7 @@ public: IdSpecParser(const BucketIdFactory& bucketIdFactory) : _bucketIdFactory(bucketIdFactory) {} - virtual bool parse(const vespalib::stringref & s); + bool parse(const vespalib::stringref & s) override; const IdValueNode & getId() const { return static_cast<const IdValueNode &>(getValue()); } bool isUserSpec() const { return getId().getType() == IdValueNode::USER; } private: @@ -60,7 +60,7 @@ private: class OperatorParser : public Parser { public: - virtual bool parse(const vespalib::stringref & s); + bool parse(const vespalib::stringref & s) override; const Operator * getOperator() const { return _operator; } private: const Operator *_operator; @@ -69,13 +69,13 @@ private: class StringParser : public Parser, public ValueResult { public: - virtual bool parse(const vespalib::stringref & s); + bool parse(const vespalib::stringref & s) override; }; class IntegerParser : public Parser, public ValueResult { public: - virtual bool parse(const vespalib::stringref & s); + bool parse(const vespalib::stringref & s) override; }; class SelectionParser : public Parser, public NodeResult @@ -84,7 +84,7 @@ public: SelectionParser(const BucketIdFactory& bucketIdFactory) : _bucketIdFactory(bucketIdFactory) {} - virtual bool parse(const vespalib::stringref & s); + bool parse(const vespalib::stringref & s) override; private: const BucketIdFactory & _bucketIdFactory; }; diff --git a/document/src/vespa/document/select/traversingvisitor.h b/document/src/vespa/document/select/traversingvisitor.h index 9b3712571a5..12cdef43487 100644 --- a/document/src/vespa/document/select/traversingvisitor.h +++ b/document/src/vespa/document/select/traversingvisitor.h @@ -10,65 +10,28 @@ class TraversingVisitor : public Visitor { public: - virtual void - visitAndBranch(const And &expr); - - virtual void - visitOrBranch(const Or &expr); - - virtual void - visitNotBranch(const Not &expr); - - virtual void - visitComparison(const Compare &expr); - - virtual void - visitArithmeticValueNode(const ArithmeticValueNode &expr); - - virtual void - visitFunctionValueNode(const FunctionValueNode &expr); - - virtual void - visitConstant(const Constant &); - - virtual void - visitInvalidConstant(const InvalidConstant &); - - virtual void - visitDocumentType(const DocType &); - - virtual void - visitIdValueNode(const IdValueNode &); - - virtual void - visitSearchColumnValueNode(const SearchColumnValueNode &); - - virtual void - visitFieldValueNode(const FieldValueNode &); - - virtual void - visitFloatValueNode(const FloatValueNode &); - - virtual void - visitVariableValueNode(const VariableValueNode &); - - virtual void - visitIntegerValueNode(const IntegerValueNode &); - - virtual void - visitCurrentTimeValueNode(const CurrentTimeValueNode &); - - virtual void - visitStringValueNode(const StringValueNode &); - - virtual void - visitNullValueNode(const NullValueNode &); - - virtual void - visitInvalidValueNode(const InvalidValueNode &); + void visitAndBranch(const And &expr) override; + + void visitOrBranch(const Or &expr) override; + void visitNotBranch(const Not &expr) override; + void visitComparison(const Compare &expr) override; + void visitArithmeticValueNode(const ArithmeticValueNode &expr) override; + void visitFunctionValueNode(const FunctionValueNode &expr) override; + void visitConstant(const Constant &) override; + void visitInvalidConstant(const InvalidConstant &) override; + void visitDocumentType(const DocType &) override; + void visitIdValueNode(const IdValueNode &) override; + void visitSearchColumnValueNode(const SearchColumnValueNode &) override; + void visitFieldValueNode(const FieldValueNode &) override; + void visitFloatValueNode(const FloatValueNode &) override; + void visitVariableValueNode(const VariableValueNode &) override; + void visitIntegerValueNode(const IntegerValueNode &) override; + void visitCurrentTimeValueNode(const CurrentTimeValueNode &) override; + void visitStringValueNode(const StringValueNode &) override; + void visitNullValueNode(const NullValueNode &) override; + void visitInvalidValueNode(const InvalidValueNode &) override; }; } } - diff --git a/document/src/vespa/document/update/addvalueupdate.h b/document/src/vespa/document/update/addvalueupdate.h index 4263e48f9e0..1180ba4fcf1 100644 --- a/document/src/vespa/document/update/addvalueupdate.h +++ b/document/src/vespa/document/update/addvalueupdate.h @@ -35,7 +35,7 @@ public: _value(value.clone()), _weight(weight) {} - virtual bool operator==(const ValueUpdate& other) const; + bool operator==(const ValueUpdate& other) const override; /** @return the field value to add during this update. */ const FieldValue& getValue() const { return *_value; } diff --git a/document/src/vespa/document/update/assignvalueupdate.h b/document/src/vespa/document/update/assignvalueupdate.h index 221642df7b4..3811bad42aa 100644 --- a/document/src/vespa/document/update/assignvalueupdate.h +++ b/document/src/vespa/document/update/assignvalueupdate.h @@ -11,8 +11,8 @@ */ #pragma once +#include "valueupdate.h" #include <vespa/document/fieldvalue/fieldvalue.h> -#include <vespa/document/update/valueupdate.h> namespace document { @@ -31,7 +31,7 @@ public: { } - virtual bool operator==(const ValueUpdate& other) const; + bool operator==(const ValueUpdate& other) const override; /** @return The field value to assign during this update. */ bool hasValue() const { return bool(_value); } @@ -48,20 +48,15 @@ public: } // ValueUpdate implementation. - virtual void checkCompatibility(const Field& field) const; - virtual bool applyTo(FieldValue& value) const; - virtual void printXml(XmlOutputStream& xos) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - virtual void deserialize(const DocumentTypeRepo& repo, - const DataType& type, - ByteBuffer& buffer, uint16_t version); - virtual AssignValueUpdate* clone() const - { return new AssignValueUpdate(*this); } + void checkCompatibility(const Field& field) const override; + bool applyTo(FieldValue& value) const override; + void printXml(XmlOutputStream& xos) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void deserialize(const DocumentTypeRepo& repo, const DataType& type, + ByteBuffer& buffer, uint16_t version) override; + AssignValueUpdate* clone() const override { return new AssignValueUpdate(*this); } DECLARE_IDENTIFIABLE(AssignValueUpdate); - }; } // document - diff --git a/document/src/vespa/document/update/clearvalueupdate.h b/document/src/vespa/document/update/clearvalueupdate.h index a0cde78b6ac..ebd796e4642 100644 --- a/document/src/vespa/document/update/clearvalueupdate.h +++ b/document/src/vespa/document/update/clearvalueupdate.h @@ -7,7 +7,7 @@ */ #pragma once -#include <vespa/document/update/valueupdate.h> +#include "valueupdate.h" namespace document { @@ -15,24 +15,18 @@ class ClearValueUpdate : public ValueUpdate { ACCEPT_UPDATE_VISITOR; public: typedef std::unique_ptr<ClearValueUpdate> UP; - ClearValueUpdate() : ValueUpdate() {} - ClearValueUpdate(const ClearValueUpdate& update) : ValueUpdate(update) {} - - virtual bool operator==(const ValueUpdate& other) const; + bool operator==(const ValueUpdate& other) const override; // ValueUpdate implementation - virtual void checkCompatibility(const Field& field) const; - virtual bool applyTo(FieldValue& value) const; - virtual void printXml(XmlOutputStream& xos) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - virtual void deserialize(const DocumentTypeRepo& repo, - const DataType& type, - ByteBuffer& buffer, uint16_t version); - virtual ClearValueUpdate* clone() const - { return new ClearValueUpdate(*this); } + void checkCompatibility(const Field& field) const override; + bool applyTo(FieldValue& value) const override; + void printXml(XmlOutputStream& xos) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void deserialize(const DocumentTypeRepo& repo, const DataType& type, + ByteBuffer& buffer, uint16_t version) override; + ClearValueUpdate* clone() const override { return new ClearValueUpdate(*this); } DECLARE_IDENTIFIABLE(ClearValueUpdate); }; diff --git a/document/src/vespa/document/update/documentupdate.h b/document/src/vespa/document/update/documentupdate.h index 5d5143a0cd5..5d09bd36816 100644 --- a/document/src/vespa/document/update/documentupdate.h +++ b/document/src/vespa/document/update/documentupdate.h @@ -25,13 +25,13 @@ */ #pragma once +#include "fieldupdate.h" +#include "fieldpathupdate.h" #include <vespa/document/base/documentid.h> #include <vespa/document/base/field.h> #include <vespa/document/datatype/documenttype.h> #include <vespa/document/fieldvalue/fieldvalue.h> #include <vespa/document/util/bytebuffer.h> -#include <vespa/document/update/fieldupdate.h> -#include <vespa/document/update/fieldpathupdate.h> namespace document { @@ -144,8 +144,7 @@ public: const DocumentType& getType() const { return static_cast<const DocumentType &> (*_type); } // Printable implementation - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; void deserialize42(const DocumentTypeRepo&, ByteBuffer&); void deserializeHEAD(const DocumentTypeRepo&, ByteBuffer&); @@ -157,7 +156,7 @@ public: void serializeHEAD(vespalib::nbostream &stream) const; // XmlSerializable implementation - virtual void printXml(XmlOutputStream&) const; + void printXml(XmlOutputStream&) const override; // Cloneable implementation virtual DocumentUpdate* clone() const { diff --git a/document/src/vespa/document/update/fieldpathupdate.h b/document/src/vespa/document/update/fieldpathupdate.h index d69309cdc39..80a63d62281 100644 --- a/document/src/vespa/document/update/fieldpathupdate.h +++ b/document/src/vespa/document/update/fieldpathupdate.h @@ -49,7 +49,7 @@ public: void applyTo(Document& doc) const; - virtual FieldPathUpdate* clone() const = 0; + FieldPathUpdate* clone() const override = 0; virtual bool operator==(const FieldPathUpdate& other) const; bool operator!=(const FieldPathUpdate& other) const { diff --git a/document/src/vespa/document/update/fieldupdate.h b/document/src/vespa/document/update/fieldupdate.h index d47e5579a31..d0e4fd3235e 100644 --- a/document/src/vespa/document/update/fieldupdate.h +++ b/document/src/vespa/document/update/fieldupdate.h @@ -79,11 +79,10 @@ public: void applyTo(Document& doc) const; // Printable implementation - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; // XmlSerializable implementation - void printXml(XmlOutputStream&) const; + void printXml(XmlOutputStream&) const override; /** * Deserializes the given byte buffer into an instance of an update object. diff --git a/document/src/vespa/document/update/mapvalueupdate.h b/document/src/vespa/document/update/mapvalueupdate.h index cf0869d271f..14bd0fc9bd3 100644 --- a/document/src/vespa/document/update/mapvalueupdate.h +++ b/document/src/vespa/document/update/mapvalueupdate.h @@ -42,7 +42,7 @@ public: _key(key.clone()), _update(update.clone()) {} - virtual bool operator==(const ValueUpdate& other) const; + bool operator==(const ValueUpdate& other) const override; /** @return The key of the field value to update. */ const FieldValue& getKey() const { return *_key; } @@ -75,16 +75,13 @@ public: } // ValueUpdate implementation - virtual void checkCompatibility(const Field& field) const; - virtual bool applyTo(FieldValue& value) const; - virtual void printXml(XmlOutputStream& xos) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - virtual void deserialize(const DocumentTypeRepo& repo, - const DataType& type, - ByteBuffer& buffer, uint16_t version); - virtual MapValueUpdate* clone() const - { return new MapValueUpdate(*this); } + void checkCompatibility(const Field& field) const override; + bool applyTo(FieldValue& value) const override; + void printXml(XmlOutputStream& xos) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void deserialize(const DocumentTypeRepo& repo, const DataType& type, + ByteBuffer& buffer, uint16_t version) override; + MapValueUpdate* clone() const override { return new MapValueUpdate(*this); } DECLARE_IDENTIFIABLE(MapValueUpdate); diff --git a/document/src/vespa/document/update/removefieldpathupdate.h b/document/src/vespa/document/update/removefieldpathupdate.h index db5ebde50a7..6de2a105cbf 100644 --- a/document/src/vespa/document/update/removefieldpathupdate.h +++ b/document/src/vespa/document/update/removefieldpathupdate.h @@ -18,10 +18,8 @@ public: FieldPathUpdate* clone() const override { return new RemoveFieldPathUpdate(*this); } - bool operator==(const FieldPathUpdate& other) const; - - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + bool operator==(const FieldPathUpdate& other) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_IDENTIFIABLE(RemoveFieldPathUpdate); ACCEPT_UPDATE_VISITOR; @@ -41,7 +39,7 @@ private: } }; - std::unique_ptr<FieldValue::IteratorHandler> getIteratorHandler(Document&) const { + std::unique_ptr<FieldValue::IteratorHandler> getIteratorHandler(Document&) const override { return std::make_unique<RemoveIteratorHandler>(); } }; diff --git a/document/src/vespa/document/update/removevalueupdate.h b/document/src/vespa/document/update/removevalueupdate.h index 5552796ceb4..42590104870 100644 --- a/document/src/vespa/document/update/removevalueupdate.h +++ b/document/src/vespa/document/update/removevalueupdate.h @@ -5,8 +5,8 @@ */ #pragma once +#include "valueupdate.h" #include <vespa/document/fieldvalue/fieldvalue.h> -#include <vespa/document/update/valueupdate.h> namespace document { @@ -28,7 +28,7 @@ public: : ValueUpdate(), _key(key.clone()) {} - virtual bool operator==(const ValueUpdate& other) const; + bool operator==(const ValueUpdate& other) const override; /** * @return The key, whose value to remove during this update. This will be @@ -48,16 +48,13 @@ public: } // ValueUpdate implementation - virtual void checkCompatibility(const Field& field) const; - virtual bool applyTo(FieldValue& value) const; - virtual void printXml(XmlOutputStream& xos) const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - virtual void deserialize(const DocumentTypeRepo& repo, - const DataType& type, - ByteBuffer& buffer, uint16_t version); - virtual RemoveValueUpdate* clone() const - { return new RemoveValueUpdate(*this); } + void checkCompatibility(const Field& field) const override; + bool applyTo(FieldValue& value) const override; + void printXml(XmlOutputStream& xos) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void deserialize(const DocumentTypeRepo& repo, const DataType& type, + ByteBuffer& buffer, uint16_t version) override; + RemoveValueUpdate* clone() const override { return new RemoveValueUpdate(*this); } DECLARE_IDENTIFIABLE(RemoveValueUpdate); diff --git a/document/src/vespa/document/update/valueupdate.h b/document/src/vespa/document/update/valueupdate.h index a11838095ae..e4f32c57cf8 100644 --- a/document/src/vespa/document/update/valueupdate.h +++ b/document/src/vespa/document/update/valueupdate.h @@ -18,13 +18,12 @@ */ #pragma once - -#include <vespa/vespalib/objects/cloneable.h> +#include "updatevisitor.h" #include <vespa/document/datatype/datatype.h> #include <vespa/document/util/serializable.h> #include <vespa/document/util/xmlserializable.h> -#include <vespa/document/update/updatevisitor.h> +#include <vespa/vespalib/objects/cloneable.h> namespace document { @@ -87,7 +86,7 @@ public: */ virtual bool applyTo(FieldValue& value) const = 0; - virtual ValueUpdate* clone() const = 0; + ValueUpdate* clone() const override = 0; /** * Deserializes the given byte buffer into an instance of an update object. diff --git a/document/src/vespa/document/util/compressor.h b/document/src/vespa/document/util/compressor.h index cf3e831faa3..599d9424889 100644 --- a/document/src/vespa/document/util/compressor.h +++ b/document/src/vespa/document/util/compressor.h @@ -21,10 +21,10 @@ public: class LZ4Compressor : public ICompressor { public: - virtual bool process(const CompressionConfig& config, const void * input, size_t inputLen, void * output, size_t & outputLen); - virtual bool unprocess(const void * input, size_t inputLen, void * output, size_t & outputLen); - virtual size_t adjustProcessLen(uint16_t options, size_t len) const; - virtual size_t adjustUnProcessLen(uint16_t options, size_t len) const; + bool process(const CompressionConfig& config, const void * input, size_t inputLen, void * output, size_t & outputLen) override; + bool unprocess(const void * input, size_t inputLen, void * output, size_t & outputLen) override; + size_t adjustProcessLen(uint16_t options, size_t len) const override; + size_t adjustUnProcessLen(uint16_t options, size_t len) const override; }; /** |