00001 // -*- C++ -*- 00002 // 00003 // URL_Addr.inl,v 1.5 2004/04/23 03:45:34 ossama Exp 00004 00005 #include "ace/ACE.h" 00006 #include "ace/INET_Addr.h" 00007 #include "ace/Log_Msg.h" 00008 #include "ace/OS_NS_string.h" 00009 00010 ACE_INLINE size_t 00011 ACEXML_URL_Addr::calculate_length (int ipaddr_format) const 00012 { 00013 return ACE_OS::strlen (ipaddr_format == 0 ? 00014 this->get_host_name () : this->get_host_addr ()) 00015 + ACE_OS::strlen ("65536") // Assume the max port number. 00016 + ACE_OS::strlen (this->get_path_name ()) 00017 + sizeof (':') 00018 + sizeof ('/') 00019 + sizeof ('\0'); // For trailing '\0'. 00020 } 00021 00022 ACE_INLINE void 00023 ACEXML_URL_Addr::operator= (const ACEXML_URL_Addr &addr) 00024 { 00025 if (this->set (addr) == -1) 00026 ACE_ERROR ((LM_ERROR, 00027 ACE_TEXT ("%p\n"), 00028 ACE_TEXT ("ACEXML_URL_Addr::ACEXML_URL_Addr"))); 00029 } 00030 00031 ACE_INLINE u_long 00032 ACEXML_URL_Addr::hash (void) const 00033 { 00034 u_long result = this->ACE_INET_Addr::hash () 00035 + ACE::hash_pjw (this->get_path_name ()); 00036 return result; 00037 } 00038 00039 ACE_INLINE bool 00040 ACEXML_URL_Addr::operator== (const ACEXML_URL_Addr &addr) const 00041 { 00042 return ACE_OS::strcmp (addr.get_path_name (), this->get_path_name ()) == 0 00043 && addr.get_port_number () == this->get_port_number () 00044 && addr.get_ip_address () == this->get_ip_address (); 00045 } 00046 00047 ACE_INLINE bool 00048 ACEXML_URL_Addr::operator!= (const ACEXML_URL_Addr &addr) const 00049 { 00050 return !(*this == addr); 00051 } 00052 00053 ACE_INLINE const ACEXML_Char * 00054 ACEXML_URL_Addr::get_path_name (void) const 00055 { 00056 return this->path_name_; 00057 } 00058 00059 ACE_INLINE int 00060 ACEXML_URL_Addr::destroy (void) 00061 { 00062 // Commit suicide. 00063 delete this; 00064 return 0; 00065 }