0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-02-16 16:50:12 +01:00

ircd: Rename gmatch/gequals.

This commit is contained in:
Jason Volk 2019-07-11 13:35:48 -07:00
parent 0f4d1e2869
commit d53744b3f8
3 changed files with 21 additions and 20 deletions

View file

@ -22,8 +22,8 @@ namespace ircd
struct iequals; struct iequals;
// Globular ('*' and '?') expression utils. // Globular ('*' and '?') expression utils.
struct gmatch; struct globular_match;
struct gequals; struct globular_equals;
// Vintage // Vintage
struct strlcpy; struct strlcpy;
@ -309,7 +309,7 @@ const
/// Globular equals. This allows either side of the comparison to include '*' /// Globular equals. This allows either side of the comparison to include '*'
/// and '?' characters and equality of the string expressions will be /// and '?' characters and equality of the string expressions will be
/// determined. /// determined.
struct ircd::gequals struct ircd::globular_equals
{ {
using is_transparent = std::true_type; using is_transparent = std::true_type;
@ -324,18 +324,19 @@ struct ircd::gequals
template<class A, template<class A,
class B> class B>
gequals(A&& a, B&& b) globular_equals(A&& a, B&& b)
:s{operator()(std::forward<A>(a), std::forward<B>(b))} :s{operator()(std::forward<A>(a), std::forward<B>(b))}
{} {}
gequals() = default; globular_equals() = default;
}; };
/// Globular match. Similar to gequals but only one side of the comparison is /// Globular match. Similar to globular_equals but only one side of the
/// considered to be the expression with '*' and '?' characters. The expression /// comparison is considered to be the expression with '*' and '?' characters.
/// string is passed at construction. The comparison inputs are treated as /// The expression string is passed at construction. The comparison inputs are
/// non-expression strings. This allows for greater optimization than gequals. /// treated as non-expression strings. This allows for greater optimization
struct ircd::gmatch /// than globular_equals.
struct ircd::globular_match
{ {
string_view expr; string_view expr;
bool s; bool s;
@ -347,17 +348,17 @@ struct ircd::gmatch
bool operator()(const string_view &a) const; bool operator()(const string_view &a) const;
gmatch(const string_view &expr) globular_match(const string_view &expr)
:expr{expr} :expr{expr}
{} {}
template<class A> template<class A>
gmatch(const string_view &expr, A&& a) globular_match(const string_view &expr, A&& a)
:expr{expr} :expr{expr}
,s{operator()(std::forward<A>(a))} ,s{operator()(std::forward<A>(a))}
{} {}
gmatch() = default; globular_match() = default;
}; };
inline ircd::string_view inline ircd::string_view

View file

@ -44,11 +44,11 @@ ircd::replace(const string_view &s,
} }
// //
// gequals // globular_equals
// //
bool bool
ircd::gequals::operator()(const string_view &a, const string_view &b) ircd::globular_equals::operator()(const string_view &a, const string_view &b)
const const
{ {
size_t ap(0), bp(0); size_t ap(0), bp(0);
@ -90,14 +90,14 @@ const
} }
// //
// gmatch // globular_match
// //
bool bool
ircd::gmatch::operator()(const string_view &a) ircd::globular_match::operator()(const string_view &a)
const const
{ {
//TODO: optimize. //TODO: optimize.
const gequals gequals(expr, a); const globular_equals globular_equals(expr, a);
return bool(gequals); return bool(globular_equals);
} }

View file

@ -243,7 +243,7 @@ const
return !for_each(prop, [&server] return !for_each(prop, [&server]
(const string_view &expression) (const string_view &expression)
{ {
const gmatch match const globular_match match
{ {
expression expression
}; };