-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.hpp
80 lines (70 loc) · 2.3 KB
/
utils.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
#ifndef ELYAHW_UTILS_CPP
#define ELYAHW_UTILS_CPP
#include <iostream>
#include <vector>
#include <regex>
#include <fstream>
#include <optional>
namespace stelijah
{
/**
* @param[in] str string
* @param[out] string cleaned from spaces (beginning, end, extra ones in middle)
*/
std::string clean_string(std::string str);
/**
* @param[in] s (string)
* @param[in] delimiter (string)
* @param[out] vector of strings of splitted items cleaned from spaces
*/
std::optional<std::vector<std::string>> split(std::string s, std::string delimiter);
/**
* @param[in] path_file
* @param[out] vector of strings containing lines inside path_file.
* Lines are: - cleaned from spaces
* - everything following '#' is hashes ignored
* - empty lines removed
*/
std::optional<std::vector<std::string>> read_file(std::string path_file);
/**
* Class to store different parts of a password (unordered).
* Note: Making a class that contains a vector, and randomly separating the string into parts of random length
* and pushing them into an array will not work as the whole string should not be stored as a single entity.
*/
class password
{
public:
std::string get_password();
private:
// Password must be separated into unequal pieces and put from A-Z:
// FATHER_SON_HOLY_SPIRIT_JESUS_CHRIST_SON_OF_GOD_OUR_MOTHER_MARY_SAINTS_ANGELS
std::string A = "";
std::string F = "";
std::string X = "";
std::string Z = "";
std::string S = "";
std::string O = "";
std::string R = "";
std::string T = "";
std::string Q = "";
std::string L = "";
std::string I = "";
std::string K = "";
std::string G = "";
std::string Y = "";
std::string B = "";
std::string E = "";
std::string M = "";
std::string U = "";
std::string W = "";
std::string V = "";
std::string P = "";
std::string N = "";
std::string J = "";
std::string C = "";
std::string D = "";
std::string H = "";
};
} /* namespace stelijah */
#endif // ELYAHW_UTILS_CPP