PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
console_utils.cpp File Reference

Implementation of console output utilities. More...

#include "console_utils.h"
#include <kcenon/pacs/core/dicom_tag_constants.h>
#include <kcenon/pacs/encoding/vr_type.h>
#include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <unistd.h>
Include dependency graph for console_utils.cpp:

Go to the source code of this file.

Namespaces

namespace  kcenon
 
namespace  kcenon::pacs
 
namespace  kcenon::pacs::samples
 

Functions

auto kcenon::pacs::samples::supports_color () noexcept -> bool
 Check if the terminal supports ANSI colors.
 
void kcenon::pacs::samples::set_color_enabled (bool enabled)
 Enable or disable color output globally.
 
auto kcenon::pacs::samples::is_color_enabled () noexcept -> bool
 Check if colors are currently enabled.
 
void kcenon::pacs::samples::print_header (std::string_view title)
 Print a header/title with decorative border.
 
void kcenon::pacs::samples::print_section (std::string_view title)
 Print a section header.
 
void kcenon::pacs::samples::print_success (std::string_view message)
 Print a success message.
 
void kcenon::pacs::samples::print_error (std::string_view message)
 Print an error message.
 
void kcenon::pacs::samples::print_warning (std::string_view message)
 Print a warning message.
 
void kcenon::pacs::samples::print_info (std::string_view message)
 Print an informational message.
 
void kcenon::pacs::samples::print_debug (std::string_view message)
 Print a debug message.
 
void kcenon::pacs::samples::print_dataset_summary (const core::dicom_dataset &ds)
 Print a summary of a DICOM dataset.
 
void kcenon::pacs::samples::print_dataset_elements (const core::dicom_dataset &ds, size_t max_value_length=60)
 Print all elements in a DICOM dataset.
 
void kcenon::pacs::samples::print_box (const std::vector< std::string > &lines)
 Print text in a decorative box.
 
void kcenon::pacs::samples::print_table (std::string_view title, const std::vector< std::pair< std::string, std::string > > &rows)
 Print a key-value table.
 
void kcenon::pacs::samples::print_progress (size_t current, size_t total, int width=40, std::string_view label="Progress")
 Print a progress bar.
 
void kcenon::pacs::samples::clear_line ()
 Clear the current line (for updating progress)
 
auto kcenon::pacs::samples::format_bytes (uint64_t bytes) -> std::string
 Format a byte size for human-readable display.
 
auto kcenon::pacs::samples::format_duration (uint64_t milliseconds) -> std::string
 Format a duration in milliseconds.
 
auto kcenon::pacs::samples::center_text (std::string_view text, size_t width) -> std::string
 Center a string within a given width.
 
auto kcenon::pacs::samples::truncate (std::string_view text, size_t max_length, std::string_view suffix="...") -> std::string
 Truncate a string to a maximum length.
 

Detailed Description

Implementation of console output utilities.

Definition in file console_utils.cpp.