- wxIPV4address();
- wxIPV4address(const wxIPV4address& other);
- virtual ~wxIPV4address();
-
- bool Hostname(const wxString& name);
- bool Hostname(unsigned long addr);
- bool Service(const wxString& name);
- bool Service(unsigned short port);
- bool LocalHost();
- bool AnyAddress();
-
- wxString Hostname();
- unsigned short Service();
-
- virtual int Type() { return wxSockAddress::IPV4; }
- virtual wxSockAddress *Clone() const { return new wxIPV4address(*this); }
+ wxIPaddress() : wxSockAddress() { }
+ wxIPaddress(const wxIPaddress& other)
+ : wxSockAddress(other),
+ m_origHostname(other.m_origHostname)
+ {
+ }
+
+ bool operator==(const wxIPaddress& addr) const;
+
+ bool Hostname(const wxString& name);
+ bool Service(const wxString& name);
+ bool Service(unsigned short port);
+
+ bool LocalHost();
+ virtual bool IsLocalHost() const = 0;
+
+ bool AnyAddress();
+
+ virtual wxString IPAddress() const = 0;
+
+ wxString Hostname() const;
+ unsigned short Service() const;
+
+ wxString OrigHostname() const { return m_origHostname; }
+
+protected:
+ // get m_impl initialized to the right family if it hadn't been done yet
+ wxSockAddressImpl& GetImpl();
+ const wxSockAddressImpl& GetImpl() const
+ {
+ return const_cast<wxIPaddress *>(this)->GetImpl();
+ }
+
+ // host name originally passed to Hostname()
+ wxString m_origHostname;
+
+private:
+ // create the wxSockAddressImpl object of the correct family if it's
+ // currently uninitialized
+ virtual void DoInitImpl() = 0;
+
+
+ DECLARE_ABSTRACT_CLASS(wxIPaddress)