/* * Copyright 2018 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef RTC_BASE_STRINGS_STRING_BUILDER_H_ #define RTC_BASE_STRINGS_STRING_BUILDER_H_ #include <cstdio> #include <string> #include <utility> #include "absl/strings/string_view.h" #include "api/array_view.h" #include "rtc_base/string_encode.h" namespace rtc { // This is a minimalistic string builder class meant to cover the most cases of // when you might otherwise be tempted to use a stringstream (discouraged for // anything except logging). It uses a fixed-size buffer provided by the caller // and concatenates strings and numbers into it, allowing the results to be // read via `str()`. class SimpleStringBuilder { … }; // A string builder that supports dynamic resizing while building a string. // The class is based around an instance of std::string and allows moving // ownership out of the class once the string has been built. // Note that this class uses the heap for allocations, so SimpleStringBuilder // might be more efficient for some use cases. class StringBuilder { … }; } // namespace rtc #endif // RTC_BASE_STRINGS_STRING_BUILDER_H_