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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
// $Id$
#define ACE_BUILD_DLL
#include "ace/FILE_Addr.h"
#if !defined (__ACE_INLINE__)
#include "ace/FILE_Addr.i"
#endif /* __ACE_INLINE__ */
ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Addr)
ACE_FILE_Addr::ACE_FILE_Addr (void)
: ACE_Addr (AF_FILE, sizeof this->filename_)
{
this->filename_[0] = '\0';
}
int
ACE_FILE_Addr::set (const ACE_FILE_Addr &sa)
{
this->base_set (sa.get_type (), sa.get_size ());
if (sa.get_type () == AF_ANY)
this->filename_[0] = '\0';
else
(void) ACE_OS::strncpy (this->filename_,
sa.filename_,
sa.get_size ());
return 0;
}
// Copy constructor.
ACE_FILE_Addr::ACE_FILE_Addr (const ACE_FILE_Addr &sa)
{
this->set (sa);
}
void
ACE_FILE_Addr::set (LPCTSTR filename)
{
this->ACE_Addr::base_set (AF_FILE,
ACE_OS::strlen (filename) + 1);
(void) ACE_OS::strncpy (this->filename_,
filename,
sa.get_size ());
}
ACE_FILE_Addr &
ACE_FILE_Addr::operator= (const ACE_FILE_Addr &sa)
{
if (this != &sa)
this->set (sa);
return *this;
}
// Create a ACE_Addr from a ACE_FILE pathname.
ACE_FILE_Addr::ACE_FILE_Addr (LPCTSTR filename)
{
this->set (filename);
}
int
ACE_FILE_Addr::addr_to_string (char *s, size_t len) const
{
ACE_OS::strncpy (s,
ACE_MULTIBYTE_STRING (this->filename_),
len);
return 0;
}
#if defined (UNICODE)
// Transform the current address into string format.
int
ACE_FILE_Addr::addr_to_string (wchar_t * s, size_t len) const
{
ACE_OS::strncpy (s, this->filename_, len);
return 0;
}
#endif /* UNICODE */
void
ACE_FILE_Addr::dump (void) const
{
ACE_TRACE ("ACE_FILE_Addr::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("filename_ = %s"), this->filename_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
|