aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus/src/vespa/messagebus/routing/policydirective.cpp
blob: 1d8f58def284c60d12c080eba53f7b36c50885df (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "policydirective.h"
#include <vespa/vespalib/util/stringfmt.h>

using vespalib::make_string;

namespace mbus {

PolicyDirective::PolicyDirective(vespalib::stringref name, vespalib::stringref param) :
    _name(name),
    _param(param)
{ }

PolicyDirective::~PolicyDirective() {}

string
PolicyDirective::toString() const
{
    if (_param.empty()) {
        return make_string("[%s]", _name.c_str());
    }
    return make_string("[%s:%s]", _name.c_str(), _param.c_str());
}

string
PolicyDirective::toDebugString() const
{
    return make_string("PolicyDirective(name = '%s', param = '%s')", _name.c_str(), _param.c_str());
}

} // mbus