| 274 | //------------------------------------------------------------------------------ |
| 275 | |
| 276 | bool OptionHandler::convertWaveformData( |
| 277 | const boost::filesystem::path& input_filename, |
| 278 | const FileFormat::FileFormat input_format, |
| 279 | const boost::filesystem::path& output_filename, |
| 280 | const FileFormat::FileFormat output_format, |
| 281 | const Options& options) |
| 282 | { |
| 283 | WaveformBuffer buffer; |
| 284 | |
| 285 | if (!loadWaveformData(buffer, input_filename, input_format)) { |
| 286 | return false; |
| 287 | } |
| 288 | |
| 289 | const int bits = options.hasBits() ? options.getBits() : buffer.getBits(); |
| 290 | |
| 291 | bool success = true; |
| 292 | |
| 293 | const boost::filesystem::path output_file_ext = output_filename.extension(); |
| 294 | |
| 295 | if (output_format == FileFormat::Dat) { |
| 296 | success = buffer.save(output_filename.string().c_str(), bits); |
| 297 | } |
| 298 | else if (output_format == FileFormat::Json) { |
| 299 | success = buffer.saveAsJson(output_filename.string().c_str(), bits); |
| 300 | } |
| 301 | else if (output_format == FileFormat::Txt) { |
| 302 | success = buffer.saveAsText(output_filename.string().c_str(), bits); |
| 303 | } |
| 304 | |
| 305 | return success; |
| 306 | } |
| 307 | |
| 308 | //------------------------------------------------------------------------------ |
| 309 |
nothing calls this directly
no test coverage detected