summaryrefslogtreecommitdiffstats
path: root/util/stream/str.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <[email protected]>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/stream/str.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
Restoring authorship annotation for Anton Samokhvalov <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/stream/str.cpp')
-rw-r--r--util/stream/str.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/util/stream/str.cpp b/util/stream/str.cpp
index 13f0e8ef289..3be3435db5d 100644
--- a/util/stream/str.cpp
+++ b/util/stream/str.cpp
@@ -1,9 +1,9 @@
-#include "str.h"
-
+#include "str.h"
+
static constexpr size_t MIN_BUFFER_GROW_SIZE = 16;
TStringInput::~TStringInput() = default;
-
+
size_t TStringInput::DoNext(const void** ptr, size_t len) {
len = Min(len, S_->size() - Pos_);
*ptr = S_->data() + Pos_;
@@ -17,28 +17,28 @@ void TStringInput::DoUndo(size_t len) {
}
TStringOutput::~TStringOutput() = default;
-
+
size_t TStringOutput::DoNext(void** ptr) {
- if (S_->size() == S_->capacity()) {
- S_->reserve(FastClp2(S_->capacity() + MIN_BUFFER_GROW_SIZE));
+ if (S_->size() == S_->capacity()) {
+ S_->reserve(FastClp2(S_->capacity() + MIN_BUFFER_GROW_SIZE));
}
- size_t previousSize = S_->size();
- ResizeUninitialized(*S_, S_->capacity());
- *ptr = S_->begin() + previousSize;
- return S_->size() - previousSize;
+ size_t previousSize = S_->size();
+ ResizeUninitialized(*S_, S_->capacity());
+ *ptr = S_->begin() + previousSize;
+ return S_->size() - previousSize;
}
void TStringOutput::DoUndo(size_t len) {
- Y_VERIFY(len <= S_->size(), "trying to undo more bytes than actually written");
- S_->resize(S_->size() - len);
-}
-
-void TStringOutput::DoWrite(const void* buf, size_t len) {
- S_->append((const char*)buf, len);
+ Y_VERIFY(len <= S_->size(), "trying to undo more bytes than actually written");
+ S_->resize(S_->size() - len);
}
+void TStringOutput::DoWrite(const void* buf, size_t len) {
+ S_->append((const char*)buf, len);
+}
+
void TStringOutput::DoWriteC(char c) {
- S_->push_back(c);
+ S_->push_back(c);
}
TStringStream::~TStringStream() = default;