Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Attributes

ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR > Class Template Reference

#include <String_IOStream.h>

Inheritance diagram for ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >:
Inheritance graph
[legend]
Collaboration diagram for ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef
BasicBufferedStreamBuffer
< ACE_CHAR_T, TR > 
super
typedef super::char_type char_type
typedef super::openmode openmode
typedef ACE_String_Base
< ACE_CHAR_T > 
string_type
typedef string_type::size_type size_type
typedef super::pos_type pos_type
typedef super::off_type off_type
typedef super::seekdir seekdir

Public Member Functions

 String_StreamBufferBase (openmode mode)
 String_StreamBufferBase (string_type &string, openmode mode)
virtual ~String_StreamBufferBase ()
const string_typestr () const
void close_string ()
void clear_string ()

Protected Member Functions

virtual int read_from_stream (char_type *buffer, std::streamsize length)
virtual int write_to_stream (const char_type *buffer, std::streamsize length)
virtual pos_type seekoff (off_type off, seekdir way, openmode which)
virtual pos_type seekpos (pos_type pos, openmode which)

Private Types

enum  { BUFFER_SIZE = 1024 }

Private Attributes

string_type string_
string_typestring_ref_
size_type rd_ptr_

Detailed Description

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
class ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >

Definition at line 33 of file String_IOStream.h.


Member Typedef Documentation

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
typedef super::char_type ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::char_type

Reimplemented from ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >.

Definition at line 38 of file String_IOStream.h.

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
typedef super::off_type ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::off_type

Reimplemented from ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >.

Definition at line 43 of file String_IOStream.h.

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
typedef super::openmode ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::openmode

Reimplemented from ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >.

Definition at line 39 of file String_IOStream.h.

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
typedef super::pos_type ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::pos_type

Reimplemented from ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >.

Definition at line 42 of file String_IOStream.h.

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
typedef super::seekdir ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::seekdir

Reimplemented from ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >.

Definition at line 44 of file String_IOStream.h.

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
typedef string_type::size_type ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::size_type

Definition at line 41 of file String_IOStream.h.

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
typedef ACE_String_Base<ACE_CHAR_T> ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::string_type

Definition at line 40 of file String_IOStream.h.

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
typedef BasicBufferedStreamBuffer<ACE_CHAR_T, TR> ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::super

Definition at line 37 of file String_IOStream.h.


Member Enumeration Documentation

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
anonymous enum [private]
Enumerator:
BUFFER_SIZE 

Definition at line 69 of file String_IOStream.h.

              {
                BUFFER_SIZE = 1024
              };


Constructor & Destructor Documentation

template<class ACE_CHAR_T , class TR >
ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::String_StreamBufferBase ( openmode  mode  ) 

Definition at line 18 of file String_IOStream.cpp.

      : BasicBufferedStreamBuffer<ACE_CHAR_T, TR> (BUFFER_SIZE, mode),
        string_ref_ (&string_),
        rd_ptr_ (0)
      {
      }

template<class ACE_CHAR_T , class TR >
ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::String_StreamBufferBase ( string_type string,
openmode  mode 
)

Definition at line 26 of file String_IOStream.cpp.

      : BasicBufferedStreamBuffer<ACE_CHAR_T, TR> (BUFFER_SIZE, mode),
        string_ref_ (&string),
        rd_ptr_ (0)
      {
      }

template<class ACE_CHAR_T , class TR >
ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::~String_StreamBufferBase (  )  [virtual]

Definition at line 34 of file String_IOStream.cpp.

      {
      }


Member Function Documentation

template<class ACE_CHAR_T , class TR >
void ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::clear_string (  ) 

Definition at line 89 of file String_IOStream.cpp.

      {
        this->sync ();
        this->string_ref_->clear ();
      }

template<class ACE_CHAR_T , class TR >
void ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::close_string (  ) 

Definition at line 82 of file String_IOStream.cpp.

      {
        this->sync ();
        this->string_ref_ = 0;
      }

template<class ACE_CHAR_T , class TR >
int ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::read_from_stream ( char_type buffer,
std::streamsize  length 
) [protected, virtual]

Reimplemented from ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >.

Definition at line 96 of file String_IOStream.cpp.

      {
        int n = 0;
        if (this->string_ref_)
          {
            if ((this->rd_ptr_ + length) > this->string_ref_->length ())
              {
                length = this->string_ref_->length () - this->rd_ptr_;
              }
            ACE_OS::memmove (buffer, &(*this->string_ref_)[this->rd_ptr_], length * sizeof (char_type));
            this->rd_ptr_ += length;
            n = ACE_Utils::truncate_cast<int> (length);
          }
        return n;
      }

template<class ACE_CHAR_T , class TR >
String_StreamBufferBase< ACE_CHAR_T, TR >::pos_type ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::seekoff ( off_type  off,
seekdir  way,
openmode  which 
) [protected, virtual]

Definition at line 40 of file String_IOStream.cpp.

      {

        if (which != this->get_mode () || which == std::ios::out)
          return pos_type (-1);

        size_type spos = 0;
        if (way == std::ios::cur)
          spos = this->rd_ptr_;
        else if (way == std::ios::end)
          spos = this->string_ref_->length ();
        spos += off;
        if (spos < this->string_ref_->length ())
          this->rd_ptr_ = spos;
        else
          this->rd_ptr_ = this->string_ref_->length ();

        this->setg (this->eback (), this->eback (), this->eback ());
        return pos_type (this->rd_ptr_);
      }

template<class ACE_CHAR_T , class TR >
String_StreamBufferBase< ACE_CHAR_T, TR >::pos_type ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::seekpos ( pos_type  pos,
openmode  which 
) [protected, virtual]

Definition at line 66 of file String_IOStream.cpp.

      {
        return this->seekoff (pos_type (pos), std::ios::beg, which);
      }

template<class ACE_CHAR_T , class TR >
const String_StreamBufferBase< ACE_CHAR_T, TR >::string_type & ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::str (  )  const

Definition at line 75 of file String_IOStream.cpp.

      {
        const_cast<String_StreamBufferBase<ACE_CHAR_T, TR>*> (this)->sync ();
        return *this->string_ref_;
      }

template<class ACE_CHAR_T , class TR >
int ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::write_to_stream ( const char_type buffer,
std::streamsize  length 
) [protected, virtual]

Reimplemented from ACE::IOS::BasicBufferedStreamBuffer< ACE_CHAR_T, TR >.

Definition at line 113 of file String_IOStream.cpp.

      {
        int n = 0;
        if (this->string_ref_)
          {
            this->string_ref_->append (buffer, length);
            n = ACE_Utils::truncate_cast<int> (length);
          }
        return n;
      }


Member Data Documentation

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
size_type ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::rd_ptr_ [private]

Definition at line 76 of file String_IOStream.h.

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
string_type ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::string_ [private]

Definition at line 74 of file String_IOStream.h.

template<class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T>>
string_type* ACE::IOS::String_StreamBufferBase< ACE_CHAR_T, TR >::string_ref_ [private]

Definition at line 75 of file String_IOStream.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines