Port Scanner
Lightweight TCP port scanner for Linux
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
Printer Class Referencefinal

A utility class for printing formatted output to the terminal. More...

#include <printer.hpp>

+ Collaboration diagram for Printer:

Static Public Member Functions

static bool isTerminal () noexcept
 Checks if stdout is connected to a terminal.
 
static void print (std::vector< std::pair< port_t, bool > > const &ports)
 Prints to stdout the formated information about the ports accessibility.
 

Detailed Description

A utility class for printing formatted output to the terminal.

The Printer class provides static methods to check if the output is a terminal and to print port status information with ANSI color formatting.

Definition at line 34 of file printer.hpp.

Member Function Documentation

◆ isTerminal()

bool Printer::isTerminal ( )
staticnoexcept

Checks if stdout is connected to a terminal.

Exception safety: No-throw guarantee.

Returns
true if output is a terminal, false otherwise.
Examples
printer.cpp.

Definition at line 7 of file printer.cpp.

+ Here is the caller graph for this function:

◆ print()

void Printer::print ( std::vector< std::pair< port_t, bool > > const &  ports)
static

Prints to stdout the formated information about the ports accessibility.

Exception safety: Basic guarantee.

Exceptions
std::bad_allocIf memory allocation for internal storage fails.
std::system_errorIf writing to stdout fails.
Examples
printer.cpp.

Definition at line 11 of file printer.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: