25 lines
534 B
C++
25 lines
534 B
C++
#pragma once
|
|||
|
|
|
||
|
|
#include <string>
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
namespace oop {
|
||
|
|
|
||
|
|
class StringBuilder {
|
||
|
|
public:
|
||
|
|
StringBuilder() = default;
|
||
|
|
explicit StringBuilder(std::string initial);
|
||
|
|
StringBuilder(const StringBuilder& other);
|
||
|
|
auto operator=(const StringBuilder& other) -> StringBuilder&;
|
||
|
|
~StringBuilder() = default;
|
||
|
|
|
||
|
|
void append(const std::string& text);
|
||
|
|
[[nodiscard]] auto str() const -> std::string;
|
||
|
|
[[nodiscard]] auto size() const -> std::size_t;
|
||
|
|
|
||
|
|
private:
|
||
|
|
std::vector<char> buffer_;
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace oop
|