Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ACE_HTTP_IOSTREAM_H
00010 #define ACE_HTTP_IOSTREAM_H
00011
00012 #include "ace/pre.h"
00013
00014 #include "ace/config-all.h"
00015
00016 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00017 # pragma once
00018 #endif
00019
00020 #include "ace/INet/INet_Export.h"
00021 #include "ace/INet/BufferedStreamBuffer.h"
00022 #include "ace/INet/HTTP_StreamPolicyBase.h"
00023 #include <ostream>
00024 #include <istream>
00025
00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00027
00028 namespace ACE
00029 {
00030 namespace HTTP
00031 {
00032
00033
00034
00035
00036
00037
00038
00039 class ACE_INET_Export StreamBuffer
00040 : public ACE::IOS::BufferedStreamBuffer
00041 {
00042 public:
00043 typedef StreamPolicyBase<StreamBuffer> policy_type;
00044
00045 StreamBuffer (std::iostream& stream, policy_type* policy = 0);
00046 virtual ~StreamBuffer ();
00047
00048 virtual int sync ();
00049
00050 protected:
00051 friend class StreamPolicyBase<StreamBuffer>;
00052
00053 enum
00054 {
00055 BUFFER_SIZE = 4096
00056 };
00057
00058 virtual int read_from_stream (char* buffer, std::streamsize length);
00059
00060 virtual int write_to_stream (const char* buffer, std::streamsize length);
00061
00062 virtual int read_from_stream_i (char* buffer, std::streamsize length);
00063
00064 virtual int write_to_stream_i (const char* buffer, std::streamsize length);
00065
00066 private:
00067 std::iostream & stream_;
00068 policy_type * policy_;
00069 };
00070
00071
00072
00073
00074
00075
00076
00077
00078 class ACE_INET_Export IOS
00079 : public virtual std::ios
00080 {
00081 public:
00082 IOS (std::iostream& stream, StreamBuffer::policy_type* policy = 0);
00083 ~IOS ();
00084
00085 StreamBuffer* rdbuf ();
00086
00087 protected:
00088 StreamBuffer streambuf_;
00089 };
00090
00091
00092
00093
00094
00095
00096
00097 class ACE_INET_Export OStream
00098 : public IOS, public std::ostream
00099 {
00100 public:
00101 explicit OStream(std::iostream& stream, StreamBuffer::policy_type* policy = 0);
00102 ~OStream();
00103
00104 void set_interceptor (StreamBuffer::interceptor_type& interceptor);
00105 };
00106
00107
00108
00109
00110
00111
00112
00113 class ACE_INET_Export IStream
00114 : public IOS, public std::istream
00115 {
00116 public:
00117 explicit IStream(std::iostream& stream, StreamBuffer::policy_type* policy = 0);
00118 ~IStream();
00119
00120 void set_interceptor (StreamBuffer::interceptor_type& interceptor);
00121 };
00122
00123 }
00124 }
00125
00126 ACE_END_VERSIONED_NAMESPACE_DECL
00127
00128 #if defined (__ACE_INLINE__)
00129 #include "ace/INet/HTTP_IOStream.inl"
00130 #endif
00131
00132 #include "ace/post.h"
00133 #endif