mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Improve URL string conversions and ostream support
This commit is contained in:
@@ -155,7 +155,7 @@ public:
|
||||
{
|
||||
ParsedURL result (url);
|
||||
expect (result.error () == 0);
|
||||
expect (result.url ().full () == url);
|
||||
expect (result.url ().toString () == url);
|
||||
}
|
||||
|
||||
void testURL ()
|
||||
|
||||
@@ -128,7 +128,7 @@ String URL::userinfo () const
|
||||
|
||||
foo://username:password@example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose
|
||||
*/
|
||||
String URL::full () const
|
||||
String URL::toString () const
|
||||
{
|
||||
String s;
|
||||
|
||||
@@ -153,11 +153,22 @@ String URL::full () const
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string URL::to_string() const
|
||||
{
|
||||
return toString().toStdString();
|
||||
}
|
||||
|
||||
std::ostream& operator<< (std::ostream &os, URL const& url)
|
||||
{
|
||||
os << url.to_string();
|
||||
return os;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
std::size_t hash_value (URL const& v)
|
||||
{
|
||||
return std::size_t (v.full().hash());
|
||||
return std::size_t (v.toString().hash());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user