aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/expression/strcatserializer.cpp
blob: 9ebf175f112415144195d7b75916774451e24b22 (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
42
43
44
45
46
47
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "strcatserializer.h"
#include "rawresultnode.h"
#include "resultvector.h"
#include <vespa/vespalib/stllike/asciistream.h>

namespace search::expression {

using vespalib::Serializer;
using vespalib::string;
using vespalib::stringref;

StrCatSerializer &  StrCatSerializer::put(const vespalib::Identifiable & value)
{
    if (value.inherits(ResultNode::classId)) {
        static_cast<const ResultNode &>(value).onSerializeResult(*this);
    } else {
        value.serializeDirect(*this);
    }
    return *this;
}

ResultSerializer &  StrCatSerializer::putResult(const ResultNodeVector & value)
{
    size_t sz(value.size());
    for (size_t i(0); i < sz; i++) {
        value.get(i).serialize(*this);
    }
    return *this;
}

ResultSerializer &  StrCatSerializer::putResult(const RawResultNode & value)
{
    vespalib::ConstBufferRef buf(value.get());
    getStream() << stringref(buf.c_str(), buf.size());
    return *this;
}

void  StrCatSerializer::proxyPut(const ResultNode & value)
{
    value.serializeDirect(*this);
}

}

// this function was added by ../../forcelink.sh
void forcelink_file_searchlib_expression_strcatserializer() {}