# ProgressSignal

<a id="progresssignal"></a>

# ProgressSignal

```cpp
#include <icy/http/connection.h>

class ProgressSignal
```

[Defined in src/http/include/icy/http/connection.h:223](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/connection.h#L223)

> **Inherits:** [`Signal< void(const double &)>`](https://auscaster.com/icey/docs/api-reference/icy-Signal.md#signal)

HTTP progress signal for upload and download progress notifications.

Emits a double in the range [0, 100] as data is transferred. Set `total` to the expected byte count before calling [`update()`](#update-5).

## Public Attributes

| Return | Name | Description |
|--------|------|-------------|
| `void *` | [`sender`](#sender-1)  | Optional context pointer identifying the sender. |
| `uint64_t` | [`current`](#current-4)  | Bytes transferred so far. |
| `uint64_t` | [`total`](#total-1)  | Total expected bytes (from Content-Length). |

---

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

### sender

```cpp
void * sender
```

[Defined in src/http/include/icy/http/connection.h:226](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/connection.h#L226)

Optional context pointer identifying the sender.

---

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

### current

```cpp
uint64_t current
```

[Defined in src/http/include/icy/http/connection.h:227](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/connection.h#L227)

Bytes transferred so far.

---

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

### total

```cpp
uint64_t total
```

[Defined in src/http/include/icy/http/connection.h:228](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/connection.h#L228)

Total expected bytes (from Content-Length).

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`ProgressSignal`](#progresssignal-1) `inline` |  |
| `double` | [`progress`](#progress) `const` `inline` | Returns the current transfer progress as a percentage (0-100). |
| `void` | [`update`](#update-5) `inline` | Advances the progress counter by `nread` bytes and emits the updated percentage. |

---

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

### ProgressSignal

`inline`

```cpp
inline ProgressSignal()
```

[Defined in src/http/include/icy/http/connection.h:230](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/connection.h#L230)

---

<a id="progress"></a>

### progress

`const` `inline`

```cpp
inline double progress() const
```

[Defined in src/http/include/icy/http/connection.h:238](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/connection.h#L238)

Returns the current transfer progress as a percentage (0-100).

---

<a id="update-5"></a>

### update

`inline`

```cpp
inline void update(int nread)
```

[Defined in src/http/include/icy/http/connection.h:243](https://github.com/auscaster/icey/blob/main/src/http/include/icy/http/connection.h#L243)

Advances the progress counter by `nread` bytes and emits the updated percentage.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `nread` | `int` | Number of bytes just transferred. |

#### Exceptions

| Exception | Description |
|-----------|-------------|
| `std::runtime_error` | if current would exceed total. |
