aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/util/printable.cpp
blob: 608235d8791bad01bd748d599df49410e517731d (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "printable.h"
#include <sstream>

namespace document {

std::string Printable::toString(bool verbose, const std::string& indent) const
{
    std::ostringstream o;
    print(o, verbose, indent);
    return o.str();
}

void Printable::print(std::ostream& out) const {
    print(out, false, "");
}
void Printable::print(std::ostream& out, bool verbose) const {
    print(out, verbose, "");
}
void Printable::print(std::ostream& out, const std::string& indent) const {
    print(out, false, indent);
}

std::ostream& operator<<(std::ostream& out, const Printable& p) {
    p.print(out, false, "");
    return out;
}

}