diff options
author | Oleg Morozenkov <omorozenkov@gmail.com> | 2015-08-11 22:13:23 +0300 |
---|---|---|
committer | Oleg Morozenkov <omorozenkov@gmail.com> | 2015-08-11 22:13:23 +0300 |
commit | 376b88ec09ef8cf71dd823467406c58204485fcc (patch) | |
tree | 9ca599b854d18006c65b26003ce7dbdd416fdf18 /src/net/Url.cpp | |
parent | d7fbf7149d0e0c1c30972dab68d510ef6ac377dd (diff) |
Fixed compiler's errors in TgTypeParser + fixed indentation + some other fixes
Diffstat (limited to 'src/net/Url.cpp')
-rw-r--r-- | src/net/Url.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/src/net/Url.cpp b/src/net/Url.cpp index c773f3b..44d9089 100644 --- a/src/net/Url.cpp +++ b/src/net/Url.cpp @@ -29,52 +29,52 @@ using namespace std; namespace TgBot { Url::Url(const string& url) { - bool isProtocolParsed = false; - bool isHostParsed = false; - bool isPathParsed = false; - bool isQueryParsed = false; + bool isProtocolParsed = false; + bool isHostParsed = false; + bool isPathParsed = false; + bool isQueryParsed = false; - for (size_t i = 0, count = url.length(); i < count; ++i) { - char c = url[i]; + for (size_t i = 0, count = url.length(); i < count; ++i) { + char c = url[i]; - if (!isProtocolParsed) { - if (c == ':') { - isProtocolParsed = true; - i += 2; - } else { - protocol += c; - } - } else if (!isHostParsed) { - if (c == '/') { - isHostParsed = true; - path += '/'; - } else if (c == '?') { - isHostParsed = isPathParsed = true; - path += '/'; - } else if (c == '#') { - isHostParsed = isPathParsed = isQueryParsed = true; - path += '/'; - } else { - host += c; - } - } else if (!isPathParsed) { - if (c == '?') { - isPathParsed = true; - } else if (c == '#') { - isPathParsed = isQueryParsed = true; - } else { - path += c; - } - } else if (!isQueryParsed) { - if (c == '#') { - isQueryParsed = true; - } else { - query += c; - } - } else { - fragment += c; - } - } + if (!isProtocolParsed) { + if (c == ':') { + isProtocolParsed = true; + i += 2; + } else { + protocol += c; + } + } else if (!isHostParsed) { + if (c == '/') { + isHostParsed = true; + path += '/'; + } else if (c == '?') { + isHostParsed = isPathParsed = true; + path += '/'; + } else if (c == '#') { + isHostParsed = isPathParsed = isQueryParsed = true; + path += '/'; + } else { + host += c; + } + } else if (!isPathParsed) { + if (c == '?') { + isPathParsed = true; + } else if (c == '#') { + isPathParsed = isQueryParsed = true; + } else { + path += c; + } + } else if (!isQueryParsed) { + if (c == '#') { + isQueryParsed = true; + } else { + query += c; + } + } else { + fragment += c; + } + } host = StringTools::urlEncode(host, "."); path = StringTools::urlEncode(path, "/"); |