summaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/datatype/primitivedatatype.h
blob: e3b105a8597c68f1ff30c7a4d42ed28f38b7198a (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
// Copyright 2016 Yahoo Inc. 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 <vespa/document/datatype/datatype.h>

namespace document {

class PrimitiveDataType : public DataType {
    virtual FieldPath::UP onBuildFieldPath(
            const vespalib::stringref & remainFieldName) const;
public:
    PrimitiveDataType(Type _type);

        // Implementation of DataType
    virtual std::unique_ptr<FieldValue> createFieldValue() const;
    virtual PrimitiveDataType* clone() const
        { return new PrimitiveDataType(*this); }
    virtual void print(std::ostream&, bool verbose, const std::string& indent) const;

    DECLARE_IDENTIFIABLE_ABSTRACT(PrimitiveDataType);
};

}