Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions internal/tlcodegen/helpers_cpp_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ namespace basictl {

tl_istream::tl_istream(tl_throwable_istream &from) : provider(nullptr) {
from.pass_data(*this);
this->sync_in_destructor = false;
}

bool tl_istream::string_read(std::string &value) noexcept {
Expand Down Expand Up @@ -362,6 +363,7 @@ namespace basictl {

tl_ostream::tl_ostream(tl_throwable_ostream &from) : provider(nullptr) {
from.pass_data(*this);
this->sync_in_destructor = false;
}

bool tl_ostream::string_write(const std::string &value) {
Expand Down Expand Up @@ -544,7 +546,7 @@ namespace basictl {

tl_istream &operator=(tl_istream &&) = delete;

~tl_istream() { sync(); };
~tl_istream() { if (sync_in_destructor) sync(); };

friend class tl_throwable_istream;

Expand Down Expand Up @@ -652,6 +654,8 @@ namespace basictl {
const std::byte *ptr{};
const std::byte *end_block{};

bool sync_in_destructor = true;

void grow_buffer() noexcept;

bool ensure_byte() noexcept;
Expand Down Expand Up @@ -681,7 +685,7 @@ namespace basictl {

tl_ostream &operator=(tl_ostream &&) = delete;

~tl_ostream() { sync(); };
~tl_ostream() { if (this->sync_in_destructor) sync(); };

friend class tl_throwable_ostream;

Expand Down Expand Up @@ -764,6 +768,8 @@ namespace basictl {
std::byte *ptr{};
std::byte *end_block{};

bool sync_in_destructor = true;

void grow_buffer();

bool store_data(const void *vdata, size_t size);
Expand Down
2 changes: 2 additions & 0 deletions pkg/basictl_cpp/io_streams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace basictl {

tl_istream::tl_istream(tl_throwable_istream &from) : provider(nullptr) {
from.pass_data(*this);
this->sync_in_destructor = false;
}

bool tl_istream::string_read(std::string &value) noexcept {
Expand Down Expand Up @@ -197,6 +198,7 @@ namespace basictl {

tl_ostream::tl_ostream(tl_throwable_ostream &from) : provider(nullptr) {
from.pass_data(*this);
this->sync_in_destructor = false;
}

bool tl_ostream::string_write(const std::string &value) {
Expand Down
8 changes: 6 additions & 2 deletions pkg/basictl_cpp/io_streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace basictl {

tl_istream &operator=(tl_istream &&) = delete;

~tl_istream() { sync(); };
~tl_istream() { if (sync_in_destructor) sync(); };

friend class tl_throwable_istream;

Expand Down Expand Up @@ -132,6 +132,8 @@ namespace basictl {
const std::byte *ptr{};
const std::byte *end_block{};

bool sync_in_destructor = true;

void grow_buffer() noexcept;

bool ensure_byte() noexcept;
Expand Down Expand Up @@ -161,7 +163,7 @@ namespace basictl {

tl_ostream &operator=(tl_ostream &&) = delete;

~tl_ostream() { sync(); };
~tl_ostream() { if (this->sync_in_destructor) sync(); };

friend class tl_throwable_ostream;

Expand Down Expand Up @@ -244,6 +246,8 @@ namespace basictl {
std::byte *ptr{};
std::byte *end_block{};

bool sync_in_destructor = true;

void grow_buffer();

bool store_data(const void *vdata, size_t size);
Expand Down
Loading