BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
url.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <fc/optional.hpp>
3 #include <stdint.h>
4 #include <fc/filesystem.hpp>
5 #include <fc/variant_object.hpp>
6 #include <memory>
7 
8 namespace fc {
9 
13 
14  namespace detail { class url_impl; }
15 
16  class mutable_url;
17 
22  class url
23  {
24  public:
25  url();
26  explicit url( const string& u );
27  url( const url& c );
28  url( url&& c );
29  url( mutable_url&& c );
30  url( const mutable_url& c );
31  ~url();
32 
33  url& operator=( const url& c );
34  url& operator=( url&& c );
35 
36  url& operator=( const mutable_url& c );
37  url& operator=( mutable_url&& c );
38 
39  bool operator==( const url& cmp )const;
40 
41  operator string()const;
42 
44  string proto()const;
45  ostring host()const;
46  ostring user()const;
47  ostring pass()const;
48  opath path()const;
49  ovariant_object args()const;
50  fc::optional<uint16_t> port()const;
51 
52  private:
53  friend class mutable_url;
54  std::shared_ptr<detail::url_impl> my;
55  };
56 
57  void to_variant( const url& u, fc::variant& v, uint32_t max_depth = 1 );
58  void from_variant( const fc::variant& v, url& u, uint32_t max_depth = 1 );
59 
64  {
65  public:
66  mutable_url();
67  explicit mutable_url( const string& mutable_url );
68  mutable_url( const mutable_url& c );
69  mutable_url( const url& c );
70  mutable_url( mutable_url&& c );
71  ~mutable_url();
72 
73  mutable_url& operator=( const url& c );
74  mutable_url& operator=( const mutable_url& c );
75  mutable_url& operator=( mutable_url&& c );
76 
77  bool operator==( const mutable_url& cmp )const;
78  bool operator==( const url& cmp )const;
79 
80  operator string()const;
81 
83  string proto()const;
84  ostring host()const;
85  ostring user()const;
86  ostring pass()const;
87  opath path()const;
88  ovariant_object args()const;
89  fc::optional<uint16_t> port()const;
90 
91  void set_proto( string );
92  void set_host( string );
93  void set_user( string );
94  void set_pass( string );
95  void set_path( fc::path p );
96  void set_args( variant_object );
97  void set_port( uint16_t );
98 
99  private:
100  friend class url;
101  std::unique_ptr<detail::url_impl> my;
102  };
103 
104 } // namespace fc
105 
An order-perserving dictionary of variant&#39;s.
bool operator==(const CBigNum &a, const CBigNum &b)
Definition: base58.cpp:495
void to_variant(const flat_set< T, A... > &var, variant &vo, uint32_t _max_depth)
Definition: flat.hpp:105
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object&#39;s.
Definition: variant.hpp:198
fc::optional< fc::variant_object > ovariant_object
Definition: url.hpp:12
fc::optional< std::string > ostring
Definition: url.hpp:10
void from_variant(const variant &var, flat_set< T, A... > &vo, uint32_t _max_depth)
Definition: flat.hpp:116
fc::optional< fc::path > opath
Definition: url.hpp:11
Definition: api.hpp:15
Definition: url.hpp:22
wraps boost::filesystem::path to provide platform independent path manipulation.
Definition: filesystem.hpp:28