aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/string/string_builder.cpp
blob: bca493fa3255675ba8976565f771664a5eda655b (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
#include "string_builder.h"

namespace NYT {

////////////////////////////////////////////////////////////////////////////////

TDelimitedStringBuilderWrapper::TDelimitedStringBuilderWrapper(
    TStringBuilderBase* builder,
    TStringBuf delimiter)
    : Builder_(builder)
    , Delimiter_(delimiter)
{ }

TStringBuilderBase* TDelimitedStringBuilderWrapper::operator->()
{
    return operator&();
}

TStringBuilderBase* TDelimitedStringBuilderWrapper::operator&()
{
    if (!FirstCall_) {
        Builder_->AppendString(Delimiter_);
    }
    FirstCall_ = false;
    return Builder_;
}

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT