Functions

CORBA_String.cpp File Reference

#include "tao/CORBA_String.h"
#include "tao/String_Manager_T.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_wchar.h"
#include "ace/OS_Memory.h"
#include "ace/streams.h"
Include dependency graph for CORBA_String.cpp:

Go to the source code of this file.

Functions

ostream & operator<< (ostream &os, const CORBA::String_var &sv)
istream & operator>> (istream &is, CORBA::String_var &sv)
ostream & operator<< (ostream &os, CORBA::String_out &so)
istream & operator>> (istream &is, CORBA::String_out &so)
ostream & operator<< (ostream &os, const CORBA::WString_var &wsv)
istream & operator>> (istream &is, CORBA::WString_var &wsv)
ostream & operator<< (ostream &os, CORBA::WString_out &wso)
istream & operator>> (istream &is, CORBA::WString_out &wso)

Function Documentation

ostream& operator<< ( ostream &  os,
const CORBA::String_var sv 
)

Definition at line 28 of file CORBA_String.cpp.

{
  os << sv.in ();
  return os;
}

ostream& operator<< ( ostream &  os,
const CORBA::WString_var wsv 
)

Definition at line 66 of file CORBA_String.cpp.

{
  CORBA::ULong const len =
    static_cast <CORBA::ULong> (ACE_OS::strlen (wsv.in ()));

  for (CORBA::ULong i = 0; i < len; ++i)
    {
      os << wsv[i];
    }

  return os;
}

ostream& operator<< ( ostream &  os,
CORBA::WString_out wso 
)

Definition at line 105 of file CORBA_String.cpp.

{
  CORBA::WChar *tmp = wso.ptr ();
  const size_t len = ACE_OS::strlen (tmp);

  for (size_t i = 0; i < len; ++i)
    {
      os << tmp[i];
    }

  return os;
}

ostream& operator<< ( ostream &  os,
CORBA::String_out so 
)

Definition at line 45 of file CORBA_String.cpp.

{
  os << so.ptr ();
  return os;
}

istream& operator>> ( istream &  is,
CORBA::String_var sv 
)

Definition at line 35 of file CORBA_String.cpp.

{
  is.seekg (0, ios::end);
  sv = CORBA::string_alloc (is.tellg ());
  is.seekg (0, ios::beg);
  is >> sv.inout ();
  return is;
}

istream& operator>> ( istream &  is,
CORBA::String_out so 
)

Definition at line 52 of file CORBA_String.cpp.

{
  is.seekg (0, ios::end);
  so = CORBA::string_alloc (is.tellg ());
  is.seekg (0, ios::beg);
  is >> so.ptr ();
  return is;
}

istream& operator>> ( istream &  is,
CORBA::WString_var wsv 
)

Definition at line 80 of file CORBA_String.cpp.

{
  is.seekg (0, ios::end);
  // @@ is.tellg()/sizeof(CORBA::WChar) instead?
  CORBA::ULong const len = is.tellg ();
  wsv = CORBA::wstring_alloc (len);
  is.seekg (0, ios::beg);

  for (CORBA::ULong i = 0; i < len; ++i)
    {
      CORBA::WChar wc = 0;

      // Unformatted input is used to work around overloaded
      // extraction operator (>>) ambiguities on some platforms.
      is.read (reinterpret_cast<char *> (&wc), sizeof (wc));

      wsv[i] = wc;
    }

  wsv[len] = 0;  // NULL terminate

  return is;
}

istream& operator>> ( istream &  is,
CORBA::WString_out wso 
)

Definition at line 119 of file CORBA_String.cpp.

{
  is.seekg (0, ios::end);
  // @@ is.tellg()/sizeof(CORBA::WChar) instead?
  const CORBA::ULong len = is.tellg ();
  wso = CORBA::wstring_alloc (len);
  is.seekg (0, ios::beg);

  for (CORBA::ULong i = 0; i < len; ++i)
    {
      CORBA::WChar wc = 0;

      // Unformatted input is used to work around overloaded
      // extraction operator (>>) ambiguities on some platforms.
      is.read (reinterpret_cast<char *> (&wc), sizeof (wc));

      wso.ptr ()[i] = wc;
    }

  wso.ptr ()[len] = 0;  // NULL terminate

  return is;
}

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines