@@ -30,42 +30,42 @@ namespace wallet {
3030class BC_API uri
3131{
3232public:
33+ typedef std::map<std::string, std::string> query_map;
34+
3335 DEFAULT_COPY_MOVE_DESTRUCT (uri);
3436 uri () NOEXCEPT {}
3537
3638 // / Decodes a URI from a string.
37- // / @param strict set to false to tolerate unescaped special characters.
38- bool decode (const std::string& encoded, bool strict=true ) NOEXCEPT;
39+ bool decode (const std::string& encoded) NOEXCEPT;
3940 std::string encoded () const NOEXCEPT;
4041
41- // / Returns the lowercased URI scheme.
42+ // / Returns the lowercased URI scheme (set empty to remove) .
4243 std::string scheme () const NOEXCEPT;
43- void set_scheme (const std::string& scheme) NOEXCEPT;
44+ bool has_scheme () const NOEXCEPT;
45+ bool set_scheme (const std::string& scheme) NOEXCEPT;
4446
4547 // / Obtains the unescaped authority part, if any (user@server:port).
4648 std::string authority () const NOEXCEPT;
4749 bool has_authority () const NOEXCEPT;
48- void set_authority (const std::string& authority) NOEXCEPT;
50+ bool set_authority (const std::string& authority) NOEXCEPT;
4951 void remove_authority () NOEXCEPT;
5052
5153 // / Obtains the unescaped path part.
5254 std::string path () const NOEXCEPT;
53- void set_path (const std::string& path) NOEXCEPT;
55+ bool set_path (const std::string& path) NOEXCEPT;
5456
5557 // / Returns the unescaped query string, if any.
5658 std::string query () const NOEXCEPT;
5759 bool has_query () const NOEXCEPT;
58- void set_query (const std::string& query) NOEXCEPT;
60+ bool set_query (const std::string& query) NOEXCEPT;
5961 void remove_query () NOEXCEPT;
6062
6163 // / Returns the unescaped fragment string, if any.
6264 std::string fragment () const NOEXCEPT;
6365 bool has_fragment () const NOEXCEPT;
64- void set_fragment (const std::string& fragment) NOEXCEPT;
66+ bool set_fragment (const std::string& fragment) NOEXCEPT;
6567 void remove_fragment () NOEXCEPT;
6668
67- typedef std::map<std::string, std::string> query_map;
68-
6969 // / Interprets the query string as a sequence of key-value pairs.
7070 // / All query strings are valid, so this function cannot fail.
7171 // / The results are unescaped. Both keys and values can be zero-length,
@@ -74,16 +74,8 @@ class BC_API uri
7474 void encode_query (const query_map& map) NOEXCEPT;
7575
7676private:
77- // All parts are stored with their original escaping.
78- std::string scheme_;
79- std::string authority_;
80- std::string path_;
81- std::string query_;
82- std::string fragment_;
83-
84- bool has_authority_ = false ;
85- bool has_query_ = false ;
86- bool has_fragment_ = false ;
77+ // Mutable URL object to store the parsed URI.
78+ boost::urls::url url_;
8779};
8880
8981} // namespace wallet
0 commit comments