49 NO_PORT |
49 NO_PORT |
50 }; |
50 }; |
51 |
51 |
52 class StringParseError : public std::exception |
52 class StringParseError : public std::exception |
53 { |
53 { |
54 String m_message; |
54 std::string m_message; |
55 |
55 |
56 public: |
56 public: |
57 StringParseError (String message) : |
57 StringParseError (std::string message) : |
58 m_message (message) {} |
58 m_message (message) {} |
59 |
59 |
60 const char* what() const throw() |
60 const char* what() const throw() |
61 { |
61 { |
62 return m_message.data(); |
62 return m_message.data(); |
71 IPAddress (const IPAddress& other); |
71 IPAddress (const IPAddress& other); |
72 |
72 |
73 bool compare (const IPAddress& other) const; |
73 bool compare (const IPAddress& other) const; |
74 unsigned char octet (int n) const; |
74 unsigned char octet (int n) const; |
75 void set_octet (int n, unsigned char oct); |
75 void set_octet (int n, unsigned char oct); |
76 String to_string (WithPort withport = NO_PORT) const; |
76 std::string to_string (WithPort withport = NO_PORT) const; |
77 sockaddr_in to_sockaddr_in() const; |
77 sockaddr_in to_sockaddr_in() const; |
78 bool operator< (const IPAddress& other) const; |
78 bool operator< (const IPAddress& other) const; |
79 bool operator== (const IPAddress& other) const { return compare (other); } |
79 bool operator== (const IPAddress& other) const { return compare (other); } |
80 bool operator!= (const IPAddress& other) const { return not compare (other); } |
80 bool operator!= (const IPAddress& other) const { return not compare (other); } |
81 unsigned char operator[] (int n) const { return octet (n); } |
81 unsigned char operator[] (int n) const { return octet (n); } |
82 |
82 |
83 static IPAddress from_string (String input); |
83 static IPAddress from_string (std::string input); |
84 static IPAddress resolve (String node); |
84 static IPAddress resolve (std::string node); |
85 }; |
85 }; |
86 |
86 |
87 END_ZFC_NAMESPACE |
87 END_ZFC_NAMESPACE |