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

#include "annotationreferencefieldvalue.h"
#include <vespa/vespalib/util/xmlstream.h>
#include <ostream>

using std::ostream;
using std::string;

namespace document {

int AnnotationReferenceFieldValue::compare(const FieldValue &other) const {
    if (getDataType()->equals(*other.getDataType())) {
        const AnnotationReferenceFieldValue &val(static_cast<const AnnotationReferenceFieldValue &>(other));
        return _annotation_index - val._annotation_index;
    }
    return (getDataType()->getId() - other.getDataType()->getId());
}

void AnnotationReferenceFieldValue::print(ostream &out, bool, const string &) const {
    out << "AnnotationReferenceFieldValue(n)";
}

AnnotationReferenceFieldValue *AnnotationReferenceFieldValue::clone() const {
    return new AnnotationReferenceFieldValue(*this);
}

void AnnotationReferenceFieldValue::printXml(XmlOutputStream &out) const {
    out << _annotation_index;
}

}  // namespace document