summaryrefslogtreecommitdiffstats
path: root/messagebus/src/vespa/messagebus/routing/policydirective.cpp
blob: c14421e7424f319d5ceedcec8a9372229f9fc463 (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
// Copyright 2016 Yahoo Inc. 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>

namespace mbus {

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

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

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

} // mbus