 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file. 1 #ifndef __ZXCVBN__COMMON_HPP
2 #define __ZXCVBN__COMMON_HPP
18 using idx_t = std::string::size_type;
22 MATCH_FN(Dictionary, DICTIONARY, dictionary) \
23 MATCH_FN(Spatial, SPATIAL, spatial) \
24 MATCH_FN(Repeat, REPEAT, repeat) \
25 MATCH_FN(Sequence, SEQUENCE, sequence) \
26 MATCH_FN(Regex, REGEX, regex) \
27 MATCH_FN(Date, DATE, date) \
28 MATCH_FN(Bruteforce, BRUTEFORCE, bruteforce) \
29 MATCH_FN(Unknown, UNKNOWN, unknown)
50 std::copy(
b.begin(),
b.end(), std::back_inserter(
matches));
61 #define MATCH_FN(_, e, __) e,
68 static constexpr
auto pattern = MatchPattern::DICTIONARY;
77 std::unordered_map<std::string, std::string>
sub;
82 static constexpr
auto pattern = MatchPattern::SPATIAL;
92 static constexpr
auto pattern = MatchPattern::REPEAT;
101 static constexpr
auto pattern = MatchPattern::SEQUENCE;
109 static constexpr
auto pattern = MatchPattern::REGEX;
116 static constexpr
auto pattern = MatchPattern::DATE;
124 static constexpr
auto pattern = MatchPattern::BRUTEFORCE;
128 static constexpr
auto pattern = MatchPattern::UNKNOWN;
136 #define MATCH_FN(title, upper, lower) title##Match _##lower;
146 token = std::forward<T>(val).token;
153 #define MATCH_FN(title, upper, lower) \
154 case MatchPattern::upper: \
155 new (&_##lower) title##Match(std::forward<T>(val)._##lower); \
169 new (
this)
Match(std::forward<T>(val));
203 #define MATCH_FN(title, upper, lower) \
204 case MatchPattern::upper:\
205 _##lower.~title##Match(); \
220 #define MATCH_FN(title, upper, lower) \
221 title##Match & get_##lower() { \
222 assert(get_pattern() == MatchPattern::upper); \
226 const title##Match & get_##lower() const { \
227 assert(get_pattern() == MatchPattern::upper); \
242 #define MATCH_FN(title, upper, lower) \
244 struct pattern_type_to_pmc<title##Match> : \
245 public std::integral_constant<decltype(&Match::_##lower), &Match::_##lower> {};
254 i(i_), j(j_), token(
std::move(token)),
255 guesses(), guesses_log10(), idx(), jdx() {
static constexpr auto pattern
Match(idx_t i_, idx_t j_, std::string token, T &&val)
guesses_log10_t guesses_log10
std::vector< std::string > matches
static constexpr auto pattern
static constexpr auto pattern
zxcvbn_guesses_t guesses_t
PortableRegexMatch regex_match
static constexpr auto pattern
static constexpr auto pattern
static constexpr auto pattern
static constexpr auto pattern
MatchPattern get_pattern() const
Match & operator=(Match &&m)
DictionaryTag dictionary_tag
std::string::size_type idx_t
Match & operator=(const Match &m)
static constexpr auto pattern
std::unordered_map< std::string, std::string > sub
std::vector< Match > base_matches
PortableRegexMatch(const std::smatch &b)
PortableRegexMatch(std::vector< std::string > matches_, std::size_t index_)