summaryrefslogtreecommitdiff
path: root/TAO/tao/corbafwd.cpp
blob: 729c18788427f6f7439719f2ea997eab219d7a7c (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
82
83
84
85
86
87
// $Id$

#include "tao/corbafwd.h"

#if !defined (__ACE_INLINE__)
# include "tao/corbafwd.i"
#endif /* ! __ACE_INLINE__ */

#include "ace/OS.h"


ACE_RCSID (tao,
           corbafwd,
           "$Id$")


char *
CORBA::string_dup (const char *str)
{
  if (!str)
    {
      errno = EINVAL;
      return 0;
    }

  size_t len = ACE_OS::strlen (str);

  // This allocates an extra byte for the '\0';
  char * copy = CORBA::string_alloc (ACE_static_cast (CORBA::ULong, len));

  // The memcpy() below assumes that the destination is a valid buffer.
  if (copy == 0)
    {
      return 0;
    }

  ACE_OS::memcpy (copy,
                  str,
                  len + 1);
  return copy;
}

// ----------------------------------------------------------------------
// Wide strings
// ----------------------------------------------------------------------

CORBA::WChar*
CORBA::wstring_dup (const WChar *const str)
{
  if (!str)
    {
      errno = EINVAL;
      return 0;
    }

  CORBA::WChar* retval = CORBA::wstring_alloc (ACE_OS::wslen (str));

  // The wscpy() below assumes that the destination is a valid buffer.
  if (retval == 0)
    {
      return 0;
    }

  return ACE_OS::wscpy (retval,
                        str);
}

namespace CORBA
{
  // ****************************************************************

//  const CORBA::ServiceType Security = 1;

  // ****************************************************************

  CORBA::TypeCode_ptr _tc_Visibility = 0;

  const CORBA::Visibility PRIVATE_MEMBER = 0;
  const CORBA::Visibility PUBLIC_MEMBER  = 1;

  CORBA::TypeCode_ptr _tc_ValueModifier = 0;

  const CORBA::ValueModifier VM_NONE        = 0;
  const CORBA::ValueModifier VM_CUSTOM      = 1;
  const CORBA::ValueModifier VM_ABSTRACT    = 2;
  const CORBA::ValueModifier VM_TRUNCATABLE = 3;
}