blob: 42a60de058b12553a77f88dfd88e6e67c2a03346 (
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
40
41
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "annotation.h"
#include "spannode.h"
#include <vespa/document/fieldvalue/fieldvalue.h>
#include <vespa/document/util/bytebuffer.h>
#include <vespa/vespalib/stllike/asciistream.h>
namespace document {
std::ostream & operator << (std::ostream & os, const Annotation &annotation) {
return os << annotation.toString();
}
Annotation::~Annotation() = default;
vespalib::string
Annotation::toString() const {
vespalib::asciistream os;
os << "Annotation(" << *_type;
if (_value.get()) {
os << "\n";
os << _value->toString();
}
if (_node) {
os << "\n";
os << _node->toString();
}
os << ")";
return os.str();
}
bool
Annotation::operator==(const Annotation &a2) const {
return (getType() == a2.getType() &&
!(!!getFieldValue() ^ !!a2.getFieldValue()) &&
(!getFieldValue() || (*getFieldValue() == *a2.getFieldValue()))
);
}
} // namespace document
|