blob: 0eea8f69da747ad7436f80b70033a780a0e23c97 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
* This class represents an update that removes a given field value from a
* field.
*/
#pragma once
#include "valueupdate.h"
#include <vespa/document/fieldvalue/fieldvalue.h>
namespace document {
class RemoveValueUpdate : public ValueUpdate {
FieldValue::CP _key; // The field value to remove by this update.
RemoveValueUpdate() : ValueUpdate(), _key() {}
ACCEPT_UPDATE_VISITOR;
public:
typedef std::unique_ptr<RemoveValueUpdate> UP;
/**
* The default constructor requires initial values for all member variables.
*
* @param value The identifier of the field value to update.
*/
RemoveValueUpdate(const FieldValue& key);
~RemoveValueUpdate();
bool operator==(const ValueUpdate& other) const override;
/**
* @return The key, whose value to remove during this update. This will be
* an IntFieldValue for arrays.
*/
const FieldValue& getKey() const { return *_key; }
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, nbostream& buffer) override;
DECLARE_IDENTIFIABLE(RemoveValueUpdate);
};
}
|