aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/select/constant.h
blob: 73fdbef1bd721003bbbee6432529815505354c4e (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * @class document::select::Constant
 * @ingroup select
 *
 * @brief Class describing a constant in the select tree.
 *
 * @author Håkon Humberset
 * @date 2005-06-07
 */

#pragma once

#include "node.h"

namespace document::select {

class Constant : public Node
{
private:
    bool _value;

public:
    explicit Constant(bool value);

    ResultList contains(const Context&) const override {
        return ResultList(Result::get(_value));
    }

    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;
    bool getConstantValue() const noexcept { return _value; }
    Node::UP clone() const override { return wrapParens(new Constant(_value)); }

};

}