summaryrefslogtreecommitdiff
path: root/ace/Local_Tokens_T.i
blob: 1eb8881a464224769a431a4a11fbd413260e7733 (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
/* -*- C++ -*- */
// $Id$

// Local_Tokens_T.i

template <class TYPE> ACE_INLINE void 
ACE_Token_Name<TYPE>::operator= (const ACE_Token_Name<TYPE> &rhs)
{
  ACE_TRACE ("ACE_Token_Name<TYPE>::operator=");
  if (&rhs == this)
    return;
  else
    {
      this->type (rhs.type ());
      this->name (rhs.name ());
    }
}

template <class TYPE> ACE_INLINE int
ACE_Token_Name<TYPE>::operator== (const ACE_Token_Name<TYPE> &rhs) const
{
  ACE_TRACE ("ACE_Token_Name<TYPE>::operator==");

  // the name and type must be the same
  return (ACE_OS::strcmp (this->token_name_, rhs.name ()) == 0
	  && rhs.type () == type_);
}

template <class TYPE> ACE_INLINE const char*
ACE_Token_Name<TYPE>::name (void) const
{
  ACE_TRACE ("ACE_Token_Name<TYPE>::name");
  return this->token_name_;
}

template <class TYPE> ACE_INLINE void
ACE_Token_Name<TYPE>::name (const char *new_name)
{
  ACE_TRACE ("ACE_Token_Name<TYPE>::name");

  if (new_name == 0)
    return;

  int n = ACE_OS::strlen (new_name) + 1;

  if (n > ACE_MAXTOKENNAMELEN)
    n = ACE_MAXTOKENNAMELEN;

  ACE_OS::strncpy (this->token_name_, (char *) new_name, n);
}

template <class TYPE> ACE_INLINE TYPE
ACE_Token_Name<TYPE>::type (void) const
{
  ACE_TRACE ("ACE_Token_Name<TYPE>::type");
  return this->type_;
}

template <class TYPE> ACE_INLINE void
ACE_Token_Name<TYPE>::type (TYPE type)
{
  ACE_TRACE ("ACE_Token_Name<TYPE>::type");
  this->type_ = type;
}