aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CharacterSet.cpp9
-rw-r--r--src/CharacterSet.hpp22
-rw-r--r--src/PercentEncodedCharacterDecoder.cpp12
-rw-r--r--src/Uri.cpp16
4 files changed, 16 insertions, 43 deletions
diff --git a/src/CharacterSet.cpp b/src/CharacterSet.cpp
index 3869ec5..9ed3719 100644
--- a/src/CharacterSet.cpp
+++ b/src/CharacterSet.cpp
@@ -2,7 +2,7 @@
* @file IsCharacterInSet.cpp
*
* This module contains the implementation of the
- * Uri::IsCharacterInSet function and the CharacterSet class.
+ * Uri::CharacterSet class.
*
* © 2018 by Richard Walters
*/
@@ -77,11 +77,4 @@ namespace Uri {
return impl_->charactersInSet.find(c) != impl_->charactersInSet.end();
}
- bool IsCharacterInSet(
- char c,
- const CharacterSet& characterSet
- ) {
- return characterSet.Contains(c);
- }
-
}
diff --git a/src/CharacterSet.hpp b/src/CharacterSet.hpp
index e93976f..657c89d 100644
--- a/src/CharacterSet.hpp
+++ b/src/CharacterSet.hpp
@@ -4,8 +4,7 @@
/**
* @file CharacterSet.hpp
*
- * This module declares the Uri::IsCharacterInSet function
- * and the CharacterSet class.
+ * This module declares the Uri::CharacterSet class.
*
* © 2018 by Richard Walters
*/
@@ -98,25 +97,6 @@ namespace Uri {
std::unique_ptr< struct Impl > impl_;
};
- /**
- * This function determines whether or not the given character
- * is in the given character set.
- *
- * @param[in] c
- * This is the character to check.
- *
- * @param[in] characterSet
- * This is the set of characters that are allowed.
- *
- * @return
- * An indication of whether or not the given character
- * is in the given character set is returned.
- */
- bool IsCharacterInSet(
- char c,
- const CharacterSet& characterSet
- );
-
}
#endif /* URI_CHARACTER_SET_HPP */
diff --git a/src/PercentEncodedCharacterDecoder.cpp b/src/PercentEncodedCharacterDecoder.cpp
index 1720ee9..3dd302f 100644
--- a/src/PercentEncodedCharacterDecoder.cpp
+++ b/src/PercentEncodedCharacterDecoder.cpp
@@ -62,11 +62,11 @@ namespace Uri {
case 0: { // % ...
impl_->decoderState = 1;
impl_->decodedCharacter <<= 4;
- if (IsCharacterInSet(c, DIGIT)) {
+ if (DIGIT.Contains(c)) {
impl_->decodedCharacter += (int)(c - '0');
- } else if (IsCharacterInSet(c, HEX_UPPER)) {
+ } else if (HEX_UPPER.Contains(c)) {
impl_->decodedCharacter += (int)(c - 'A') + 10;
- } else if (IsCharacterInSet(c, HEX_LOWER)) {
+ } else if (HEX_LOWER.Contains(c)) {
impl_->decodedCharacter += (int)(c - 'a') + 10;
} else {
return false;
@@ -76,11 +76,11 @@ namespace Uri {
case 1: { // %[0-9A-F] ...
impl_->decoderState = 2;
impl_->decodedCharacter <<= 4;
- if (IsCharacterInSet(c, DIGIT)) {
+ if (DIGIT.Contains(c)) {
impl_->decodedCharacter += (int)(c - '0');
- } else if (IsCharacterInSet(c, HEX_UPPER)) {
+ } else if (HEX_UPPER.Contains(c)) {
impl_->decodedCharacter += (int)(c - 'A') + 10;
- } else if (IsCharacterInSet(c, HEX_LOWER)) {
+ } else if (HEX_LOWER.Contains(c)) {
impl_->decodedCharacter += (int)(c - 'a') + 10;
} else {
return false;
diff --git a/src/Uri.cpp b/src/Uri.cpp
index 03eff68..bc16096 100644
--- a/src/Uri.cpp
+++ b/src/Uri.cpp
@@ -210,9 +210,9 @@ namespace {
} else {
bool check;
if (*isFirstCharacter) {
- check = Uri::IsCharacterInSet(c, ALPHA);
+ check = ALPHA.Contains(c);
} else {
- check = Uri::IsCharacterInSet(c, SCHEME_NOT_FIRST);
+ check = SCHEME_NOT_FIRST.Contains(c);
}
*isFirstCharacter = false;
return check;
@@ -244,7 +244,7 @@ namespace {
pecDecoder = Uri::PercentEncodedCharacterDecoder();
decoderState = 1;
} else {
- if (Uri::IsCharacterInSet(c, PCHAR_NOT_PCT_ENCODED)) {
+ if (PCHAR_NOT_PCT_ENCODED.Contains(c)) {
segment.push_back(c);
} else {
return false;
@@ -290,7 +290,7 @@ namespace {
pecDecoder = Uri::PercentEncodedCharacterDecoder();
decoderState = 1;
} else {
- if (Uri::IsCharacterInSet(c, QUERY_OR_FRAGMENT_NOT_PCT_ENCODED)) {
+ if (QUERY_OR_FRAGMENT_NOT_PCT_ENCODED.Contains(c)) {
queryOrFragment.push_back(c);
} else {
return false;
@@ -440,7 +440,7 @@ namespace Uri {
pecDecoder = PercentEncodedCharacterDecoder();
decoderState = 1;
} else {
- if (IsCharacterInSet(c, USER_INFO_NOT_PCT_ENCODED)) {
+ if (USER_INFO_NOT_PCT_ENCODED.Contains(c)) {
userInfo.push_back(c);
} else {
return false;
@@ -489,7 +489,7 @@ namespace Uri {
} else if (c == ':') {
decoderState = 8;
} else {
- if (IsCharacterInSet(c, REG_NAME_NOT_PCT_ENCODED)) {
+ if (REG_NAME_NOT_PCT_ENCODED.Contains(c)) {
host.push_back(c);
} else {
return false;
@@ -529,7 +529,7 @@ namespace Uri {
case 5: { // IPvFuture: v ...
if (c == '.') {
decoderState = 6;
- } else if (!IsCharacterInSet(c, HEXDIG)) {
+ } else if (!HEXDIG.Contains(c)) {
return false;
}
host.push_back(c);
@@ -539,7 +539,7 @@ namespace Uri {
host.push_back(c);
if (c == ']') {
decoderState = 7;
- } else if (!IsCharacterInSet(c, IPV_FUTURE_LAST_PART)) {
+ } else if (!IPV_FUTURE_LAST_PART.Contains(c)) {
return false;
}
} break;