Skip to content

Commit d067d06

Browse files
committed
Renaming
1 parent f9282e6 commit d067d06

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

src/ESPAsyncWebServer.h

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,6 @@ class AsyncWebServerRequest {
732732

733733
class AsyncURIMatcher {
734734
public:
735-
// Modifier flags for AsyncURIMatcher behavior
736-
737735
/**
738736
* @brief No special matching behavior (default)
739737
*/
@@ -765,8 +763,8 @@ class AsyncURIMatcher {
765763

766764
// public constructors
767765
AsyncURIMatcher() : _flags(All) {}
768-
AsyncURIMatcher(String uri, uint16_t flags = None) : AsyncURIMatcher(std::move(uri), Auto, flags) {}
769-
AsyncURIMatcher(const char *uri, uint16_t flags = None) : AsyncURIMatcher(String(uri), Auto, flags) {}
766+
AsyncURIMatcher(String uri, uint16_t modifiers = None) : AsyncURIMatcher(std::move(uri), Auto, modifiers) {}
767+
AsyncURIMatcher(const char *uri, uint16_t modifiers = None) : AsyncURIMatcher(String(uri), Auto, modifiers) {}
770768

771769
#ifdef ASYNCWEBSERVER_REGEX
772770
AsyncURIMatcher(const AsyncURIMatcher &c) : _value(c._value), _flags(c._flags) {
@@ -890,36 +888,36 @@ class AsyncURIMatcher {
890888
/**
891889
* @brief Create an exact URI matcher
892890
* @param c The exact URI string to match (e.g., "/login", "/api/status")
893-
* @param flags Optional modifier flags (CaseInsensitive, etc.)
891+
* @param modifiers Optional modifiers (CaseInsensitive, etc.)
894892
* @return AsyncURIMatcher that matches only the exact URI
895893
*
896894
* Usage: server.on(AsyncURIMatcher::exact("/login"), handler);
897895
* Matches: "/login"
898896
* Doesn't match: "/login/", "/login-page"
899897
* Doesn't match: "/LOGIN" (unless CaseInsensitive flag used)
900898
*/
901-
static inline AsyncURIMatcher exact(String c, uint16_t flags = None) {
902-
return AsyncURIMatcher{std::move(c), Exact, flags};
899+
static inline AsyncURIMatcher exact(String c, uint16_t modifiers = None) {
900+
return AsyncURIMatcher{std::move(c), Exact, modifiers};
903901
}
904902

905903
/**
906904
* @brief Create a prefix URI matcher
907905
* @param c The URI prefix to match (e.g., "/api", "/static")
908-
* @param flags Optional modifier flags (CaseInsensitive, etc.)
906+
* @param modifiers Optional modifiers (CaseInsensitive, etc.)
909907
* @return AsyncURIMatcher that matches URIs starting with the prefix
910908
*
911909
* Usage: server.on(AsyncURIMatcher::prefix("/api"), handler);
912910
* Matches: "/api", "/api/users", "/api-v2", "/apitest"
913911
* Note: This is pure prefix matching - does NOT require folder separator
914912
*/
915-
static inline AsyncURIMatcher prefix(String c, uint16_t flags = None) {
916-
return AsyncURIMatcher{std::move(c), Prefix, flags};
913+
static inline AsyncURIMatcher prefix(String c, uint16_t modifiers = None) {
914+
return AsyncURIMatcher{std::move(c), Prefix, modifiers};
917915
}
918916

919917
/**
920918
* @brief Create a directory/folder URI matcher
921919
* @param c The directory path (trailing slash automatically added if missing)
922-
* @param flags Optional modifier flags (CaseInsensitive, etc.)
920+
* @param modifiers Optional modifiers (CaseInsensitive, etc.)
923921
* @return AsyncURIMatcher that matches URIs under the directory
924922
*
925923
* Usage: server.on(AsyncURIMatcher::dir("/admin"), handler);
@@ -928,21 +926,21 @@ class AsyncURIMatcher {
928926
*
929927
* The trailing slash is automatically added for convenience and efficiency.
930928
*/
931-
static inline AsyncURIMatcher dir(String c, uint16_t flags = None) {
929+
static inline AsyncURIMatcher dir(String c, uint16_t modifiers = None) {
932930
// Pre-calculate folder for efficiency
933931
if (!c.length()) {
934-
return AsyncURIMatcher{"/", Prefix, flags};
932+
return AsyncURIMatcher{"/", Prefix, modifiers};
935933
}
936934
if (c[c.length() - 1] != '/') {
937935
c.concat('/');
938936
}
939-
return AsyncURIMatcher{std::move(c), Prefix, flags};
937+
return AsyncURIMatcher{std::move(c), Prefix, modifiers};
940938
}
941939

942940
/**
943941
* @brief Create a file extension URI matcher
944942
* @param c The pattern with wildcard extension (e.g., "/images/\*.jpg", "/docs/\*.pdf")
945-
* @param flags Optional modifier flags (CaseInsensitive, etc.)
943+
* @param modifiers Optional modifiers (CaseInsensitive, etc.)
946944
* @return AsyncURIMatcher that matches files with specific extensions under a path
947945
*
948946
* Usage: server.on(AsyncURIMatcher::ext("/images/\*.jpg"), handler);
@@ -952,15 +950,15 @@ class AsyncURIMatcher {
952950
* Pattern format: "/path/\*.extension" where "*" is a literal wildcard placeholder.
953951
* The path before "/\*." must match exactly, and the URI must end with the extension.
954952
*/
955-
static inline AsyncURIMatcher ext(String c, uint16_t flags = None) {
956-
return AsyncURIMatcher{std::move(c), Extension, flags};
953+
static inline AsyncURIMatcher ext(String c, uint16_t modifiers = None) {
954+
return AsyncURIMatcher{std::move(c), Extension, modifiers};
957955
}
958956

959957
#ifdef ASYNCWEBSERVER_REGEX
960958
/**
961959
* @brief Create a regular expression URI matcher
962960
* @param c The regex pattern string (e.g., "^/user/([0-9]+)$", "^/blog/([0-9]{4})/([0-9]{2})$")
963-
* @param flags Optional modifier flags (CaseInsensitive applies to regex compilation)
961+
* @param modifiers Optional modifiers (CaseInsensitive applies to regex compilation)
964962
* @return AsyncURIMatcher that matches URIs using regex with capture groups
965963
*
966964
* Usage: server.on(AsyncURIMatcher::regex("^/user/([0-9]+)$"), handler);
@@ -971,19 +969,19 @@ class AsyncURIMatcher {
971969
* Requires ASYNCWEBSERVER_REGEX to be defined during compilation.
972970
* Performance note: Regex matching is slower than other match types.
973971
*/
974-
static inline AsyncURIMatcher regex(String c, uint16_t flags = None) {
975-
return AsyncURIMatcher{std::move(c), Regex, flags};
972+
static inline AsyncURIMatcher regex(String c, uint16_t modifiers = None) {
973+
return AsyncURIMatcher{std::move(c), Regex, modifiers};
976974
}
977975
#endif
978976

979977
private:
980978
// Matcher types
981979
enum Type : uint16_t {
982-
// Meta flags - low bits
980+
// Meta types - low bits
983981
Auto = (1 << 0), // parse _uri at construct time and infer match type(s)
984982
// (_uri may be transformed to remove wildcards)
985983

986-
All = (1 << 1), // No flags set
984+
All = (1 << 1), // No type set
987985
Exact = (1 << 2), // matches equivalent to regex: ^{_uri}$
988986
Prefix = (1 << 3), // matches equivalent to regex: ^{_uri}.*
989987
PrefixFolder = (1 << 4), // matches equivalent to regex: ^{_uri}/.*
@@ -1000,8 +998,8 @@ class AsyncURIMatcher {
1000998
union {
1001999
intptr_t _flags;
10021000
#ifdef ASYNCWEBSERVER_REGEX
1003-
// Overlay the pattern pointer storage with the flags. It is treated as a tagged pointer:
1004-
// if any of the LSBs are set, it stores flags, as a valid object must be aligned and so
1001+
// Overlay the pattern pointer storage with the type. It is treated as a tagged pointer:
1002+
// if any of the LSBs are set, it stores type, as a valid object must be aligned and so
10051003
// none of the LSBs can be set in a valid pointer.
10061004
std::regex *pattern;
10071005
#endif
@@ -1020,14 +1018,14 @@ class AsyncURIMatcher {
10201018
#endif
10211019

10221020
// Core private constructor
1023-
AsyncURIMatcher(String uri, Type type = Auto, uint16_t flags = None) : _value(std::move(uri)), _flags(uint32_t(flags) << 16 | type) {
1021+
AsyncURIMatcher(String uri, Type type = Auto, uint16_t modifiers = None) : _value(std::move(uri)), _flags(uint32_t(modifiers) << 16 | type) {
10241022
#ifdef ASYNCWEBSERVER_REGEX
10251023
if ((type & Regex) || ((type & Auto) && _value.startsWith("^") && _value.endsWith("$"))) {
1026-
pattern = new std::regex(_value.c_str(), (flags & CaseInsensitive) ? (std::regex::icase | std::regex::optimize) : (std::regex::optimize));
1027-
return; // no additional processing - flags are overwritten
1024+
pattern = new std::regex(_value.c_str(), (modifiers & CaseInsensitive) ? (std::regex::icase | std::regex::optimize) : (std::regex::optimize));
1025+
return; // no additional processing - modifiers are overwritten
10281026
}
10291027
#endif
1030-
if (flags & CaseInsensitive) {
1028+
if (modifiers & CaseInsensitive) {
10311029
_value.toLowerCase();
10321030
}
10331031
if (type & Auto) {

0 commit comments

Comments
 (0)