File: URL_Addr.inl

package info (click to toggle)
ace 6.0.3%2Bdfsg-0.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 49,368 kB
  • sloc: cpp: 341,826; perl: 30,850; ansic: 20,952; makefile: 10,144; sh: 4,744; python: 828; exp: 787; yacc: 511; xml: 330; lex: 158; lisp: 116; csh: 48; tcl: 5
file content (65 lines) | stat: -rw-r--r-- 1,669 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- C++ -*-
//
// $Id: URL_Addr.inl 80826 2008-03-04 14:51:23Z wotte $

#include "ace/ACE.h"
#include "ace/INET_Addr.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"

ACE_INLINE size_t
ACEXML_URL_Addr::calculate_length (int ipaddr_format) const
{
  return ACE_OS::strlen (ipaddr_format == 0 ?
                         this->get_host_name () : this->get_host_addr ())
                     + ACE_OS::strlen ("65536") // Assume the max port number.
                     + ACE_OS::strlen (this->get_path_name ())
                     + sizeof (':')
                     + sizeof ('/')
                     + sizeof ('\0'); // For trailing '\0'.
}

ACE_INLINE void
ACEXML_URL_Addr::operator= (const ACEXML_URL_Addr &addr)
{
  if (this->set (addr) == -1)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT ("%p\n"),
                ACE_TEXT ("ACEXML_URL_Addr::ACEXML_URL_Addr")));
}

ACE_INLINE u_long
ACEXML_URL_Addr::hash (void) const
{
  u_long result = this->ACE_INET_Addr::hash ()
                  + ACE::hash_pjw (this->get_path_name ());
  return result;
}

ACE_INLINE bool
ACEXML_URL_Addr::operator== (const ACEXML_URL_Addr &addr) const
{
  return ACE_OS::strcmp (addr.get_path_name (), this->get_path_name ()) == 0
    && addr.get_port_number () == this->get_port_number ()
    && addr.get_ip_address () == this->get_ip_address ();
}

ACE_INLINE bool
ACEXML_URL_Addr::operator!= (const ACEXML_URL_Addr &addr) const
{
  return !(*this == addr);
}

ACE_INLINE const ACEXML_Char *
ACEXML_URL_Addr::get_path_name (void) const
{
  return this->path_name_;
}

ACE_INLINE int
ACEXML_URL_Addr::destroy (void)
{
  // Commit suicide.
  delete this;
  return 0;
}