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

#include "serializer.h"
#include "deserializer.h"

namespace vespalib {

class asciistream;

class AsciiSerializer : public Serializer {
public:
    AsciiSerializer(asciistream &stream) : _stream(stream) { }
    AsciiSerializer &put(const IFieldBase &field, bool value) override;
    AsciiSerializer &put(const IFieldBase &field, uint8_t value) override;
    AsciiSerializer &put(const IFieldBase &field, uint16_t value) override;
    AsciiSerializer &put(const IFieldBase &field, uint32_t value) override;
    AsciiSerializer &put(const IFieldBase &field, uint64_t value) override;
    AsciiSerializer &put(const IFieldBase &field, float value) override;
    AsciiSerializer &put(const IFieldBase &field, double value) override;
    AsciiSerializer &put(const IFieldBase &field, stringref val) override;

    const asciistream &getStream() const { return _stream; }
    asciistream &getStream() { return _stream; }
private:
    asciistream &_stream;
};

}  // namespace vespalib