#include <PluginFrame.h>
Classes | |
struct | Impl |
PluginFrame implementation. More... | |
Public Types | |
typedef PluginFrameException | Exception |
Default exception type. | |
typedef std::multimap < std::string, std::string > | HeaderList |
The header list. | |
typedef HeaderList::const_iterator | HeaderListIterator |
Header list iterator. | |
Public Member Functions | |
PluginFrame () | |
Default ctor (empty frame). | |
PluginFrame (const std::string &command_r) | |
Ctor taking the command. | |
PluginFrame (const std::string &command_r, const std::string body_r) | |
Ctor taking command and body. | |
PluginFrame (std::istream &stream_r) | |
Ctor reading frame data from a stream. | |
bool | empty () const |
Whether this is an empty frame. | |
const std::string & | command () const |
Return the frame command. | |
void | setCommand (const std::string &command_r) |
Set the frame command. | |
const std::string & | body () const |
Return the frame body. | |
std::string & | bodyRef () |
Return a reference to the frame body. | |
void | setBody (const std::string &body_r) |
Set the frame body. | |
const HeaderList & | headerList () const |
The header list. | |
bool | headerEmpty () const |
Whether header list is empty. | |
unsigned | headerSize () const |
Return size of the header list. | |
HeaderListIterator | headerBegin () const |
Return iterator pointing to the 1st header (or headerEnd). | |
HeaderListIterator | headerEnd () const |
Return iterator pointing behind the last header. | |
void | headerClear () |
Clear the list of headers. | |
bool | hasKey (const std::string &key_r) const |
Whether the header list contains at least one entry for key_r . | |
bool | keyEmpty (const std::string &key_r) const |
bool | keySize (const std::string &key_r) const |
Return number of header entires for key_r . | |
HeaderListIterator | keyBegin (const std::string &key_r) const |
Return iterator pointing to the 1st header for key_r (or keyEnd(key_r)). | |
HeaderListIterator | keyEnd (const std::string &key_r) const |
Return iterator pointing behind the last header for key_r . | |
const std::string & | getHeader (const std::string &key_r) const |
Return header value for key_r . | |
const std::string & | getHeader (const std::string &key_r, const std::string &default_r) const |
Return header value for key_r or default_r if it does not exist. | |
const std::string & | getHeaderNT (const std::string &key_r, const std::string &default_r=std::string()) const |
Not throwing version returing one of the matching header values or default_r string. | |
void | setHeader (const std::string &key_r, const std::string &value_r=std::string()) |
Set header for key_r removing all other occurences of key_r . | |
void | addHeader (const std::string &key_r, const std::string &value_r=std::string()) |
Add header for key_r leaving already existing headers for key_r unchanged. | |
void | clearHeader (const std::string &key_r) |
Remove all headers for key_r . | |
std::ostream & | writeTo (std::ostream &stream_r) const |
Write frame to stream. | |
std::istream & | readFrom (std::istream &stream_r) |
Read frame from stream. | |
Static Public Member Functions | |
static std::ostream & | writeTo (std::ostream &stream_r, const PluginFrame &frame_r) |
static std::istream & | readFrom (std::istream &stream_r, PluginFrame &frame_r) |
Private Member Functions | |
HeaderList & | headerList () |
Modifyalble header list for internal use only. | |
friend | base::SafeBool () const |
bool | boolTest () const |
Evaluate in a boolean context. | |
Private Attributes | |
RWCOW_pointer< Impl > | _pimpl |
Pointer to implementation. | |
Friends | |
std::ostream & | operator<< (std::ostream &str, const PluginFrame &obj) |
bool | operator== (const PluginFrame &lhs, const PluginFrame &rhs) |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | dumpOn (std::ostream &str, const PluginFrame &obj) |
std::istream & | operator>> (std::istream &str, PluginFrame &obj) |
bool | operator!= (const PluginFrame &lhs, const PluginFrame &rhs) |
COMMAND key:value header lines multiline body separated from header by an empty line and terminated by NUL. ^@
Definition at line 41 of file PluginFrame.h.
typedef std::multimap<std::string, std::string> zypp::PluginFrame::HeaderList |
typedef HeaderList::const_iterator zypp::PluginFrame::HeaderListIterator |
zypp::PluginFrame::PluginFrame | ( | ) |
Default ctor (empty frame).
Definition at line 225 of file PluginFrame.cc.
Referenced by readFrom().
zypp::PluginFrame::PluginFrame | ( | const std::string & | command_r | ) |
Ctor taking the command.
PluginFrameException | If setCommand throws |
Definition at line 229 of file PluginFrame.cc.
zypp::PluginFrame::PluginFrame | ( | const std::string & | command_r, | |
const std::string | body_r | |||
) |
Ctor taking command and body.
PluginFrameException | If setCommand throws |
Definition at line 233 of file PluginFrame.cc.
zypp::PluginFrame::PluginFrame | ( | std::istream & | stream_r | ) |
Ctor reading frame data from a stream.
PluginFrameException | On error reading from stream | |
PluginFrameException | On error parsing the data |
Definition at line 237 of file PluginFrame.cc.
bool zypp::PluginFrame::empty | ( | ) | const |
Whether this is an empty frame.
Definition at line 241 of file PluginFrame.cc.
References _pimpl.
Referenced by boolTest().
const std::string & zypp::PluginFrame::command | ( | ) | const |
Return the frame command.
Definition at line 244 of file PluginFrame.cc.
References _pimpl.
Referenced by zypp::operator==(), and zypp::PluginScript::Impl::send().
void zypp::PluginFrame::setCommand | ( | const std::string & | command_r | ) |
Set the frame command.
PluginFrameException | If illegal command string (e.g. multiline) |
Definition at line 247 of file PluginFrame.cc.
References _pimpl.
const std::string & zypp::PluginFrame::body | ( | ) | const |
Return the frame body.
Definition at line 250 of file PluginFrame.cc.
References _pimpl.
Referenced by zypp::operator==().
std::string & zypp::PluginFrame::bodyRef | ( | ) |
Return a reference to the frame body.
This may avoid creating unnecessary copies if you want to manipulate large body data.
std::string tmp; frame.bodyRef().swap( tmp );
Definition at line 253 of file PluginFrame.cc.
References _pimpl.
void zypp::PluginFrame::setBody | ( | const std::string & | body_r | ) |
PluginFrame::HeaderList & zypp::PluginFrame::headerList | ( | ) | [private] |
Modifyalble header list for internal use only.
Definition at line 262 of file PluginFrame.cc.
References _pimpl.
Referenced by headerBegin(), headerClear(), headerEmpty(), headerEnd(), headerSize(), keyBegin(), keyEmpty(), keyEnd(), keySize(), and zypp::operator==().
const PluginFrame::HeaderList & zypp::PluginFrame::headerList | ( | ) | const |
bool zypp::PluginFrame::headerEmpty | ( | ) | const [inline] |
Whether header list is empty.
Definition at line 117 of file PluginFrame.h.
References headerList().
unsigned zypp::PluginFrame::headerSize | ( | ) | const [inline] |
Return size of the header list.
Definition at line 121 of file PluginFrame.h.
References headerList().
HeaderListIterator zypp::PluginFrame::headerBegin | ( | ) | const [inline] |
Return iterator pointing to the 1st header (or headerEnd).
Definition at line 125 of file PluginFrame.h.
References headerList().
HeaderListIterator zypp::PluginFrame::headerEnd | ( | ) | const [inline] |
Return iterator pointing behind the last header.
Definition at line 129 of file PluginFrame.h.
References headerList().
Referenced by keyEmpty().
void zypp::PluginFrame::headerClear | ( | ) | [inline] |
bool zypp::PluginFrame::hasKey | ( | const std::string & | key_r | ) | const [inline] |
Whether the header list contains at least one entry for key_r
.
Definition at line 138 of file PluginFrame.h.
References keyEmpty().
bool zypp::PluginFrame::keyEmpty | ( | const std::string & | key_r | ) | const [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 142 of file PluginFrame.h.
References headerEnd(), and headerList().
Referenced by hasKey().
bool zypp::PluginFrame::keySize | ( | const std::string & | key_r | ) | const [inline] |
Return number of header entires for key_r
.
Definition at line 146 of file PluginFrame.h.
References headerList().
HeaderListIterator zypp::PluginFrame::keyBegin | ( | const std::string & | key_r | ) | const [inline] |
Return iterator pointing to the 1st header for key_r
(or keyEnd(key_r)).
Definition at line 150 of file PluginFrame.h.
References headerList().
HeaderListIterator zypp::PluginFrame::keyEnd | ( | const std::string & | key_r | ) | const [inline] |
Return iterator pointing behind the last header for key_r
.
Definition at line 154 of file PluginFrame.h.
References headerList().
const std::string & zypp::PluginFrame::getHeader | ( | const std::string & | key_r | ) | const |
Return header value for key_r
.
PluginFrameException | If no header for key_r exists. | |
PluginFrameException | If multiple header for key_r exist. |
Definition at line 268 of file PluginFrame.cc.
References _pimpl.
const std::string & zypp::PluginFrame::getHeader | ( | const std::string & | key_r, | |
const std::string & | default_r | |||
) | const |
Return header value for key_r
or default_r
if it does not exist.
PluginFrameException | If multiple header for key_r exist. |
Definition at line 271 of file PluginFrame.cc.
References _pimpl.
const std::string & zypp::PluginFrame::getHeaderNT | ( | const std::string & | key_r, | |
const std::string & | default_r = std::string() | |||
) | const |
Not throwing version returing one of the matching header values or default_r
string.
Definition at line 274 of file PluginFrame.cc.
References _pimpl.
void zypp::PluginFrame::setHeader | ( | const std::string & | key_r, | |
const std::string & | value_r = std::string() | |||
) |
Set header for key_r
removing all other occurences of key_r
.
PluginFrameException | If key contains illegal chars (NL or :) | |
PluginFrameException | If value contains illegal chars (NL ) |
Definition at line 277 of file PluginFrame.cc.
References _pimpl.
Referenced by zypp::media::UrlResolverPlugin::resolveUrl().
void zypp::PluginFrame::addHeader | ( | const std::string & | key_r, | |
const std::string & | value_r = std::string() | |||
) |
Add header for key_r
leaving already existing headers for key_r
unchanged.
PluginFrameException | If key contains illegal chars (NL or :) | |
PluginFrameException | If value contains illegal chars (NL ) |
Definition at line 280 of file PluginFrame.cc.
References _pimpl.
void zypp::PluginFrame::clearHeader | ( | const std::string & | key_r | ) |
std::ostream & zypp::PluginFrame::writeTo | ( | std::ostream & | stream_r | ) | const |
Write frame to stream.
PluginFrameException | On error writing to stream |
Definition at line 259 of file PluginFrame.cc.
References _pimpl.
Referenced by dumpOn(), zypp::PluginScript::Impl::send(), and writeTo().
static std::ostream& zypp::PluginFrame::writeTo | ( | std::ostream & | stream_r, | |
const PluginFrame & | frame_r | |||
) | [inline, static] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 194 of file PluginFrame.h.
References writeTo().
std::istream& zypp::PluginFrame::readFrom | ( | std::istream & | stream_r | ) | [inline] |
Read frame from stream.
PluginFrameException | If PluginFrame(std::istream&) throws |
Definition at line 200 of file PluginFrame.h.
References PluginFrame().
Referenced by operator>>().
static std::istream& zypp::PluginFrame::readFrom | ( | std::istream & | stream_r, | |
PluginFrame & | frame_r | |||
) | [inline, static] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 204 of file PluginFrame.h.
References PluginFrame().
zypp::PluginFrame::base::SafeBool | ( | ) | const [private] |
bool zypp::PluginFrame::boolTest | ( | ) | const [inline, private] |
std::ostream & operator<< | ( | std::ostream & | str, | |
const PluginFrame & | obj | |||
) | [friend] |
Stream output for logging
Definition at line 288 of file PluginFrame.cc.
bool operator== | ( | const PluginFrame & | lhs, | |
const PluginFrame & | rhs | |||
) | [friend] |
Comparison based on content.
Definition at line 291 of file PluginFrame.cc.
std::ostream & dumpOn | ( | std::ostream & | str, | |
const PluginFrame & | obj | |||
) | [related] |
std::istream & operator>> | ( | std::istream & | str, | |
PluginFrame & | obj | |||
) | [related] |
bool operator!= | ( | const PluginFrame & | lhs, | |
const PluginFrame & | rhs | |||
) | [related] |
Comparison based on content.
Definition at line 235 of file PluginFrame.h.
RWCOW_pointer<Impl> zypp::PluginFrame::_pimpl [private] |
Pointer to implementation.
Definition at line 214 of file PluginFrame.h.
Referenced by addHeader(), body(), bodyRef(), clearHeader(), command(), empty(), getHeader(), getHeaderNT(), headerList(), zypp::operator<<(), zypp::operator==(), setBody(), setCommand(), setHeader(), and writeTo().