libzypp: zypp-media/ng/providemessage.cc File Reference

libzypp 17.36.6

Namespaces | Macros | Functions
providemessage.cc File Reference
`#include "private/providemessage_p.h"`
`#include "zypp-core/zyppng/rpc/stompframestream.h"`
`#include <zypp-core/Url.h>`
`#include <string_view>`
`#include <string>`

Go to the source code of this file.

## Namespaces
namespace | zyppng

## Macros
#define | DEF_REQ_FIELD(fname)
#define | PARSE_FIELD(msgtype, fname, ftype, _C_)
#define | HANDLE_UNKNOWN_FIELD(fname, val)
#define | OR_HANDLE_UNKNOWN_FIELD(fname, val)
#define | BEGIN_PARSE_HEADERS
#define | END_PARSE_HEADERS }
#define | PARSE_REQ_FIELD(msgtype, fname, ftype)
#define | OR_PARSE_REQ_FIELD(msgtype, fname, ftype)
#define | PARSE_OPT_FIELD(msgtype, fname, ftype)
#define | OR_PARSE_OPT_FIELD(msgtype, fname, ftype)
#define | FAIL_IF_NOT_SEEN_REQ_FIELD(msgtype, fname)

## Functions
template<typename T>
static zyppng::expected< void > | zyppng::doParseField (const std::string &val, ProvideMessage &t, std::string_view msgtype, std::string_view name)

## Macro Definition Documentation

## ◆ DEF_REQ_FIELD

#define DEF_REQ_FIELD | ( |  | fname | ) |

Value:
bool has_##fname = false

## ◆ PARSE_FIELD

#define PARSE_FIELD | ( |  | msgtype,
|  |  | fname,
|  |  | ftype,
|  |  | _C_ )

Value:
if ( name == #fname ) { \
const auto &res = doParseField<ftype>( val, pMessage, #msgtype, #fname ); \
if ( !res ) { \
return zyppng::expected<ProvideMessage>::error(res.error()); \
} \
_C_ \
}
zyppng::expected::error
E & error()
Definition expected.h:225

## ◆ HANDLE_UNKNOWN_FIELD

#define HANDLE_UNKNOWN_FIELD | ( |  | fname,
|  |  | val )

Value:
{ \
pMessage.addValue( fname, val ); \
}

## ◆ OR_HANDLE_UNKNOWN_FIELD

#define OR_HANDLE_UNKNOWN_FIELD | ( |  | fname,
|  |  | val )

Value:
else HANDLE_UNKNOWN_FIELD( fname, val )
HANDLE_UNKNOWN_FIELD
#define HANDLE_UNKNOWN_FIELD(fname, val)

## ◆ BEGIN_PARSE_HEADERS

#define BEGIN_PARSE_HEADERS

Value:
for ( const auto &header : msg.headerList() ) { \
const auto &name = header.first; \
const auto &val = header.second;

## ◆ END_PARSE_HEADERS

#define END_PARSE_HEADERS }

## ◆ PARSE_REQ_FIELD

#define PARSE_REQ_FIELD | ( |  | msgtype,
|  |  | fname,
|  |  | ftype )

Value:
PARSE_FIELD( msgtype, fname, ftype, has_##fname = true; )
PARSE_FIELD
#define PARSE_FIELD(msgtype, fname, ftype, _C_)

## ◆ OR_PARSE_REQ_FIELD

#define OR_PARSE_REQ_FIELD | ( |  | msgtype,
|  |  | fname,
|  |  | ftype )

Value:
else PARSE_REQ_FIELD( msgtype, fname, ftype )
PARSE_REQ_FIELD
#define PARSE_REQ_FIELD(msgtype, fname, ftype)

## ◆ PARSE_OPT_FIELD

#define PARSE_OPT_FIELD | ( |  | msgtype,
|  |  | fname,
|  |  | ftype )

Value:
PARSE_FIELD( msgtype, fname, ftype, )

## ◆ OR_PARSE_OPT_FIELD

#define OR_PARSE_OPT_FIELD | ( |  | msgtype,
|  |  | fname,
|  |  | ftype )

Value:
else PARSE_OPT_FIELD( msgtype, fname, ftype )
PARSE_OPT_FIELD
#define PARSE_OPT_FIELD(msgtype, fname, ftype)

## ◆ FAIL_IF_NOT_SEEN_REQ_FIELD

#define FAIL_IF_NOT_SEEN_REQ_FIELD | ( |  | msgtype,
|  |  | fname )

Value:
if ( !has_##fname ) \
return expected<ProvideMessage>::error( ZYPP_EXCPT_PTR( InvalidMessageReceivedException( zypp::str::Str() << #msgtype <<" message does not contain required " << #fname << " field" ) ) )
zypp::str::Str
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Definition String.h:212
ZYPP_EXCPT_PTR
#define ZYPP_EXCPT_PTR(EXCPT)
Drops a logline and returns Exception as a std::exception_ptr.
Definition Exception.h:428