xref: /aosp_15_r20/external/libwebm/common/indent.cc (revision 103e46e4cd4b6efcf6001f23fa8665fb110abf8d)
1 /*
2  *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "common/indent.h"
12 
13 #include <string>
14 
15 namespace libwebm {
16 
Indent(int indent)17 Indent::Indent(int indent) : indent_(indent), indent_str_() { Update(); }
18 
Adjust(int indent)19 void Indent::Adjust(int indent) {
20   indent_ += indent;
21   if (indent_ < 0)
22     indent_ = 0;
23 
24   Update();
25 }
26 
Update()27 void Indent::Update() { indent_str_ = std::string(indent_, ' '); }
28 
29 }  // namespace libwebm
30