aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/update/removefieldpathupdate.cpp
blob: a2909a2a3e14a92194c1c07cca70e761a9eac80a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "removefieldpathupdate.h"
#include <vespa/document/fieldvalue/iteratorhandler.h>
#include <ostream>

namespace document {

using namespace fieldvalue;

RemoveFieldPathUpdate::RemoveFieldPathUpdate() noexcept
    : FieldPathUpdate(Remove)
{
}

RemoveFieldPathUpdate::~RemoveFieldPathUpdate() = default;

RemoveFieldPathUpdate::RemoveFieldPathUpdate(stringref fieldPath, stringref whereClause)
    : FieldPathUpdate(Remove, fieldPath, whereClause)
{
}

void
RemoveFieldPathUpdate::print(std::ostream& out, bool verbose, const std::string& indent) const
{
    out << "RemoveFieldPathUpdate(\n";
    FieldPathUpdate::print(out, verbose, indent + "  ");
    out << "\n" << indent << ")";
}

void
RemoveFieldPathUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream)
{
    FieldPathUpdate::deserialize(repo, type, stream);
}

namespace {

class RemoveIteratorHandler : public IteratorHandler {
public:
    RemoveIteratorHandler() = default;

    ModificationStatus doModify(FieldValue &) override {
        return ModificationStatus::REMOVED;
    }
};

}

std::unique_ptr<IteratorHandler>
RemoveFieldPathUpdate::getIteratorHandler(Document&, const DocumentTypeRepo &) const {
    return std::make_unique<RemoveIteratorHandler>();
}

} // ns document