summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-06-02 01:33:11 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-06-02 01:33:11 +0000
commitcfce4ffb4ce9348de660d57b7d24a1c0399042a0 (patch)
treeffb9c1a959e9a6dc05d0f748eec2cc22de1a1a95
parentb7cf66bbb06ea944b33864f6daf731d7e3ca3952 (diff)
downloadATCD-cfce4ffb4ce9348de660d57b7d24a1c0399042a0.tar.gz
James CE Johnson's changes to remove old comments and make shift operators on QuotedString a template
-rw-r--r--ace/IOStream.h58
-rw-r--r--ace/IOStream_T.cpp42
-rw-r--r--ace/IOStream_T.h15
3 files changed, 25 insertions, 90 deletions
diff --git a/ace/IOStream.h b/ace/IOStream.h
index 1a9ac2886a5..4cc0c3bdfb6 100644
--- a/ace/IOStream.h
+++ b/ace/IOStream.h
@@ -17,64 +17,6 @@
//
// ============================================================================
-/*
- Changes 4/5/97
-
- ACE_Streambuf
-
- New public functions added
-
- char * reset_get_buffer( char * newbuf, u_int bufsiz, u_int inuse )
- char * reset_put_buffer( char * newbuf, u_int bufsiz, u_int inuse )
-
- Resets the get/put buffer and returns a pointer to the
- previous buffer.
-
- If newbuf is not NULL and bufsiz matches the current
- streambuf_size_ value, then the current buffer will
- be replaced by newbuf. If the stream sizes do not match,
- a NULL pointer is returned and the buffer left unchanged.
-
- If newbuf is NULL, a new buffer will be allocated from
- the heap.
-
- This kind of thing is handy if you're chaining streams.
- For instance, I have a stream built on a message queue
- which marshals and sends data from one thread to another.
- The receiving thread then sends that data to a peer()
- via a stream built on a socket. It is more efficient
- to simply replace the socket stream's put buffer with that
- of the message queue rather than copying the data from
- one to another.
-
- u_int streambuf_size( void )
-
- Get the size of the stream buffers. Note that the get
- and put buffers are the same size.
-
- New protected functions added
-
- void reset_base( void )
-
- Resets the base() pointers which toggle between get
- and put mode as well as the cur_mode_ value.
-
- Constructor changed
-
- Initialization of the get/put buffers was moved here from
- the derived class/template ACE_Streambuf_T<...>
-
- At the same time, the new functions reset_get/put_buffer
- are now used instead of the previous monolithic function.
-
- ACE_Streambuf_T<...>
-
- Constructor changed:
-
- Initialization of the get/put buffers has been moved to the
- baseclass ACE_Streambuf. This will reduce template bloat
- as well as giving us more functionality as described above.
- */
#if !defined (ACE_IOSTREAM_H)
#define ACE_IOSTREAM_H
diff --git a/ace/IOStream_T.cpp b/ace/IOStream_T.cpp
index 003ced1dbb5..813dc5a7e7f 100644
--- a/ace/IOStream_T.cpp
+++ b/ace/IOStream_T.cpp
@@ -132,56 +132,46 @@ ACE_IOStream_T<STREAM>::operator<< (ACE_IOStream_String & v)
// A more clever put operator for strings that knows how to
// deal with quoted strings containing back-quoted quotes.
//
-template <class STREAM> ACE_IOStream_T<STREAM> &
-ACE_IOStream_T<STREAM>::operator>> (QuotedString & str)
+template <class STREAM> STREAM &
+operator>> (STREAM & stream, QuotedString & str)
{
- if (ipfx0 ())
- {
char c;
- if (! (*this >> c)) // eat space up to the first char
- // this->set (ios::eofbit|ios::failbit);
- return *this;
+ if (! (stream >> c)) // eat space up to the first char
+ // stream.set (ios::eofbit|ios::failbit);
+ return stream;
str = ""; // Initialize the string
// if we don't have a quote, append until we see space
if (c != '"')
- for (str = c ; this->get (c) && !isspace (c) ; str += c)
+ for (str = c ; stream.get (c) && !isspace (c) ; str += c)
continue;
else
- for (; this->get (c) && c != '"' ; str += c)
+ for (; stream.get (c) && c != '"' ; str += c)
if (c == '\\')
{
- this->get (c);
+ stream.get (c);
if (c != '"')
str += '\\';
}
- }
-
- isfx ();
- return *this;
+ return stream;
}
-template <class STREAM> ACE_IOStream_T<STREAM> &
-ACE_IOStream_T<STREAM>::operator<< (QuotedString & str)
+template <class STREAM> STREAM &
+operator<< ( STREAM & stream, QuotedString & str)
{
- if (opfx ())
- {
- this->put ('"');
+ stream.put ('"');
for (u_int i = 0 ; i < str.length () ; ++i)
{
if (str[i] == '"')
- this->put ('\\');
- this->put (str[i]);
+ stream.put ('\\');
+ stream.put (str[i]);
}
- this->put ('"');
- }
+ stream.put ('"');
- osfx ();
-
- return *this;
+ return stream;
}
#endif /* ACE_HAS_STRING_CLASS */
diff --git a/ace/IOStream_T.h b/ace/IOStream_T.h
index 51e74447d70..a654902291f 100644
--- a/ace/IOStream_T.h
+++ b/ace/IOStream_T.h
@@ -30,6 +30,15 @@
///////////////////////////////////////////////////////////////////////////
+#if defined (ACE_HAS_STRING_CLASS)
+
+template <class STREAM> STREAM & operator>> (STREAM & stream, QuotedString & str);
+template <class STREAM> STREAM & operator<< ( STREAM & stream, QuotedString & str);
+
+#endif // defined (ACE_HAS_STRING_CLASS)
+
+///////////////////////////////////////////////////////////////////////////
+
template <class STREAM>
class ACE_Streambuf_T : public ACE_Streambuf
{
@@ -129,12 +138,6 @@ public:
virtual ACE_IOStream_T<STREAM> & operator<<(ACE_IOStream_String & v);
// The converse of the String put operator.
- virtual ACE_IOStream_T<STREAM> & operator>>(QuotedString &v);
- // A more clever operator that handles quoted strings so that we
- // can get strings containing whitespace!
-
- virtual ACE_IOStream_T<STREAM> & operator<<(QuotedString &v);
- // The converse of the QuotedString put operator.
#endif /* ACE_HAS_STRING_CLASS */
// = Using the macros to provide get/set operators.