| 183 | * @brief Callback emitting a progress bar |
| 184 | */ |
| 185 | extern "C" void progress_emitter( |
| 186 | float value |
| 187 | ) { |
| 188 | const unsigned int bar_size = 25; |
| 189 | unsigned int parts = static_cast<int>(value / 4.0f); |
| 190 | |
| 191 | char buffer[bar_size + 3]; |
| 192 | buffer[0] = '['; |
| 193 | |
| 194 | for (unsigned int i = 0; i < parts; i++) |
| 195 | { |
| 196 | buffer[i + 1] = '='; |
| 197 | } |
| 198 | |
| 199 | for (unsigned int i = parts; i < bar_size; i++) |
| 200 | { |
| 201 | buffer[i + 1] = ' '; |
| 202 | } |
| 203 | |
| 204 | buffer[bar_size + 1] = ']'; |
| 205 | buffer[bar_size + 2] = '\0'; |
| 206 | |
| 207 | printf(" Progress: %s %03.1f%%\r", buffer, static_cast<double>(value)); |
| 208 | fflush(stdout); |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * @brief Test if a string argument is a well formed float. |
nothing calls this directly
no outgoing calls
no test coverage detected