12#ifndef ZYPP_PLUGINFRAME_H
13#define ZYPP_PLUGINFRAME_H
19#include <zypp/base/PtrTypes.h>
70 PluginFrame(
const std::string & command_r,
const std::string & body_r );
93 explicit operator bool()
const
98 const std::string &
command()
const;
103 void setCommand(
const std::string & command_r );
118 const std::string &
body()
const;
131 void setBody(
const std::string & body_r );
170 bool hasKey(
const std::string & key_r )
const
178 bool keySize(
const std::string & key_r )
const
194 const std::string &
getHeader(
const std::string & key_r )
const;
199 const std::string &
getHeader(
const std::string & key_r,
const std::string & default_r )
const;
202 const std::string &
getHeaderNT(
const std::string & key_r,
const std::string & default_r = std::string() )
const;
208 void setHeader(
const std::string & key_r,
const std::string & value_r = std::string() );
221 void addHeader(
const std::string & key_r,
const std::string & value_r = std::string() );
232 std::ostream &
writeTo( std::ostream & stream_r )
const;
236 {
return frame_r.
writeTo( stream_r ); }
242 { *
this =
PluginFrame( stream_r );
return stream_r; }
246 { frame_r =
PluginFrame( stream_r );
return stream_r; }
272 {
return( !
operator==( lhs, rhs ) ); }
RepoManager implementation.
Base class for PluginFrame Exception.
Command frame for communication with PluginScript.
const std::initializer_list< std::pair< std::string, std::string > > & HeaderInitializerList
static const std::string & ackCommand()
"ACK" command.
void setCommand(const std::string &command_r)
Set the frame command.
friend bool operator==(const PluginFrame &lhs, const PluginFrame &rhs)
void setBody(const std::string &body_r)
Set the frame body.
const std::string & body() const
Return the frame body.
HeaderListIterator keyBegin(const std::string &key_r) const
Return iterator pointing to the 1st header for key_r (or keyEnd(key_r))
PluginFrame()
Default ctor (empty frame)
void headerClear()
Clear the list of headers.
std::string & bodyRef()
Return a reference to the frame body.
void setHeader(HeaderInitializerList contents_r)
Set a new header list.
bool headerEmpty() const
Whether header list is empty.
void clearHeader(const std::string &key_r)
Remove all headers for key_r.
HeaderList::const_iterator HeaderListIterator
Header list iterator.
bool keyEmpty(const std::string &key_r) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
unsigned headerSize() const
Return size of the header list.
bool isErrorCommand() const
Convenience to identify an ERROR command.
std::istream & readFrom(std::istream &stream_r)
Read frame from stream.
bool empty() const
Whether this is an empty frame.
static const std::string & enomethodCommand()
"_ENOMETHOD" command.
bool keySize(const std::string &key_r) const
Return number of header entries for key_r.
std::ostream & dumpOn(std::ostream &str, const PluginFrame &obj)
Stream output writing all data for logging (no throw)
friend std::ostream & operator<<(std::ostream &str, const PluginFrame &obj)
const std::string & command() const
Return the frame command.
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.
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
bool isEnomethodCommand() const
Convenience to identify an _ENOMETHOD command.
HeaderListIterator keyEnd(const std::string &key_r) const
Return iterator pointing behind the last header for key_r.
static const std::string & errorCommand()
"ERROR" command.
std::multimap< std::string, std::string > HeaderList
The header list.
bool operator!=(const PluginFrame &lhs, const PluginFrame &rhs)
Comparison based on content.
static std::istream & readFrom(std::istream &stream_r, PluginFrame &frame_r)
static std::ostream & writeTo(std::ostream &stream_r, const PluginFrame &frame_r)
HeaderListIterator headerEnd() const
Return iterator pointing behind the last header.
const std::string & getHeader(const std::string &key_r) const
Return header value for key_r.
std::istream & operator>>(std::istream &str, PluginFrame &obj)
Construct from stream.
HeaderList & headerList()
Modifyalble header list for internal use only.
void setHeader(const std::string &key_r, const std::string &value_r=std::string())
Set header for key_r removing all other occurrences of key_r.
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.
bool isAckCommand() const
Convenience to identify an ACK command.
HeaderListIterator headerBegin() const
Return iterator pointing to the 1st header (or headerEnd)
PluginFrameException Exception
Default exception type.
std::ostream & writeTo(std::ostream &stream_r) const
Write frame to stream.
bool hasKey(const std::string &key_r) const
Whether the header list contains at least one entry for key_r.
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
RW_pointer supporting 'copy on write' functionality.