Some concept definitions, descriptions, etc. of the library.
More...
#include <concepts>
#include <unistd.h>
Go to the source code of this file.
|
| namespace | Helper |
| | Main namespace of libhelper library.
|
| |
|
|
#define | HELPER "libhelper" |
| | Name shorcut for logging.
|
| |
| #define | B(x) (static_cast<uint64_t(x)> * 8) |
| | Take x byte as bits.
|
| |
| #define | KB(x) (static_cast<uint64_t>(x) * 1024) |
| | Take x kilobyte as bytes.
|
| |
| #define | MB(x) (KB(x) * 1024) |
| | Take x megabyte as bytes.
|
| |
| #define | GB(x) (MB(x) * 1024) |
| | Take x gigabyte as bytes.
|
| |
| #define | TO_KB(x) (x / 1024) |
| | Convert x byte to kilobyte.
|
| |
| #define | TO_MB(x) (TO_KB(x) / 1024) |
| | Convert x byte to megabyte.
|
| |
| #define | TO_GB(x) (TO_MB(x) / 1024) |
| | Convert x byte to gigabyte.
|
| |
| #define | ABORT(msg) |
| |
| #define | ERROR(msg, code) |
| |
|
#define | WARNING(msg) fprintf(stderr, "%s%sWARNING%s: %s", BOLD, YELLOW, STYLE_RESET, msg); |
| |
|
#define | INFO(msg) fprintf(stdout, "%s%sINFO%s: %s", BOLD, GREEN, STYLE_RESET, msg); |
| |
| #define | MKVERSION(name) |
| | Generate version string and return.
|
| |
|
Macros for text formatting in ANSI-compatible terminals.
|
|
#define | STYLE_RESET "\033[0m" |
| | Resets all formatting to default.
|
| |
|
#define | BOLD "\033[1m" |
| | Makes the text bold or high intensity.
|
| |
|
#define | FAINT "\033[2m" |
| | Makes the text faint (dimmed).
|
| |
|
#define | ITALIC "\033[3m" |
| | Italicizes the text (not supported by all terminals).
|
| |
|
#define | UNDERLINE "\033[4m" |
| | Draws a line under the text.
|
| |
|
#define | BLINC "\033[5m" |
| | Slow blink (less than 150 per minute).
|
| |
|
#define | FAST_BLINC "\033[6m" |
| | Rapid blink (not widely supported).
|
| |
|
#define | STRIKE_THROUGHT "\033[9m" |
| | Draws a line through the text.
|
| |
|
#define | NO_UNDERLINE "\033[24m" |
| | Disables underlining.
|
| |
|
#define | NO_BLINC "\033[25m" |
| | Disables blinking.
|
| |
|
Macros for foreground (text) and background coloring.
|
|
#define | BLACK "\033[30m" |
| | Black text.
|
| |
|
#define | RED "\033[31m" |
| | Red text.
|
| |
|
#define | GREEN "\033[32m" |
| | Green text.
|
| |
|
#define | YELLOW "\033[33m" |
| | Yellow text.
|
| |
|
#define | BLUE "\033[34m" |
| | Blue text.
|
| |
|
#define | MAGENTA "\033[35m" |
| | Magenta (Purple) text.
|
| |
|
#define | CYAN "\033[36m" |
| | Cyan (Light Blue) text.
|
| |
|
#define | WHITE "\033[37m" |
| | White text.
|
| |
|
#define | BRIGHT_BLACK "\033[90m" |
| | Bright Black (Gray) text.
|
| |
|
#define | BRIGHT_RED "\033[91m" |
| | Bright Red text.
|
| |
|
#define | BRIGHT_GREEN "\033[92m" |
| | Bright Green text.
|
| |
|
#define | BRIGHT_YELLOW "\033[93m" |
| | Bright Yellow text.
|
| |
|
#define | BRIGHT_BLUE "\033[94m" |
| | Bright Blue text.
|
| |
|
#define | BRIGHT_MAGENTA "\033[95m" |
| | Bright Magenta text.
|
| |
|
#define | BRIGHT_CYAN "\033[96m" |
| | Bright Cyan text.
|
| |
|
#define | BRIGHT_WHITE "\033[97m" |
| | Bright White text.
|
| |
|
#define | BG_BLACK "\033[40m" |
| | Black background.
|
| |
|
#define | BG_RED "\033[41m" |
| | Red background.
|
| |
|
#define | BG_GREEN "\033[42m" |
| | Green background.
|
| |
|
#define | BG_YELLOW "\033[43m" |
| | Yellow background.
|
| |
|
#define | BG_BLUE "\033[44m" |
| | Blue background.
|
| |
|
#define | BG_MAGENTA "\033[45m" |
| | Magenta background.
|
| |
|
#define | BG_CYAN "\033[46m" |
| | Cyan background.
|
| |
|
#define | BG_WHITE "\033[47m" |
| | White background.
|
| |
|
| enum | sizeCastTypes { B = static_cast<int>('B')
, KB = static_cast<int>('K')
, MB = static_cast<int>('M')
, GB = static_cast<int>('G')
} |
| | Short names used in dimension type conversions.
|
| |
|
|
constexpr mode_t | DEFAULT_FILE_PERMS = 0644 |
| | Default file permissions.
|
| |
|
constexpr mode_t | DEFAULT_EXTENDED_FILE_PERMS = 0755 |
| | Extended file permissions (using by executables etc).
|
| |
|
constexpr mode_t | DEFAULT_DIR_PERMS = 0755 |
| | Default directory permissions.
|
| |
|
constexpr int | YES = 1 |
| | Alternative of true.
|
| |
|
constexpr int | NO = 0 |
| | Alternative of false.
|
| |
Some concept definitions, descriptions, etc. of the library.
- Author
- Yağız Zengin (YZBruh)
◆ ABORT
Value: do { \
fprintf(stderr,
"%s%sCRITICAL ERROR%s: %s\nAborting...\n",
BOLD,
RED,
STYLE_RESET, msg); \
abort(); \
} while (0)
#define STYLE_RESET
Resets all formatting to default.
Definition definations.hpp:232
#define BOLD
Makes the text bold or high intensity.
Definition definations.hpp:233
#define RED
Red text.
Definition definations.hpp:252
| #define B |
( |
|
x | ) |
(static_cast<uint64_t(x)> * 8) |
Take x byte as bits.
#define B(x)
Take x byte as bits.
Definition definations.hpp:159
- Parameters
-
◆ ERROR
| #define ERROR |
( |
|
msg, |
|
|
|
code |
|
) |
| |
Value: do { \
exit(code); \
} while (0)
◆ GB
| #define GB |
( |
|
x | ) |
(MB(x) * 1024) |
Take x gigabyte as bytes.
#define GB(x)
Take x gigabyte as bytes.
Definition definations.hpp:192
- Parameters
-
◆ KB
| #define KB |
( |
|
x | ) |
(static_cast<uint64_t>(x) * 1024) |
Take x kilobyte as bytes.
#define KB(x)
Take x kilobyte as bytes.
Definition definations.hpp:170
- Parameters
-
◆ MB
| #define MB |
( |
|
x | ) |
(KB(x) * 1024) |
Take x megabyte as bytes.
#define MB(x)
Take x megabyte as bytes.
Definition definations.hpp:181
- Parameters
-
◆ MKVERSION
| #define MKVERSION |
( |
|
name | ) |
|
Value: char vinfo[512]; \
sprintf(vinfo, \
"%s %s-%s [%s %s]\nBuild type: %s\nCMake version: %s\nCompiler version: " \
"%s\nCompiler flags: %s", \
name, BUILD_VERSION, COMMIT_ID, BUILD_DATE, BUILD_TIME, BUILD_TYPE, BUILD_CMAKE_VERSION, BUILD_COMPILER_VERSION, \
BUILD_FLAGS); \
Generate version string and return.
#define MKVERSION(name)
Generate version string and return.
Definition definations.hpp:313
- Parameters
-
- Note
- This is a complete function body!!!
◆ TO_GB
| #define TO_GB |
( |
|
x | ) |
(TO_MB(x) / 1024) |
Convert x byte to gigabyte.
uint32_t size =
TO_GB(1048576);
#define TO_GB(x)
Convert x byte to gigabyte.
Definition definations.hpp:225
- Parameters
-
◆ TO_KB
| #define TO_KB |
( |
|
x | ) |
(x / 1024) |
Convert x byte to kilobyte.
uint32_t size =
TO_KB(1024);
#define TO_KB(x)
Convert x byte to kilobyte.
Definition definations.hpp:203
- Parameters
-
◆ TO_MB
| #define TO_MB |
( |
|
x | ) |
(TO_KB(x) / 1024) |
Convert x byte to megabyte.
uint32_t size =
TO_KB(2048);
- Parameters
-