|
Transfer Ease
|
Allow to store an array of bytes. More...
Public Member Functions | |
| BytesArray (size_t size) | |
| BytesArray (size_t size, Byte value) | |
| BytesArray (const std::initializer_list< Byte > &args) | |
| BytesArray (const BytesArray &other) | |
| BytesArray (BytesArray &&other) noexcept | |
| bool | isEmpty () const |
| std::size_t | getSize () const |
| std::size_t | getMaxSize () const |
| const Byte & | at (size_t index) const |
| std::string | toString () const |
| bool | toFile (const std::string &pathFile) const |
| Allow to export bytes array data to a file. | |
| void | reserve (size_t size) |
| Increase capacity of bytes array. | |
| void | resize (size_t size, Byte value=0) |
| void | pushBack (Byte value) |
| Append a value to the back of bytes array. | |
| void | pushBack (std::string_view strView) |
| void | pushBack (const Byte *buffer, size_t len) |
| void | popBack () |
| void | setFromString (std::string_view strView) |
| Allow to set bytes array from a string. | |
| bool | setFromFile (const std::string &pathFile) |
| Allow to set bytes array from file content. | |
| Byte * | data () |
| const Byte * | dataConst () const |
| void | clear () |
| iterator | begin () |
| const_iterator | cbegin () const |
| reverse_iterator | rbegin () |
| const_reverse_iterator | crbegin () const |
| iterator | end () |
| const_iterator | cend () const |
| reverse_iterator | rend () |
| const_reverse_iterator | crend () const |
| Byte & | operator[] (size_t index) |
| const Byte & | operator[] (size_t index) const |
| BytesArray & | operator= (const BytesArray &other) |
| BytesArray & | operator= (BytesArray &&other) noexcept |
Friends | |
| TEASE_EXPORT friend bool | operator== (const BytesArray &left, const BytesArray &right) |
| TEASE_EXPORT friend bool | operator!= (const BytesArray &left, const BytesArray &right) |
Allow to store an array of bytes.
| void tease::BytesArray::pushBack | ( | Byte | value | ) |
Append a value to the back of bytes array.
| [in] | value | Value to add |
| void tease::BytesArray::pushBack | ( | std::string_view | strView | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| [in] | strView | Append string to bytes array. |
| void tease::BytesArray::reserve | ( | size_t | size | ) |
Increase capacity of bytes array.
| [in] | size | Total number of elements that the bytes array can hold without requiring reallocation. If size is greater than getMaxSize(), new storage is allocated, otherwise the function does nothing (so no shrinking). |
| bool tease::BytesArray::setFromFile | ( | const std::string & | pathFile | ) |
Allow to set bytes array from file content.
This method will clear any previous data and load file content data into the bytes array.
| [in] | pathFile | Path to file to load. If file doesn't exist, method will returns false |
true if succeed.| void tease::BytesArray::setFromString | ( | std::string_view | strView | ) |
Allow to set bytes array from a string.
This method will simply clear() any previous data and append string bytes via pushBack() method.
| [in] | strView | String to use to set bytes array |
| bool tease::BytesArray::toFile | ( | const std::string & | pathFile | ) | const |
Allow to export bytes array data to a file.
| [in] | pathFile | Path to file to create. If file doesn't exists, method will automatically create it (and build needed folders). If file already exists, it will be truncated before writing to it. |
true if succeed.