35 Impl(
const std::string & command_r )
38 Impl(
const std::string & command_r,
const std::string body_r )
42 Impl( std::istream & stream_r );
53 if ( command_r.find(
'\n' ) != std::string::npos )
58 const std::string &
body()
const
64 void setBody(
const std::string & body_r )
69 typedef std::pair<HeaderList::iterator,HeaderList::iterator>
KeyRange;
77 const std::string &
getHeader(
const std::string & key_r )
const
80 if ( r.first == r.second )
82 const std::string & ret( r.first->second );
83 if ( ++r.first != r.second )
88 const std::string &
getHeader(
const std::string & key_r,
const std::string & default_r )
const
91 if ( r.first == r.second )
93 const std::string & ret( r.first->second );
94 if ( ++r.first != r.second )
99 const std::string &
getHeaderNT(
const std::string & key_r,
const std::string & default_r )
const
102 return iter !=
_header.end() ? iter->second : default_r;
105 HeaderList::value_type
mkHeaderPair(
const std::string & key_r,
const std::string & value_r )
107 if ( key_r.find_first_of(
":\n" ) != std::string::npos )
109 if ( value_r.find_first_of(
":\n" ) != std::string::npos )
111 return HeaderList::value_type( key_r, value_r );
114 void setHeader(
const std::string & key_r,
const std::string & value_r )
120 void addHeader(
const std::string & key_r,
const std::string & value_r )
131 std::ostream &
writeTo( std::ostream & stream_r )
const;
142 static shared_ptr<Impl> _nullimpl(
new Impl );
146 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
149 {
return new Impl( *
this ); }
156 return str <<
"PluginFrame[" << obj.
command() <<
"](" << obj.
headerList().size() <<
"){" << obj.
body().size() <<
"}";
174 if ( ! stream_r.good() )
180 if ( ! stream_r.good() )
187 if ( sep == std::string::npos )
190 _header.insert( HeaderList::value_type( data.substr(0,sep), data.substr(sep+1) ) );
195 if ( ! stream_r.good() )
206 stream_r << _command << endl;
208 for_( it, _header.begin(), _header.end() )
209 stream_r << it->first <<
':' << it->second << endl;
227 static std::string _val(
"ACK" );
233 static std::string _val(
"ERROR" );
242 : _pimpl( new
Impl( command_r ) )
246 : _pimpl( new
Impl( command_r, body_r ) )
250 : _pimpl( new
Impl( stream_r ) )
301 {
return str << *obj.
_pimpl; }