summaryrefslogtreecommitdiffstats
path: root/staging_vespalib/src/vespa/vespalib/objects/fieldbase.h
blob: 2de113f83831ba344aa5028e898472984c2976bd (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/stllike/string.h>

namespace vespalib {

class IFieldBase
{
public:
    virtual ~IFieldBase() = default;
    // Overrides must guarantee that returned reference is zero-terminated.
    virtual stringref getName() const = 0;
};

class FieldBase : public IFieldBase
{
public:
    FieldBase(stringref name) : _name(name) { }
    stringref getName() const final override { return _name; }
private:
    string _name;
};

class SerializerCommon
{
protected:
    static FieldBase _unspecifiedField;
    static FieldBase _sizeField;
};

}