|
Squid Web Cache v8/master
|
optimized set of C chars, with quick membership test and merge support More...
#include <CharacterSet.h>
Public Types | |
| typedef std::vector< uint8_t > | Storage |
Public Member Functions | |
| CharacterSet (const char *label="anonymous", const char *const chars="") | |
| a character set with a given label and contents | |
| CharacterSet (const char *label, unsigned char low, unsigned char high) | |
| CharacterSet (const char *label, std::initializer_list< std::pair< uint8_t, uint8_t > > ranges) | |
| bool | isEmpty () const |
| whether the set lacks any members | |
| bool | operator[] (unsigned char c) const |
| whether a given character exists in the set | |
| CharacterSet & | add (const unsigned char c) |
| add a given character to the character set | |
| CharacterSet & | remove (const unsigned char c) |
| remove a given character from the character set | |
| CharacterSet & | addRange (unsigned char low, unsigned char high) |
| add a list of character ranges, expressed as pairs [low,high], including both ends | |
| CharacterSet & | operator+= (const CharacterSet &rhs) |
| set addition: add to this set all characters that are also in rhs | |
| CharacterSet & | operator-= (const CharacterSet &rhs) |
| set subtraction: remove all characters that are also in rhs | |
| CharacterSet | complement (const char *complementLabel=nullptr) const |
| CharacterSet & | rename (const char *label) |
| change name; handy in const declarations that use operators | |
| bool | operator== (const CharacterSet &cs) const |
| bool | operator!= (const CharacterSet &cs) const |
| void | printChars (std::ostream &os) const |
| prints all chars in arbitrary order, without any quoting/escaping | |
Static Public Member Functions | |
| static const CharacterSet & | RFC3986_UNRESERVED () |
| allowed URI characters that do not have a reserved purpose, RFC 3986 | |
Public Attributes | |
| const char * | name |
| optional set label for debugging (default: "anonymous") | |
Static Public Attributes | |
| static const CharacterSet | ALPHA |
| static const CharacterSet | BIT |
| static const CharacterSet | CR |
| static const CharacterSet | CTL |
| static const CharacterSet | DIGIT |
| static const CharacterSet | DQUOTE |
| static const CharacterSet | HEXDIG |
| static const CharacterSet | HTAB |
| static const CharacterSet | LF |
| static const CharacterSet | SP |
| static const CharacterSet | VCHAR |
| static const CharacterSet | WSP |
| static const CharacterSet | CTEXT |
| static const CharacterSet | TCHAR |
| static const CharacterSet | SPECIAL |
| static const CharacterSet | QDTEXT |
| static const CharacterSet | OBSTEXT |
| static const CharacterSet | ETAGC |
| static const CharacterSet | TOKEN68C |
Private Attributes | |
| Storage | chars_ |
Definition at line 17 of file CharacterSet.h.
| typedef std::vector<uint8_t> CharacterSet::Storage |
Definition at line 20 of file CharacterSet.h.
|
explicit |
Definition at line 83 of file CharacterSet.cc.
References add().
| CharacterSet::CharacterSet | ( | const char * | label, |
| unsigned char | low, | ||
| unsigned char | high | ||
| ) |
define a character set with the given label ("anonymous" if nullptr) containing characters defined in the supplied ranges
Definition at line 92 of file CharacterSet.cc.
References addRange().
| CharacterSet::CharacterSet | ( | const char * | label, |
| std::initializer_list< std::pair< uint8_t, uint8_t > > | ranges | ||
| ) |
define a character set with the given label ("anonymous" if nullptr) containing characters defined in the supplied list of low-high ranges
Definition at line 99 of file CharacterSet.cc.
References addRange().
| CharacterSet & CharacterSet::add | ( | const unsigned char | c | ) |
Definition at line 47 of file CharacterSet.cc.
References chars_.
Referenced by CharacterSet(), TestCharacterSet::CharacterSetAdd(), IgnorePlaceholder(), TestTokenizer::testTokenizerPrefix(), and TestTokenizer::testTokenizerSuffix().
| CharacterSet & CharacterSet::addRange | ( | unsigned char | low, |
| unsigned char | high | ||
| ) |
Definition at line 61 of file CharacterSet.cc.
References chars_.
Referenced by CharacterSet(), CharacterSet(), and TestCharacterSet::CharacterSetAddRange().
| CharacterSet CharacterSet::complement | ( | const char * | complementLabel = nullptr | ) | const |
return a new CharacterSet containing characters not in this set use the supplied label if provided, default is "complement_of_some_other_set"
Definition at line 74 of file CharacterSet.cc.
References chars_.
Referenced by AppendTokens(), AnyP::Uri::Decode(), Ftp::Server::handleFeatReply(), LineCharacters(), ProxyProtocol::One::Parse(), Mgr::QueryParams::Parse(), Ftp::Server::parseOneRequest(), Http::One::RequestParser::parseRequestFirstLine(), and CacheManager::ParseUrl().
|
inline |
Definition at line 36 of file CharacterSet.h.
References chars_.
|
inline |
| CharacterSet & CharacterSet::operator+= | ( | const CharacterSet & | rhs | ) |
Definition at line 17 of file CharacterSet.cc.
References chars_.
| CharacterSet & CharacterSet::operator-= | ( | const CharacterSet & | rhs | ) |
Definition at line 32 of file CharacterSet.cc.
References chars_.
|
inline |
Definition at line 64 of file CharacterSet.h.
References chars_.
Referenced by operator!=().
|
inline |
Definition at line 39 of file CharacterSet.h.
References chars_.
| void CharacterSet::printChars | ( | std::ostream & | os | ) | const |
Definition at line 108 of file CharacterSet.cc.
References chars_.
| CharacterSet & CharacterSet::remove | ( | const unsigned char | c | ) |
Definition at line 54 of file CharacterSet.cc.
References chars_.
Referenced by AnyP::Uri::absolute().
|
inline |
Definition at line 61 of file CharacterSet.h.
References name.
Referenced by AnyP::Uri::absolute(), ProxyProtocol::One::Parse(), and Http::One::Parser::unfoldMime().
|
static |
Definition at line 164 of file CharacterSet.cc.
Referenced by ErrorState::Dump(), TestUri::testEncoding(), and UriValidCharacters().
|
static |
Definition at line 76 of file CharacterSet.h.
Referenced by TestCharacterSet::CharacterSetConstants(), TestCharacterSet::CharacterSetEqualityOp(), Http::One::Parser::getHostHeaderField(), mainHandleCommandLineOption(), Mgr::QueryParams::Parse(), Security::PeerOptions::parseOptions(), AnyP::Uri::parseUrn(), PathChars(), prepareAcceleratedURL(), uriParseScheme(), UserInfoChars(), and Notes::validateKey().
|
static |
Definition at line 78 of file CharacterSet.h.
Referenced by TestCharacterSet::CharacterSetEqualityOp().
|
private |
index of characters in this set
Definition at line 130 of file CharacterSet.h.
Referenced by add(), addRange(), complement(), isEmpty(), operator+=(), operator-=(), operator==(), operator[](), printChars(), and remove().
|
static |
Definition at line 80 of file CharacterSet.h.
Referenced by GetOtherPid(), ProxyProtocol::One::Parse(), parseQuotedStringSuffix(), RelaxedDelimiterCharacters(), Http::One::RequestParser::skipTrailingCrs(), and Http::One::Parser::unfoldMime().
|
static |
Definition at line 102 of file CharacterSet.h.
|
static |
Definition at line 82 of file CharacterSet.h.
|
static |
Definition at line 84 of file CharacterSet.h.
Referenced by TestCharacterSet::CharacterSetUnion(), ConfigureCurrentKid(), ProxyProtocol::FieldNameToFieldType(), Http::ContentLengthInterpreter::findDigits(), Http::One::Parser::getHostHeaderField(), mainHandleCommandLineOption(), Mgr::QueryParams::Parse(), Http::One::RequestParser::parseHttpVersionField(), Security::PeerOptions::parseOptions(), AnyP::Uri::parseUrn(), PathChars(), prepareAcceleratedURL(), uriParseScheme(), UserInfoChars(), and Notes::validateKey().
|
static |
Definition at line 86 of file CharacterSet.h.
|
static |
Definition at line 115 of file CharacterSet.h.
|
static |
Definition at line 88 of file CharacterSet.h.
Referenced by TestCharacterSet::CharacterSetSubtract(), TestCharacterSet::CharacterSetUnion(), ProxyProtocol::One::ExtractIp(), AnyP::Uri::parseHost(), prepareAcceleratedURL(), and UriValidCharacters().
|
static |
Definition at line 90 of file CharacterSet.h.
Referenced by Auth::SchemesConfig::expand(), parseQuotedStringSuffix(), and RelaxedDelimiterCharacters().
|
static |
Definition at line 92 of file CharacterSet.h.
Referenced by Http::One::Parser::cleanMimePrefix(), Http::One::Parser::getHostHeaderField(), GetOtherPid(), LineCharacters(), Ftp::Server::parseOneRequest(), parseQuotedStringSuffix(), Http::One::RequestParser::parseRequestFirstLine(), Http::One::Parser::skipLineTerminator(), and Http::One::Parser::unfoldMime().
| const char* CharacterSet::name |
Definition at line 72 of file CharacterSet.h.
Referenced by TestCharacterSet::CharacterSetConstruction(), SBuf::findFirstNotOf(), SBuf::findFirstOf(), SBuf::findLastNotOf(), SBuf::findLastOf(), operator<<(), parseQuotedStringSuffix(), Parser::Tokenizer::prefix(), rename(), Parser::Tokenizer::skipAll(), Parser::Tokenizer::skipAllTrailing(), Parser::Tokenizer::skipOne(), Parser::Tokenizer::skipOneTrailing(), and Parser::Tokenizer::token().
|
static |
Definition at line 111 of file CharacterSet.h.
Referenced by parseQuotedStringSuffix(), and Http::One::ResponseParser::parseResponseStatusAndReason().
|
static |
Definition at line 109 of file CharacterSet.h.
|
static |
Definition at line 94 of file CharacterSet.h.
Referenced by Http::One::Parser::DelimiterCharacters(), Auth::SchemesConfig::expand(), Ftp::Server::handleFeatReply(), parseQuotedStringSuffix(), and RelaxedDelimiterCharacters().
|
static |
Definition at line 107 of file CharacterSet.h.
|
static |
Definition at line 105 of file CharacterSet.h.
Referenced by HttpHeaderEntry::parse(), AnyP::Uri::parseHost(), Http::One::RequestParser::parseMethodField(), Http::One::TeChunkedParser::parseOneChunkExtension(), and Http::One::tokenOrQuotedString().
|
static |
Definition at line 119 of file CharacterSet.h.
|
static |
Definition at line 96 of file CharacterSet.h.
Referenced by parseQuotedStringSuffix(), and Http::One::ResponseParser::parseResponseStatusAndReason().
|
static |
Definition at line 98 of file CharacterSet.h.
Referenced by Http::One::Parser::getHostHeaderField(), IsSpace(), Http::One::ResponseParser::parseResponseStatusAndReason(), Http::One::ParseStrictBws(), Http::One::Parser::unfoldMime(), and Http::One::Parser::WhitespaceCharacters().