Port Scanner
Lightweight TCP port scanner for Linux
Loading...
Searching...
No Matches
printer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string_view>
4
5#include "types.hpp"
6
7namespace {
11std::string_view constexpr RESET{"\033[0m"};
12
16std::string_view constexpr RED{"\033[31m"};
17
21std::string_view constexpr GREEN{"\033[32m"};
22}
23
34class Printer final {
35 public:
43 [[nodiscard]] static bool isTerminal() noexcept;
44
53 static void print(std::vector<std::pair<port_t, bool>> const &ports);
54};
A utility class for printing formatted output to the terminal.
Definition printer.hpp:34
static void print(std::vector< std::pair< port_t, bool > > const &ports)
Prints to stdout the formated information about the ports accessibility.
Definition printer.cpp:11
static bool isTerminal() noexcept
Checks if stdout is connected to a terminal.
Definition printer.cpp:7
std::string_view constexpr RED
ANSI escape code for red text color.
Definition printer.hpp:16
std::string_view constexpr GREEN
ANSI escape code for green text color.
Definition printer.hpp:21
std::string_view constexpr RESET
ANSI escape code for resetting terminal colors.
Definition printer.hpp:11