-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.hpp
More file actions
98 lines (82 loc) · 1.87 KB
/
Utils.hpp
File metadata and controls
98 lines (82 loc) · 1.87 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef SEMESTRALNIPRACE_UTILS_HPP
#define SEMESTRALNIPRACE_UTILS_HPP
#include <string>
#include <vector>
class VirtualFileSystem;
class Directory;
class DirectoryItem;
using std::string;
using std::vector;
/**
* Prints message to standard output if IS_DEBUG is true
* @param message
* @param endLine
*/
void log(const string& message, bool endLine = true);
/**
* Gets line from standard input
* @return line from standard input
*/
string getLine();
/**
* Removes end of line characters from string
* @param message
* @return string without end of line characters
*/
string removeEndOfLine(const string& message);
/**
* Converts size string (e.g. 10K, 10M, 10G) to int (10000, 10000000, 10000000000)
* @param stringSize
* @return size in bytes
*/
int32_t getSizeFromString(const string& stringSize);
/**
* Trims string from start
* @param s string to trim
* @return trimmed string
*/
string <rim(string &s);
/**
* Trims string from end
* @param s string to trim
* @return trimmed string
*/
string &rtrim(string &s);
/**
* Trims string from both ends
* @param s string to trim
* @return trimmed string
*/
string &trim(string &s);
/**
* Trims string from start (copying)
* @param s string to trim
* @return trimmed string
*/
string trim_copy(string s);
/**
* Gets directory path from full path
* @param fullPath full path
* @return directory path
*/
string getDirPath(const string& fullPath);
/**
* Gets file name from full path
* @param fullPath full path
* @return file name
*/
string getFileName(const string& fullPath);
/**
* Converts int to string
* @param number int to convert
* @return string representation of int
*/
string intToString(int32_t number);
/**
* Splits string by delimiter
* @param str string to split
* @param delim delimiter
* @return vector of strings
*/
vector<string> splitString(const string& str, char delim = ' ');
#endif