| 1 | #cxx . . $ `<file>/application/commandlineutils.h`/ifndef APPLICATION_UTILITIES_COMMANDLINEUTILS_H |
| 2 | #define APPLICATION_UTILITIES_COMMANDLINEUTILS_Hcxx . . $ `application/commandlineutils.h:2:9`! |
| 3 | |
| 4 | #include "../global.h"cxx . . $ `<file>/global.h`/ |
| 5 | |
| 6 | #include <optional> |
| 7 | #include <ostream> |
| 8 | |
| 9 | #ifdef PLATFORM_WINDOWS |
| 10 | #include <memory> |
| 11 | #include <vector> |
| 12 | #endif |
| 13 | |
| 14 | namespace CppUtilitiescxx . . $ CppUtilities/ { |
| 15 | |
| 16 | /*! |
| 17 | * \brief The Response enum is used to specify the default response for the confirmPrompt() method. |
| 18 | */ |
| 19 | enum class Responsecxx . . $ CppUtilities/Response# { Nonecxx . . $ CppUtilities/Response#None., Yescxx . . $ CppUtilities/Response#Yes., Nocxx . . $ CppUtilities/Response#No. }; |
| 20 | |
| 21 | CPP_UTILITIES_EXPORTcxx . . $ `global.h:11:9`! bool confirmPromptcxx . . $ CppUtilities/confirmPrompt(a14cc891a4ae6fa4).(const char *message, Responsecxx . . $ CppUtilities/Response# defaultResponse = Responsecxx . . $ CppUtilities/Response#::Nonecxx . . $ CppUtilities/Response#None.); |
| 22 | CPP_UTILITIES_EXPORTcxx . . $ `global.h:11:9`! stdcxx . . $ std/::optionalcxx . . $ std/optional#<bool> isEnvVariableSetcxx . . $ CppUtilities/isEnvVariableSet(398a73c3631942a).(const char *variableName); |
| 23 | |
| 24 | #ifdef PLATFORM_WINDOWS |
| 25 | CPP_UTILITIES_EXPORT bool handleVirtualTerminalProcessing(); |
| 26 | CPP_UTILITIES_EXPORT void startConsole(); |
| 27 | CPP_UTILITIES_EXPORT std::pair<std::vector<std::unique_ptr<char[]>>, std::vector<char *>> convertArgsToUtf8(); |
| 28 | #define CMD_UTILS_START_CONSOLE ::CppUtilities::startConsole(); |
| 29 | #define CMD_UTILS_CONVERT_ARGS_TO_UTF8 \ |
| 30 | auto utf8Args = ::CppUtilities::convertArgsToUtf8(); \ |
| 31 | argv = utf8Args.second.data(); \ |
| 32 | argc = static_cast<int>(utf8Args.second.size()); |
| 33 | #define CMD_UTILS_HANDLE_VIRTUAL_TERMINAL_PROCESSING ::CppUtilities::handleVirtualTerminalProcessing(); |
| 34 | #else |
| 35 | #define CMD_UTILS_START_CONSOLEcxx . . $ `application/commandlineutils.h:35:9`! |
| 36 | #define CMD_UTILS_CONVERT_ARGS_TO_UTF8cxx . . $ `application/commandlineutils.h:36:9`! |
| 37 | #define CMD_UTILS_HANDLE_VIRTUAL_TERMINAL_PROCESSINGcxx . . $ `application/commandlineutils.h:37:9`! |
| 38 | #endif |
| 39 | |
| 40 | /*! |
| 41 | * \brief The TerminalSize struct describes a terminal size. |
| 42 | * \remarks The same as the winsize structure is defined in `sys/ioctl.h`. |
| 43 | * \sa determineTerminalSize() |
| 44 | */ |
| 45 | struct TerminalSizecxx . . $ CppUtilities/TerminalSize# { |
| 46 | TerminalSizecxx . . $ CppUtilities/TerminalSize#TerminalSize(65f460a0b618e919).(unsigned short rows = 0, unsigned short columns = 0, unsigned short width = 0, unsigned short height = 0); |
| 47 | |
| 48 | /// \brief number of rows |
| 49 | unsigned short rowscxx . . $ CppUtilities/TerminalSize#rows.; |
| 50 | /// \brief number of columns |
| 51 | unsigned short columnscxx . . $ CppUtilities/TerminalSize#columns.; |
| 52 | /// \brief width in pixel |
| 53 | unsigned short widthcxx . . $ CppUtilities/TerminalSize#width.; |
| 54 | /// \brief height in pixel |
| 55 | unsigned short heightcxx . . $ CppUtilities/TerminalSize#height.; |
| 56 | }; |
| 57 | |
| 58 | inline TerminalSizecxx . . $ CppUtilities/TerminalSize#::TerminalSizecxx . . $ CppUtilities/TerminalSize#TerminalSize(65f460a0b618e919).(unsigned short rows, unsigned short columns, unsigned short width, unsigned short height) |
| 59 | : rowscxx . . $ CppUtilities/TerminalSize#rows.(rows) |
| 60 | , columnscxx . . $ CppUtilities/TerminalSize#columns.(columns) |
| 61 | , widthcxx . . $ CppUtilities/TerminalSize#width.(width) |
| 62 | , heightcxx . . $ CppUtilities/TerminalSize#height.(height) |
| 63 | { |
| 64 | } |
| 65 | |
| 66 | CPP_UTILITIES_EXPORTcxx . . $ `global.h:11:9`! TerminalSizecxx . . $ CppUtilities/TerminalSize# determineTerminalSizecxx . . $ CppUtilities/determineTerminalSize(606d4e856e7d8688).(); |
| 67 | |
| 68 | /*! |
| 69 | * \brief The Indentation class allows printing indentation conveniently, eg. cout << Indentation(4) << ... |
| 70 | */ |
| 71 | class CPP_UTILITIES_EXPORTcxx . . $ `global.h:11:9`! Indentationcxx . . $ CppUtilities/Indentation# { |
| 72 | public: |
| 73 | Indentationcxx . . $ CppUtilities/Indentation#Indentation(bf39ed7cbaca7ebc).(unsigned char level = 4, char character = ' ') |
| 74 | : levelcxx . . $ CppUtilities/Indentation#level.(level) |
| 75 | , charactercxx . . $ CppUtilities/Indentation#character.(character) |
| 76 | { |
| 77 | } |
| 78 | |
| 79 | Indentationcxx . . $ CppUtilities/Indentation# operatorcxx . . $ CppUtilities/Indentation#operator+(e2d219d5a0430609).+(unsigned char level) |
| 80 | { |
| 81 | return Indentationcxx . . $ CppUtilities/Indentation#(this->levelcxx . . $ CppUtilities/Indentation#level. + level, charactercxx . . $ CppUtilities/Indentation#character.); |
| 82 | } |
| 83 | |
| 84 | unsigned char levelcxx . . $ CppUtilities/Indentation#level.; |
| 85 | char charactercxx . . $ CppUtilities/Indentation#character.; |
| 86 | }; |
| 87 | |
| 88 | inline CPP_UTILITIES_EXPORTcxx . . $ `global.h:11:9`! stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &operatorcxx . . $ CppUtilities/`operator<<`(9f925d273f9b84d1).<<(stdcxx . . $ std/::ostreamcxx . . $ std/ostream# &out, Indentationcxx . . $ CppUtilities/Indentation# indentation) |
| 89 | { |
| 90 | for (unsigned char i = 0; i < indentation.levelcxx . . $ CppUtilities/Indentation#level.; ++i) { |
| 91 | out <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). indentation.charactercxx . . $ CppUtilities/Indentation#character.; |
| 92 | } |
| 93 | return out; |
| 94 | } |
| 95 | |
| 96 | } // namespace CppUtilities |
| 97 | |
| 98 | #endif // APPLICATION_UTILITIES_COMMANDLINEUTILS_H |