|
OpenTTD Source 20260218-master-g2123fca5ea
|
Builder implementation for InPlaceReplacement. More...
#include <string_inplace.hpp>
Data Structures | |
| class | back_insert_iterator |
| Implementation of std::back_insert_iterator for non-growing destination buffer. More... | |
Public Member Functions | |
| InPlaceBuilder (const InPlaceBuilder &)=delete | |
| InPlaceBuilder & | operator= (const InPlaceBuilder &)=delete |
| bool | AnyBytesWritten () const noexcept |
| Check whether any bytes have been written. | |
| size_type | GetBytesWritten () const noexcept |
| Get number of already written bytes. | |
| std::string_view | GetWrittenData () const noexcept |
| Get already written data. | |
| bool | AnyBytesUnused () const noexcept |
| Check whether any unused bytes are left between the Builder and Consumer position. | |
| size_type | GetBytesUnused () const noexcept |
| Get number of unused bytes left between the Builder and Consumer position. | |
| void | PutBuffer (std::span< const char > str) override |
| Append buffer. | |
| back_insert_iterator | back_inserter () |
| Create a back-insert-iterator. | |
| Public Member Functions inherited from BaseStringBuilder | |
| void | Put (std::string_view str) |
| Append string. | |
| void | PutUint8 (uint8_t value) |
| Append binary uint8. | |
| void | PutSint8 (int8_t value) |
| Append binary int8. | |
| void | PutUint16LE (uint16_t value) |
| Append binary uint16 using little endian. | |
| void | PutSint16LE (int16_t value) |
| Append binary int16 using little endian. | |
| void | PutUint32LE (uint32_t value) |
| Append binary uint32 using little endian. | |
| void | PutSint32LE (int32_t value) |
| Append binary int32 using little endian. | |
| void | PutUint64LE (uint64_t value) |
| Append binary uint64 using little endian. | |
| void | PutSint64LE (int64_t value) |
| Append binary int64 using little endian. | |
| void | PutChar (char c) |
| Append 8-bit char. | |
| void | PutUtf8 (char32_t c) |
| Append UTF-8 char. | |
| template<class T> | |
| void | PutIntegerBase (T value, int base) |
| Append integer 'value' in given number 'base'. | |
Private Member Functions | |
| InPlaceBuilder (std::span< char > dest, const StringConsumer &consumer) | |
| Create this builder. | |
| InPlaceBuilder (const InPlaceBuilder &src, const StringConsumer &consumer) | |
| Create this builder based on an existing builder's buffer. | |
| void | AssignBuffer (const InPlaceBuilder &src) |
| Copy assignment of the buffer and its position. | |
Private Attributes | |
| std::span< char > | dest |
| The buffer to process. | |
| size_type | position = 0 |
| The location to write to. | |
| const StringConsumer & | consumer |
| The string consumer to read with. | |
Friends | |
| class | InPlaceReplacement |
Additional Inherited Members | |
| Public Types inherited from BaseStringBuilder | |
| using | size_type = std::string_view::size_type |
| The type of the size of our strings. | |
Builder implementation for InPlaceReplacement.
Definition at line 19 of file string_inplace.hpp.
|
inlineexplicitprivate |
Create this builder.
Definition at line 31 of file string_inplace.hpp.
References consumer, and dest.
Referenced by AssignBuffer(), InPlaceBuilder::back_insert_iterator::back_insert_iterator(), and InPlaceBuilder().
|
inlineprivate |
Create this builder based on an existing builder's buffer.
| src | The existing builder to use the buffer from. |
| consumer | The consumer to read with. |
Definition at line 38 of file string_inplace.hpp.
References consumer, dest, InPlaceBuilder(), and position.
|
nodiscardnoexcept |
Check whether any unused bytes are left between the Builder and Consumer position.
true iff the number of bytes read from the consumer is bigger than the number of bytes written to this builder. Definition at line 18 of file string_inplace.cpp.
References consumer, and position.
Referenced by StrMakeValidInPlace().
|
inlinenodiscardnoexcept |
Check whether any bytes have been written.
true if any bytes were written. Definition at line 53 of file string_inplace.hpp.
|
inlineprivate |
Copy assignment of the buffer and its position.
| src | The builder to copy the information from. |
Definition at line 44 of file string_inplace.hpp.
References dest, InPlaceBuilder(), and position.
|
inline |
Create a back-insert-iterator.
Definition at line 102 of file string_inplace.hpp.
|
nodiscardnoexcept |
Get number of unused bytes left between the Builder and Consumer position.
Definition at line 27 of file string_inplace.cpp.
References consumer, and position.
Referenced by PutBuffer().
|
inlinenodiscardnoexcept |
Get number of already written bytes.
Definition at line 58 of file string_inplace.hpp.
Referenced by StrMakeValidInPlace().
|
inlinenodiscardnoexcept |
Get already written data.
Definition at line 63 of file string_inplace.hpp.
|
overridevirtual |
Append buffer.
| str | The string to add to the buffer. |
Implements BaseStringBuilder.
Definition at line 36 of file string_inplace.cpp.
References dest, GetBytesUnused(), and position.
|
friend |
Definition at line 24 of file string_inplace.hpp.
|
private |
The string consumer to read with.
Definition at line 22 of file string_inplace.hpp.
Referenced by AnyBytesUnused(), GetBytesUnused(), InPlaceBuilder(), and InPlaceBuilder().
|
private |
The buffer to process.
Definition at line 20 of file string_inplace.hpp.
Referenced by AssignBuffer(), InPlaceBuilder(), InPlaceBuilder(), and PutBuffer().
|
private |
The location to write to.
Definition at line 21 of file string_inplace.hpp.
Referenced by AnyBytesUnused(), AssignBuffer(), GetBytesUnused(), InPlaceBuilder(), and PutBuffer().