Lines Matching refs:input
75 void ReplaceSpecialSymbols(std::string& input, std::string& oldstr, std::string& newstr)
80 if ((pos = input.find(oldstr)) != std::string::npos) {
81 input.replace(pos, oldlen, newstr);
102 std::string DecodeSpecialChars(std::string input)
104 std::string temp = input;
106 if (input.empty()) {
175 bool AnalysisScheme(std::string& input, std::string& scheme,
178 if (!isalpha(input[0])) {
182 size_t strlen = input.size();
184 if ((isalnum(input[i]) || input[i] == '+' || input[i] == '-' || input[i] == '.') &&
185 isupper(input[i])) {
186 input[i] = static_cast<size_t>(tolower(input[i]));
188 if (!isalnum(input[i]) && input[i] != '+' && input[i] != '-' && input[i] != '.') {
194 scheme = input;
202 void AnalysisFragment(const std::string& input, std::string& fragment,
205 fragment = input;
209 void AnalysisQuery(const std::string& input, std::string& query,
212 query = input;
215 void AnalysisUsernameAndPasswd(std::string& input, std::string& username, std::string& password,
218 int pos = static_cast<int>(input.size()) - 1;
220 if (input[pos] == '@') {
224 std::string userAndPasswd = input.substr(0, pos);
225 input = input.substr(pos + 1);
257 void AnalysisPath(std::string& input, std::vector<std::string>& path,
262 while (((pos = input.find('/')) != std::string::npos) ||
263 ((pos = input.find('\\')) != std::string::npos && isSpecial)) {
264 temp.push_back(input.substr(0, pos));
265 input = input.substr(pos + 1);
267 temp.push_back(input);
299 void AnalysisPort(std::string input, UrlData& urlinfo,
302 if (input.size() == 0) {
305 for (auto i : input) {
311 if (input.size() >= 6) { //6:Maximum port number size
315 int it = stoi(input);
332 void AnalysisOpaqueHost(std::string input, std::string& host,
335 size_t strlen = input.size();
337 char ch = input[i];
344 host = input;
487 void IPv6Host(std::string& input, std::string& host,
500 if (!std::regex_match(input, ipv6)) {
505 pos = input.find('.');
507 input = DealIpv4(input);
509 FormatIpv6(input);
510 input = Compress(input);
511 host = "[" + input + "]";
688 void AnalyseIPv4(const std::string& input, std::string& host,
693 isipv4 = RemovalIpv4(temp, input, flags);
729 void AnalysisHost(std::string& input, std::string& host,
732 if (input.empty()) {
736 if (input[0] == '[') {
737 if ((input[input.length() - 1]) == ']') {
738 size_t b = input.length();
739 input = input.substr(1, b - 2); // 2:Truncating Strings
740 IPv6Host(input, host, flags);
748 AnalysisOpaqueHost(input, host, flags);
751 std::string decodeInput = DecodeSpecialChars(input);
759 bool ISFileNohost(const std::string& input)
761 if ((isalpha(input[0]) && (input[1] == ':' || input[1] == '|'))) {
767 void AnalysisFilePath(std::string& input, UrlData& urlinfo,
772 while (((pos = input.find('/')) != std::string::npos) || ((pos = input.find('\\')) != std::string::npos)) {
773 temp.push_back(input.substr(0, pos));
774 input = input.substr(pos + 1);
776 temp.push_back(input);
829 void AnalysisFile(std::string& input, UrlData& urlinfo,
833 if ((input[0] == '/' || input[0] == '\\') && (input[1] == '/' || input[1] == '\\')) {
834 std::string temp = input.substr(2); // 2:Intercept from 2 subscripts
852 if (input[0] == '/' || input[0] == '\\') {
853 input = input.substr(1);
855 AnalysisFilePath(input, urlinfo, flags);
859 void AnalysisFilescheme(const std::string& input, UrlData& urlinfo,
862 std::string strPath = urlinfo.scheme + input;
869 UrlData& urlinfo, const std::string& input)
875 urlinfo.path[0] = input;
905 void AnalysisNoDefaultProtocol(std::string& input, UrlData& urlinfo,
909 AnalysisFilescheme(input, urlinfo, flags);
912 if (input[0] == '/' && input[1] == '/' && input[2] != '/') { // 2:The third character of the input
913 std::string hostandpath = input.substr(2); // 2:Intercept from 2 subscripts
949 } else if (input[0] == '/' && input[1] == '/') {
950 std::string strOfPath = input.substr(1);
953 AnalyInfoPath(flags, urlinfo, input);
957 void AnalysisOnlyHost(const std::string& input, UrlData& urlinfo,
960 std::string strHost = input;
982 void JudgePos(size_t &pos, const size_t &length, const std::string& input)
985 if (input[pos] == '/' || input[pos] == '\\') {
991 void SkipSlashSymbol(std::string& input, size_t& pos)
993 size_t inputLen = input.size();
995 if (input[pos] == '/' || input[pos] == '\\') {
1001 input = input.substr(pos);
1004 void ParsingHostAndPath(std::string& input, UrlData& urlinfo, size_t& pos,
1008 size_t length = input.size();
1009 JudgePos(pos, length, input);
1010 std::string strHost = input.substr(0, pos);
1011 std::string strPath = input.substr(pos + 1);
1035 void AnalysisHostAndPath(std::string& input, UrlData& urlinfo,
1040 SkipSlashSymbol(input, pos);
1041 if (input.size() == 0) {
1044 } else if ((input.find('/') != std::string::npos || input.find('\\') != std::string::npos)) {
1045 ParsingHostAndPath(input, urlinfo, pos, flags);
1046 } else if (input.size() != 0 && input.find('/') == std::string::npos &&
1047 input.find('\\') == std::string::npos) {
1048 AnalysisOnlyHost(input, urlinfo, flags, pos);
1051 size_t inputLen = input.size();
1053 urlinfo.isSpecialPath = input[0] != '/' ? true : false;
1055 AnalysisNoDefaultProtocol(input, urlinfo, flags);
1059 void AnalysisInput(std::string& input, UrlData& urlData,
1063 if (input.find('#') != std::string::npos) {
1064 pos = input.find('#');
1065 std::string fragment = input.substr(pos);
1067 input = input.substr(0, pos);
1069 if (input.find('?') != std::string::npos) {
1070 pos = input.find('?');
1071 std::string query = input.substr(pos);
1073 input = input.substr(0, pos);
1076 std::string pathStr = input;
1131 void InitOnlyInput(std::string& input, UrlData& urlData,
1134 if (input.empty()) {
1138 if (input.find(':') != std::string::npos) {
1139 size_t pos = input.find(':');
1141 std::string scheme = input.substr(0, pos);
1145 if (input.find('#') != std::string::npos) {
1146 size_t posTmp = input.find('#');
1147 std::string fragment = input.substr(posTmp);
1149 input = input.substr(0, posTmp);
1151 if (input.find('?') != std::string::npos) {
1152 size_t position = input.find('?');
1153 std::string query = input.substr(position);
1155 input = input.substr(0, position);
1157 std::string str = input.substr(pos);
1169 void ToolHasBase(std::string input, std::string &strInput, UrlData &urlData,
1172 if (!input.empty() && input[0] == '/') {
1173 strInput = input.substr(1);
1175 } else if (!input.empty() && input[0] != '/') {
1194 URL::URL(const std::string& input)
1196 std::string str = input;
1213 URL::URL(const std::string& input, const std::string& base)
1218 std::string strInput = input;
1231 if ((input[0] == '/') && (input[1] == '/' || (input[1] == '\\' &&
1233 std::string newInput = baseInfo.scheme + input;
1240 BaseInfoToUrl(baseInfo, baseflags, urlData_, flags_, input.empty());
1241 ToolHasBase(input, strInput, urlData_, flags_);
1242 if (!input.empty() && input[0] != '/' && urlData_.path.empty()) {
1247 if (!input.empty() && input[0] != '/' && !urlData_.path.empty()) {
1263 URL::URL(const std::string& input, const URL& base)
1265 std::string strInput = input;
1274 if ((input[0] == '/') && (input[1] == '/' || (input[1] == '\\' &&
1276 std::string newInput = baseInfo.scheme + input;
1283 BaseInfoToUrl(baseInfo, baseflags, urlData_, flags_, input.empty());
1284 ToolHasBase(input, strInput, urlData_, flags_);
1285 if (!input.empty() && input[0] != '/' && urlData_.path.empty()) {
1290 if (!input.empty() && input[0] != '/' && !urlData_.path.empty()) {
1445 void URL::SetHostname(const std::string& input)
1450 std::string strHost = input;
1475 void URL::SetHref(const std::string& input)
1477 std::string str = input;
1489 void URL::SetPath(const std::string& input)
1491 std::string strPath = input;
1526 void SplitString(const std::string& input, std::string& strHost, std::string& port)
1528 size_t strlen = input.size();
1530 if ((input[pos] == ':') || (input[pos] == '?') || (input[pos] == '#') ||
1531 (input[pos] == '/') || (input[pos] == '\\')) {
1532 strHost = input.substr(0, pos);
1533 if (input[pos] == ':') {
1535 port = input.substr(pos);
1542 void URL::SetHost(const std::string& input)
1544 if (input.empty() || flags_.test(static_cast<size_t>(BitsetStatusFlag::BIT9))) {
1547 std::string strHost = input;
1549 SplitString(input, strHost, port);
1586 void URL::SetPort(const std::string& input)
1588 std::string port = input;
1607 void URL::SetSearch(const std::string& input)
1610 if (input.size() == 0) {
1614 if (input[0] != '?') {
1616 temp += input;
1618 temp = input;
1627 void URL::SetFragment(const std::string& input)
1630 if (input.size() == 0) {
1634 if (input[0] != '#') {
1636 temp += input;
1638 temp = input;
1644 void URL::SetScheme(const std::string& input)
1646 std::string strInput = input;
1648 bool inputIsSpecial = IsSpecial(input);
1649 if ((special != inputIsSpecial) || ((input == "file") &&
1665 void URL::SetUsername(const std::string& input)
1667 if (input.size() == 0) {
1671 std::string usname = input;
1681 void URL::SetPassword(const std::string& input)
1683 if (input.size() == 0) {
1687 std::string keyWord = input;