-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasicFunctions.hpp
57 lines (37 loc) · 1.46 KB
/
BasicFunctions.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef ARGPARSER_BASICFUNCTIONS_HPP_
#define ARGPARSER_BASICFUNCTIONS_HPP_
#include <cstdint>
#include <string_view>
#include <iostream>
#include "ConditionalOutput.hpp"
#if defined _WIN32 || defined _WIN64 || defined __CYGWIN__
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <Windows.h>
#else
#define STD_OUTPUT_HANDLE 0
#define HANDLE int
inline int GetStdHandle(int a);
inline int SetConsoleTextAttribute(int a, int b);
#endif
namespace ArgumentParser {
/**\n This function sets the console text color to red. */
void SetRedColor();
/**\n This function resets the console text color to white. */
void ResetColor();
/**\n This function prints an error message. */
void DisplayError(const std::string& message, ConditionalOutput error_output);
/**\n This function checks if the code is running on Windows. */
bool IsWindows();
/**\n The code validates the validity of a filename based on rules specific to
* Windows. The filename should consist of alphanumeric characters, backslashes,
* periods, hyphens, and spaces. Additionally, the code checks for consecutive
* slashes in the filename, which is also considered invalid. */
bool IsValidFilename(std::string& pre_filename);
/**\n This function is a wrapper for the std::filesystem::is_regular_file function. */
bool IsRegularFile(std::string& filename);
/**\n This function is a wrapper for the std::filesystem::is_directory function. */
bool IsDirectory(std::string& dirname);
}
#endif //ARGPARSER_BASICFUNCTIONS_HPP_