summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-07-26 19:54:21 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-07-31 17:04:20 +0200
commitb1ff42f5fa34c3a196f4482681f0cba478565e45 (patch)
tree68e16f27466378d54db967281066bf7b1f29db8f /document
parent56abd0f8faac631ec3257b4d2eaf4f44757bf8ac (diff)
Provide the repo when you need it.
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/fieldpathupdatetestcase.cpp10
-rw-r--r--document/src/vespa/document/update/addfieldpathupdate.cpp2
-rw-r--r--document/src/vespa/document/update/addfieldpathupdate.h2
-rw-r--r--document/src/vespa/document/update/assignfieldpathupdate.cpp7
-rw-r--r--document/src/vespa/document/update/assignfieldpathupdate.h2
-rw-r--r--document/src/vespa/document/update/fieldpathupdate.cpp2
-rw-r--r--document/src/vespa/document/update/fieldpathupdate.h2
-rw-r--r--document/src/vespa/document/update/removefieldpathupdate.cpp2
-rw-r--r--document/src/vespa/document/update/removefieldpathupdate.h2
9 files changed, 14 insertions, 17 deletions
diff --git a/document/src/tests/fieldpathupdatetestcase.cpp b/document/src/tests/fieldpathupdatetestcase.cpp
index 069ec61aef8..c1c500a0837 100644
--- a/document/src/tests/fieldpathupdatetestcase.cpp
+++ b/document/src/tests/fieldpathupdatetestcase.cpp
@@ -288,16 +288,13 @@ struct TestFieldPathUpdate : FieldPathUpdate
TestFieldPathUpdate(const TestFieldPathUpdate& other);
- std::unique_ptr<IteratorHandler> getIteratorHandler(Document&) const override
- {
- return std::unique_ptr<IteratorHandler>(
- new TestIteratorHandler(_str));
+ std::unique_ptr<IteratorHandler> getIteratorHandler(Document&, const DocumentTypeRepo &) const override {
+ return std::unique_ptr<IteratorHandler>(new TestIteratorHandler(_str));
}
TestFieldPathUpdate* clone() const override { return new TestFieldPathUpdate(*this); }
- void print(std::ostream& out, bool, const std::string&) const override
- {
+ void print(std::ostream& out, bool, const std::string&) const override {
out << "TestFieldPathUpdate()";
}
@@ -547,6 +544,7 @@ void
FieldPathUpdateTestCase::testApplyAssignFieldNotExistingInExpression()
{
Document::UP doc(new Document(_foobar_type, DocumentId("doc:bat:man")));
+ doc->setRepo(*_repo);
CPPUNIT_ASSERT(doc->hasValue("num") == false);
doc->setValue("num", IntFieldValue(10));
diff --git a/document/src/vespa/document/update/addfieldpathupdate.cpp b/document/src/vespa/document/update/addfieldpathupdate.cpp
index e0506229bfc..f2ec2c3064e 100644
--- a/document/src/vespa/document/update/addfieldpathupdate.cpp
+++ b/document/src/vespa/document/update/addfieldpathupdate.cpp
@@ -104,7 +104,7 @@ AddFieldPathUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& ty
}
std::unique_ptr<IteratorHandler>
-AddFieldPathUpdate::getIteratorHandler(Document&) const {
+AddFieldPathUpdate::getIteratorHandler(Document&, const DocumentTypeRepo &) const {
return std::make_unique<AddIteratorHandler>(*_values);
}
diff --git a/document/src/vespa/document/update/addfieldpathupdate.h b/document/src/vespa/document/update/addfieldpathupdate.h
index 8da5be9be38..2943248d9d8 100644
--- a/document/src/vespa/document/update/addfieldpathupdate.h
+++ b/document/src/vespa/document/update/addfieldpathupdate.h
@@ -29,7 +29,7 @@ private:
void deserialize(const DocumentTypeRepo& repo, const DataType& type,
ByteBuffer& buffer, uint16_t version) override;
- std::unique_ptr<fieldvalue::IteratorHandler> getIteratorHandler(Document&) const override;
+ std::unique_ptr<fieldvalue::IteratorHandler> getIteratorHandler(Document &, const DocumentTypeRepo &) const override;
vespalib::CloneablePtr<ArrayFieldValue> _values;
};
diff --git a/document/src/vespa/document/update/assignfieldpathupdate.cpp b/document/src/vespa/document/update/assignfieldpathupdate.cpp
index ed9e9194504..bf5044d0aab 100644
--- a/document/src/vespa/document/update/assignfieldpathupdate.cpp
+++ b/document/src/vespa/document/update/assignfieldpathupdate.cpp
@@ -185,10 +185,10 @@ AssignExpressionIteratorHandler::doModify(FieldValue& fv) {
}
std::unique_ptr<IteratorHandler>
-AssignFieldPathUpdate::getIteratorHandler(Document& doc) const
+AssignFieldPathUpdate::getIteratorHandler(Document& doc, const DocumentTypeRepo & repo) const
{
if (!_expression.empty()) {
- return std::make_unique<AssignExpressionIteratorHandler>(*_repo, doc, _expression, _removeIfZero, _createMissingPath);
+ return std::make_unique<AssignExpressionIteratorHandler>(repo, doc, _expression, _removeIfZero, _createMissingPath);
} else {
return std::make_unique<AssignValueIteratorHandler>(*_newValue, _removeIfZero, _createMissingPath);
}
@@ -211,8 +211,7 @@ AssignFieldPathUpdate::operator==(const FieldPathUpdate& other) const
}
void
-AssignFieldPathUpdate::print(std::ostream& out, bool verbose,
- const std::string& indent) const
+AssignFieldPathUpdate::print(std::ostream& out, bool verbose, const std::string& indent) const
{
out << "AssignFieldPathUpdate(\n";
FieldPathUpdate::print(out, verbose, indent + " ");
diff --git a/document/src/vespa/document/update/assignfieldpathupdate.h b/document/src/vespa/document/update/assignfieldpathupdate.h
index 6301e36953b..c6b4d0d56cc 100644
--- a/document/src/vespa/document/update/assignfieldpathupdate.h
+++ b/document/src/vespa/document/update/assignfieldpathupdate.h
@@ -58,7 +58,7 @@ private:
void deserialize(const DocumentTypeRepo& repo, const DataType& type,
ByteBuffer& buffer, uint16_t version) override;
- std::unique_ptr<fieldvalue::IteratorHandler> getIteratorHandler(Document& doc) const override;
+ std::unique_ptr<fieldvalue::IteratorHandler> getIteratorHandler(Document& doc, const DocumentTypeRepo & repo) const override;
const DocumentTypeRepo *_repo;
vespalib::CloneablePtr<FieldValue> _newValue;
diff --git a/document/src/vespa/document/update/fieldpathupdate.cpp b/document/src/vespa/document/update/fieldpathupdate.cpp
index 249a3cd6572..817dcce5af9 100644
--- a/document/src/vespa/document/update/fieldpathupdate.cpp
+++ b/document/src/vespa/document/update/fieldpathupdate.cpp
@@ -61,7 +61,7 @@ FieldPathUpdate::operator==(const FieldPathUpdate& other) const
void
FieldPathUpdate::applyTo(Document& doc) const
{
- std::unique_ptr<IteratorHandler> handler(getIteratorHandler(doc));
+ std::unique_ptr<IteratorHandler> handler(getIteratorHandler(doc, *doc.getRepo()));
if (_originalWhereClause.empty()) {
doc.iterateNested(_fieldPath, *handler);
diff --git a/document/src/vespa/document/update/fieldpathupdate.h b/document/src/vespa/document/update/fieldpathupdate.h
index 4c6b486c25e..01fa8ee6b79 100644
--- a/document/src/vespa/document/update/fieldpathupdate.h
+++ b/document/src/vespa/document/update/fieldpathupdate.h
@@ -101,7 +101,7 @@ protected:
enum SerializedMagic {AssignMagic=0, RemoveMagic=1, AddMagic=2};
private:
// TODO: rename to createIteratorHandler?
- virtual std::unique_ptr<fieldvalue::IteratorHandler> getIteratorHandler(Document& doc) const = 0;
+ virtual std::unique_ptr<fieldvalue::IteratorHandler> getIteratorHandler(Document& doc, const DocumentTypeRepo & repo) const = 0;
vespalib::string _originalFieldPath;
vespalib::string _originalWhereClause;
diff --git a/document/src/vespa/document/update/removefieldpathupdate.cpp b/document/src/vespa/document/update/removefieldpathupdate.cpp
index 51de86113bd..4c938eefa7e 100644
--- a/document/src/vespa/document/update/removefieldpathupdate.cpp
+++ b/document/src/vespa/document/update/removefieldpathupdate.cpp
@@ -59,7 +59,7 @@ public:
}
std::unique_ptr<IteratorHandler>
-RemoveFieldPathUpdate::getIteratorHandler(Document&) const {
+RemoveFieldPathUpdate::getIteratorHandler(Document&, const DocumentTypeRepo &) const {
return std::make_unique<RemoveIteratorHandler>();
}
diff --git a/document/src/vespa/document/update/removefieldpathupdate.h b/document/src/vespa/document/update/removefieldpathupdate.h
index 9d4e2494d68..2dfc826e61f 100644
--- a/document/src/vespa/document/update/removefieldpathupdate.h
+++ b/document/src/vespa/document/update/removefieldpathupdate.h
@@ -26,7 +26,7 @@ private:
void deserialize(const DocumentTypeRepo& repo, const DataType& type,
ByteBuffer& buffer, uint16_t version) override;
- std::unique_ptr<fieldvalue::IteratorHandler> getIteratorHandler(Document&) const override;
+ std::unique_ptr<fieldvalue::IteratorHandler> getIteratorHandler(Document &, const DocumentTypeRepo &) const override;
};