MCPcopy Create free account
hub / github.com/comaps/comaps / UrlEncode

Function UrlEncode

libs/coding/url.cpp:112–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112string UrlEncode(string const & rawUrl)
113{
114 size_t const count = rawUrl.size();
115 string result;
116 result.reserve(count);
117
118 for (size_t i = 0; i < count; ++i)
119 {
120 char const c = rawUrl[i];
121 if (c < '-' || c == '/' || (c > '9' && c < 'A') || (c > 'Z' && c < '_') || c == '`' || (c > 'z' && c < '~') ||
122 c > '~')
123 {
124 result += '%';
125 result += NumToHex(c);
126 }
127 else
128 result += rawUrl[i];
129 }
130
131 return result;
132}
133
134string UrlDecode(string_view encodedUrl)
135{

Callers 9

UNIT_TESTFunction · 0.85
MakeRemoteURLFunction · 0.85
CreateNoteMethod · 0.85
TestOSMUserMethod · 0.85
BuildPostRequestFunction · 0.85
GenerateApiBackUrlMethod · 0.85
GetFileDownloadUrlFunction · 0.85
GenerateGeoUriFunction · 0.85
LatLonsToStringFunction · 0.85

Calls 3

NumToHexFunction · 0.85
sizeMethod · 0.45
reserveMethod · 0.45

Tested by 2

UNIT_TESTFunction · 0.68
TestOSMUserMethod · 0.68