MCPcopy Create free account
hub / github.com/SpartanJ/eepp / toString

Method toString

src/eepp/network/uri.cpp:149–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149std::string URI::toString() const {
150 std::string uri;
151 if ( isRelative() ) {
152 encode( mPath, RESERVED_PATH, uri );
153 } else {
154 uri = mScheme;
155 uri += ':';
156 std::string auth = getAuthority();
157 if ( !auth.empty() || mScheme == "file" ) {
158 uri.append( "//" );
159 uri.append( auth );
160 }
161 if ( !mPath.empty() ) {
162 if ( !auth.empty() && mPath[0] != '/' )
163 uri += '/';
164 encode( mPath, RESERVED_PATH, uri );
165 } else if ( !mQuery.empty() || !mFragment.empty() ) {
166 uri += '/';
167 }
168 }
169 if ( !mQuery.empty() ) {
170 uri += '?';
171 uri.append( mQuery );
172 }
173 if ( !mFragment.empty() ) {
174 uri += '#';
175 encode( mFragment, RESERVED_FRAGMENT, uri );
176 }
177 return uri;
178}
179
180std::string URI::getAuthorityAndPath() const {
181 std::string uri;

Callers 3

prepareMethod · 0.45
sendAsyncRequestMethod · 0.45
downloadAsyncRequestMethod · 0.45

Calls 3

encodeFunction · 0.85
emptyMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected