# MutableBuffer

<a id="mutablebuffer-6"></a>

# MutableBuffer

```cpp
#include <icy/buffer.h>

class MutableBuffer
```

[Defined in src/base/include/icy/buffer.h:40](https://github.com/auscaster/icey/blob/main/src/base/include/icy/buffer.h#L40)

The [MutableBuffer](#mutablebuffer-6) class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
| `constexpr` | [`MutableBuffer`](#mutablebuffer-7) `inline` `constexpr` | Construct an empty buffer. |
| `constexpr` | [`MutableBuffer`](#mutablebuffer-8) `inline` `constexpr` | Construct a buffer to represent the given memory range. |
| `constexpr void *` | [`data`](#data-3) `const` `inline` `constexpr` |  |
| `constexpr size_t` | [`size`](#size-4) `const` `inline` `constexpr` |  |
| `char *` | [`cstr`](#cstr-1) `const` `inline` | Cast the buffer as a char pointer. |
| `std::string` | [`str`](#str-2) `const` `inline` | Returns the buffer as a string. |

---

<a id="mutablebuffer-7"></a>

### MutableBuffer

`inline` `constexpr`

```cpp
constexpr inline constexpr MutableBuffer()
```

[Defined in src/base/include/icy/buffer.h:44](https://github.com/auscaster/icey/blob/main/src/base/include/icy/buffer.h#L44)

Construct an empty buffer.

---

<a id="mutablebuffer-8"></a>

### MutableBuffer

`inline` `constexpr`

```cpp
constexpr inline constexpr MutableBuffer(void * data, size_t size)
```

[Defined in src/base/include/icy/buffer.h:51](https://github.com/auscaster/icey/blob/main/src/base/include/icy/buffer.h#L51)

Construct a buffer to represent the given memory range.

---

<a id="data-3"></a>

### data

`const` `inline` `constexpr`

```cpp
constexpr inline constexpr void * data() const
```

[Defined in src/base/include/icy/buffer.h:57](https://github.com/auscaster/icey/blob/main/src/base/include/icy/buffer.h#L57)

---

<a id="size-4"></a>

### size

`const` `inline` `constexpr`

```cpp
constexpr inline constexpr size_t size() const
```

[Defined in src/base/include/icy/buffer.h:58](https://github.com/auscaster/icey/blob/main/src/base/include/icy/buffer.h#L58)

---

<a id="cstr-1"></a>

### cstr

`const` `inline`

```cpp
inline char * cstr() const
```

[Defined in src/base/include/icy/buffer.h:61](https://github.com/auscaster/icey/blob/main/src/base/include/icy/buffer.h#L61)

Cast the buffer as a char pointer.

---

<a id="str-2"></a>

### str

`const` `inline`

```cpp
inline std::string str() const
```

[Defined in src/base/include/icy/buffer.h:64](https://github.com/auscaster/icey/blob/main/src/base/include/icy/buffer.h#L64)

Returns the buffer as a string.

## Protected Attributes

| Return | Name | Description |
|--------|------|-------------|
| `void *` | [`_data`](#_data-1)  |  |
| `size_t` | [`_size`](#_size-1)  |  |

---

<a id="_data-1"></a>

### _data

```cpp
void * _data
```

[Defined in src/base/include/icy/buffer.h:67](https://github.com/auscaster/icey/blob/main/src/base/include/icy/buffer.h#L67)

---

<a id="_size-1"></a>

### _size

```cpp
size_t _size
```

[Defined in src/base/include/icy/buffer.h:68](https://github.com/auscaster/icey/blob/main/src/base/include/icy/buffer.h#L68)
