Initial Course
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "constructors.hpp"
|
||||
|
||||
namespace oop {
|
||||
|
||||
StringBuilder::StringBuilder(std::string initial) {
|
||||
// TODO: Initialize buffer_ from initial
|
||||
(void)initial;
|
||||
}
|
||||
|
||||
StringBuilder::StringBuilder(const StringBuilder& other) : buffer_(other.buffer_) {}
|
||||
|
||||
auto StringBuilder::operator=(const StringBuilder& other) -> StringBuilder& {
|
||||
if (this != &other) {
|
||||
buffer_ = other.buffer_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void StringBuilder::append(const std::string& text) {
|
||||
// TODO: Append all characters from text
|
||||
(void)text;
|
||||
}
|
||||
|
||||
auto StringBuilder::str() const -> std::string {
|
||||
return std::string(buffer_.begin(), buffer_.end());
|
||||
}
|
||||
|
||||
auto StringBuilder::size() const -> std::size_t { return buffer_.size(); }
|
||||
|
||||
} // namespace oop
|
||||
Reference in New Issue
Block a user