aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/fieldvalue/predicatefieldvalue.h
blob: c99a82a59e2e0445c32dd85164dce5444047d8da (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "fieldvalue.h"

namespace vespalib {
    class Slime;
}
namespace document {

class PredicateFieldValue final : public FieldValue {
    std::unique_ptr<vespalib::Slime> _slime;

    PredicateFieldValue & operator=(const PredicateFieldValue &rhs);
public:
    PredicateFieldValue();
    PredicateFieldValue(std::unique_ptr<vespalib::Slime> s);
    PredicateFieldValue(const PredicateFieldValue &rhs);
    PredicateFieldValue(PredicateFieldValue && rhs) noexcept = default;
    ~PredicateFieldValue() override;

    PredicateFieldValue & operator=(PredicateFieldValue && rhs) noexcept = default;

    void accept(FieldValueVisitor &visitor) override { visitor.visit(*this); }
    void accept(ConstFieldValueVisitor &visitor) const override { visitor.visit(*this); }

    FieldValue *clone() const override;
    int compare(const FieldValue &rhs) const override;

    void printXml(XmlOutputStream &out) const override;
    void print(std::ostream &out, bool verbose, const std::string &indent) const override;

    const DataType *getDataType() const override;

    const vespalib::Slime &getSlime() const { return *_slime; }

    FieldValue &assign(const FieldValue &rhs) override;
};

}