aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/datatype/primitivedatatype.h
blob: bd9e9786365992a05e69f1025c457f97f44b61a6 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * \class document::PrimitiveDataType
 * \ingroup datatype
 *
 * \brief Data type describing a primitive.
 *
 * This class describes a primitive data type. Normally you will not access
 * this class directly, you'll use the global datatypes created in DataType,
 * such as DataType::STRING and DataType::INT
 *
 * \todo Add a LiteralDataType subclass, such that this class can become
 *       abstract. Right now you can create a PrimitiveDataType object with
 *       a numeric type id, which is just plain wrong.
 */
#pragma once

#include "datatype.h"

namespace document {

class PrimitiveDataType : public DataType {
    void onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const override;
public:
    PrimitiveDataType(Type _type);

    std::unique_ptr<FieldValue> createFieldValue() const override;
    void print(std::ostream&, bool verbose, const std::string& indent) const override;

    bool isPrimitive() const noexcept override { return true; }
};

}