summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-10 23:11:51 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-10 23:11:51 +0000
commit09a58441656d76d5bce4f13e0b83e8f28cbf530d (patch)
tree7d5893ec0249d2db4c8c19c44b9c43f3eabd933c
parent1bb25d0e1a9da613bc39658196be076ca90f6461 (diff)
downloadATCD-09a58441656d76d5bce4f13e0b83e8f28cbf530d.tar.gz
Added all the necessary stuff for wstrings.
-rw-r--r--ace/CDR_Stream.h30
-rw-r--r--ace/CDR_Stream.i48
2 files changed, 77 insertions, 1 deletions
diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h
index 72a476628c1..7e4ed49e2f2 100644
--- a/ace/CDR_Stream.h
+++ b/ace/CDR_Stream.h
@@ -313,6 +313,16 @@ public:
ACE_CDR::Boolean nocopy_;
};
+ struct ACE_Export from_wstring
+ {
+ from_wstring (ACE_CDR::WChar* ws,
+ ACE_CDR::ULong b,
+ ACE_CDR::Boolean nocopy = 0);
+ ACE_CDR::WChar *val_;
+ ACE_CDR::ULong bound_;
+ ACE_CDR::Boolean nocopy_;
+ };
+
// = We have one method per basic IDL type....
// They return 0 on failure and 1 on success.
ACE_CDR::Boolean write_boolean (ACE_CDR::Boolean x);
@@ -607,11 +617,20 @@ public:
struct ACE_Export to_string
{
- to_string (ACE_CDR::Char *&s, ACE_CDR::ULong b);
+ to_string (ACE_CDR::Char *&s,
+ ACE_CDR::ULong b);
ACE_CDR::Char *&val_;
ACE_CDR::ULong bound_;
};
+ struct ACE_Export to_wstring
+ {
+ to_wstring (ACE_CDR::WChar *&ws,
+ ACE_CDR::ULong b);
+ ACE_CDR::WChar *&val_;
+ ACE_CDR::ULong bound_;
+ };
+
// = We have one method per basic IDL type....
// They return 0 on failure and 1 on success.
ACE_CDR::Boolean read_boolean (ACE_CDR::Boolean& x);
@@ -1018,7 +1037,12 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_OutputCDR::from_string x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
+ ACE_OutputCDR::from_wstring x);
+extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
const ACE_CDR::Char* x);
+extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
+ const ACE_CDR::WChar* x);
+
// CDR input operators for primitive types
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Short &x);
@@ -1053,7 +1077,11 @@ extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_InputCDR::to_string x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
+ ACE_InputCDR::to_wstring x);
+extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Char*& x);
+extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
+ ACE_CDR::WChar*& x);
#endif /* __ACE_INLINE */
diff --git a/ace/CDR_Stream.i b/ace/CDR_Stream.i
index 27530c7032b..6c867e49a74 100644
--- a/ace/CDR_Stream.i
+++ b/ace/CDR_Stream.i
@@ -140,6 +140,24 @@ ACE_InputCDR::to_string::to_string (ACE_CDR::Char *&s,
{
}
+ACE_INLINE
+ACE_OutputCDR::from_wstring::from_wstring (ACE_CDR::WChar *ws,
+ ACE_CDR::ULong b,
+ ACE_CDR::Boolean nocopy)
+ : val_ (ws),
+ bound_ (b),
+ nocopy_ (nocopy)
+{
+}
+
+ACE_INLINE
+ACE_InputCDR::to_wstring::to_wstring (ACE_CDR::WChar *&ws,
+ ACE_CDR::ULong b)
+ : val_ (ws),
+ bound_ (b)
+{
+}
+
// ****************************************************************
ACE_INLINE
@@ -939,6 +957,13 @@ operator<< (ACE_OutputCDR &os, const ACE_CDR::Char *x)
}
ACE_INLINE ACE_CDR::Boolean
+operator<< (ACE_OutputCDR &os, const ACE_CDR::WChar *x)
+{
+ os.write_wstring (x);
+ return os.good_bit ();
+}
+
+ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, const ACE_CString &x)
{
os.write_string (x);
@@ -981,6 +1006,13 @@ operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_string x)
return os.good_bit ();
}
+ACE_INLINE ACE_CDR::Boolean
+operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wstring x)
+{
+ os.write_wstring (x.bound_, x.val_);
+ return os.good_bit ();
+}
+
// ****************************************************************
ACE_INLINE ACE_CDR::Boolean
@@ -1054,6 +1086,13 @@ operator>> (ACE_InputCDR &is, ACE_CDR::Char *&x)
}
ACE_INLINE ACE_CDR::Boolean
+operator>> (ACE_InputCDR &is, ACE_CDR::WChar *&x)
+{
+ is.read_wstring (x);
+ return is.good_bit ();
+}
+
+ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CString &x)
{
is.read_string (x);
@@ -1098,6 +1137,15 @@ operator>> (ACE_InputCDR &is, ACE_InputCDR::to_string x)
(ACE_OS::strlen (x.val_) <= x.bound_));
}
+ACE_INLINE ACE_CDR::Boolean
+operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wstring x)
+{
+ is.read_wstring (x.val_);
+ // check if the bounds are satisfied
+ return (is.good_bit () &&
+ (ACE_OS::wslen (x.val_) <= x.bound_));
+}
+
// ***************************************************************************
// We must define these methods here because they use the "read_*" inlined
// methods of the ACE_InputCDR class