summaryrefslogtreecommitdiff
path: root/ACE/ace/Name_Space.cpp
blob: 0e1228909a52b62f24c7de1da5287496d8b7cfc3 (plain)
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
// Name_Space.cpp
#include "ace/Name_Space.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_stdlib.h"



ACE_BEGIN_VERSIONED_NAMESPACE_DECL

ACE_Name_Binding::ACE_Name_Binding ()
  : name_ (),
    value_ (),
    type_ (ACE_OS::strdup (""))
{
  ACE_TRACE ("ACE_Name_Binding::ACE_Name_Binding");
}


ACE_Name_Binding::~ACE_Name_Binding ()
{
  ACE_TRACE ("ACE_Name_Binding::~ACE_Name_Binding");
#if defined (ACE_HAS_ALLOC_HOOKS)
  ACE_Allocator::instance()->free ((void *) this->type_);
#else
  ACE_OS::free ((void *) this->type_);
#endif /* ACE_HAS_ALLOC_HOOKS */
}

ACE_Name_Binding::ACE_Name_Binding (const ACE_NS_WString &name,
                                    const ACE_NS_WString &value,
                                    const char *type)
  : name_ (name),
    value_ (value),
    type_ (type == 0 ? ACE_OS::strdup ("") : ACE_OS::strdup (type))
{
  ACE_TRACE ("ACE_Name_Binding::ACE_Name_Binding");
}

ACE_Name_Binding::ACE_Name_Binding (const ACE_Name_Binding &s)
  : name_ (s.name_),
    value_ (s.value_),
    type_ (ACE_OS::strdup (s.type_))
{
  ACE_TRACE ("ACE_Name_Binding::ACE_Name_Binding");
}

const ACE_Name_Binding&
ACE_Name_Binding::operator = (const ACE_Name_Binding &s)
{
  ACE_TRACE ("ACE_Name_Binding::operator =");

  if (this != &s)
    {
#if defined (ACE_HAS_ALLOC_HOOKS)
      ACE_Allocator::instance()->free ((void *) this->type_);
#else
      ACE_OS::free ((void *) this->type_);
#endif /* ACE_HAS_ALLOC_HOOKS */
      this->name_ = s.name_;
      this->value_ = s.value_;
      this->type_ = ACE_OS::strdup (s.type_);
    }

  return *this;
}

bool
ACE_Name_Binding::operator == (const ACE_Name_Binding &s) const
{
  ACE_TRACE ("ACE_Name_Binding::operator ==");
  return this->name_ == s.name_
    && this->value_ == s.value_
    && ACE_OS::strcmp (this->type_, s.type_) == 0;
}

ACE_Name_Space::~ACE_Name_Space ()
{
  ACE_TRACE ("ACE_Name_Space::~ACE_Name_Space");
}

ACE_END_VERSIONED_NAMESPACE_DECL