aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/print/configwriter.h
blob: d3c3101e43ed7c982b127aec6449e8931d408a9f (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 <vespa/config/configgen/configinstance.h>
#include "configformatter.h"

namespace config {

/**
 * Interface for classes capable of writing a config instance somewhere.
 */
class ConfigWriter {
public:
    /**
     * Write this config instance to a place decided by the implementer of this
     * class.
     *
     * @param config The config instance to write.
     */
    virtual bool write(const ConfigInstance & config) = 0;

    /**
     * Write this config instance to a place decided by the implementer of this
     * class. The provided formatter decides the format of the output.
     *
     * @param config The config instance to write.
     * @param formatter The config formatter to use for formatting config.
     */
    virtual bool write(const ConfigInstance & config, const ConfigFormatter & formatter) = 0;
    virtual ~ConfigWriter() { }
};

} // namespace config