blob: ceefe24ac0e71875f7168a372237301c92b28738 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "asciiconfigwriter.h"
#include "fileconfigformatter.h"
namespace config {
AsciiConfigWriter::AsciiConfigWriter(vespalib::asciistream & os)
: _os(os)
{
}
bool
AsciiConfigWriter::write(const ConfigInstance & config)
{
return write(config, FileConfigFormatter());
}
bool
AsciiConfigWriter::write(const ConfigInstance & config, const ConfigFormatter & formatter)
{
ConfigDataBuffer buffer;
config.serialize(buffer);
formatter.encode(buffer);
_os << buffer.getEncodedString();
return !_os.fail();
}
} // namespace config
|