diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2011-09-06 08:15:41 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2011-09-06 08:15:41 +0000 |
commit | 8dba354065f66eaa4c741774e76b648252c4e6c2 (patch) | |
tree | 1be54adf1c775d78abd311764e8cf9ca705c1fac /TAO/tao/AnyTypeCode | |
parent | 9ecda125f723d3179e9f2c9bfee0b34d491eb17f (diff) | |
download | ATCD-8dba354065f66eaa4c741774e76b648252c4e6c2.tar.gz |
Tue Sep 6 08:14:42 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl>
* tao/AnyTypeCode/Any.h:
* tao/AnyTypeCode/Any.cpp:
Added support for std::wstring
Diffstat (limited to 'TAO/tao/AnyTypeCode')
-rw-r--r-- | TAO/tao/AnyTypeCode/Any.cpp | 28 | ||||
-rw-r--r-- | TAO/tao/AnyTypeCode/Any.h | 8 |
2 files changed, 35 insertions, 1 deletions
diff --git a/TAO/tao/AnyTypeCode/Any.cpp b/TAO/tao/AnyTypeCode/Any.cpp index 279f45ff238..b3cc6a9e3b0 100644 --- a/TAO/tao/AnyTypeCode/Any.cpp +++ b/TAO/tao/AnyTypeCode/Any.cpp @@ -527,9 +527,23 @@ operator <<= (CORBA::Any &any, const std::string & str) void operator <<= (CORBA::Any &, std::string *) { - // TODO + // @todo } +#if !defined(ACE_LACKS_STD_WSTRING) +void +operator <<= (CORBA::Any &any, const std::wstring & str) +{ + any <<= str.c_str (); +} + +void +operator <<= (CORBA::Any &, std::wstring *) +{ + // @todo +} +#endif + // Extraction: these are safe and hence we have to check that the // typecode of the Any is equal to the one we are trying to extract // into. @@ -745,6 +759,18 @@ operator >>= (const CORBA::Any &any, std::string &str) return flag; } +#if !defined(ACE_LACKS_STD_WSTRING) +CORBA::Boolean +operator >>= (const CORBA::Any &any, std::wstring &str) +{ + const wchar_t *buf = 0; + CORBA::Boolean const flag = any >>= buf; + str.assign (buf); + ACE::strdelete (const_cast <wchar_t *> (buf)); + return flag; +} +#endif + #ifdef ACE_ANY_OPS_USE_NAMESPACE } #endif diff --git a/TAO/tao/AnyTypeCode/Any.h b/TAO/tao/AnyTypeCode/Any.h index 9ff3890fc22..a3a8b2f6088 100644 --- a/TAO/tao/AnyTypeCode/Any.h +++ b/TAO/tao/AnyTypeCode/Any.h @@ -308,6 +308,10 @@ TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const CORBA::Object_ptr); TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, CORBA::Object_ptr *); TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const std::string &); TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, std::string *); +#if !defined(ACE_LACKS_STD_WSTRING) +TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, const std::wstring &); +TAO_AnyTypeCode_Export void operator<<= (CORBA::Any &, std::wstring *); +#endif /// Typesafe extraction. @@ -339,6 +343,10 @@ TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, const CORBA::WChar *&); TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, std::string &); +#if !defined(ACE_LACKS_STD_WSTRING) +TAO_AnyTypeCode_Export CORBA::Boolean operator>>= (const CORBA::Any &, + std::wstring &); +#endif #ifdef ACE_ANY_OPS_USE_NAMESPACE } |