aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/print/configformatter.h
blob: acbe6d2cad22007efb1d46cc1f840ac2a8a684b6 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "configdatabuffer.h"

namespace config {

/**
 * Interface used by all config formatters. A config formatter is capable of
 * encoding and decoding into any kind of format that can be put into a string.
 */
class ConfigFormatter {
public:
    /**
     * Encode the slime object in a config data buffer, and put it into its
     * string.
     *
     * @param buffer A ConfigDataBuffer containing a slime object that should be
     *               encoded.
     */
    virtual void encode(ConfigDataBuffer & buffer) const = 0;

    /**
     * Decode a string in the config data buffer and populate its slime object.
     *
     * @param buffer A ConfigDataBuffer containing a string of the config.
     */
    virtual size_t decode(ConfigDataBuffer & buffer) const = 0;

    virtual ~ConfigFormatter() { }
};

} // namespace config