17#define RPM_NULL_TYPE rpmTagType(0)
18typedef rpmuint32_t rpm_count_t;
24#include <zypp/base/Logger.h>
25#include <zypp/base/NonCopyable.h>
26#include <zypp/base/String.h>
27#include <zypp/AutoDispose.h>
34#define Y2LOG "BinHeader"
68 : _rpmtd( ::rpmtdNew() )
69 { ::headerGet( h_r, tag_r,
_rpmtd, HEADERGET_DEFAULT ); }
77 : _type( RPM_NULL_TYPE )
80 { ::headerGetEntry( h_r, tag_r, hTYP_t(&_type), &_val, &_cnt ); }
82 {
if ( _val && _type == RPM_STRING_ARRAY_TYPE ) free( _val ); }
100#if RPM_CHAR_TYPE != RPM_INT8_TYPE
102 std::vector<long>( (
char*)val_r, ((
char*)val_r)+cnt_r ).swap(
_data );
106 std::vector<long>( (int8_t*)val_r, ((int8_t*)val_r)+cnt_r ).swap(
_data );
109 std::vector<long>( (int16_t*)val_r, ((int16_t*)val_r)+cnt_r ).swap(
_data );
112 std::vector<long>( (int32_t*)val_r, ((int32_t*)val_r)+cnt_r ).swap(
_data );
116 std::vector<long>( (int64_t*)val_r, ((int64_t*)val_r)+cnt_r ).swap(
_data );
120 std::vector<long>( cnt_r, 0L ).swap(
_data );
137 std::vector<std::string>( val_r, val_r+cnt_r ).swap(
_data );
172 INT <<
"INJECT from " << rhs;
173 if ( ! (rhs && rhs->_h) )
182 INT <<
": " << *
this <<
" (" << rhs <<
")" << endl;
212 INT <<
"OOPS: NULL HEADER created!" << endl;
229 return( !
empty() && ::headerIsEntry(
_h, tag_r ) );
246 if ( headerget.
val() )
248 switch ( headerget.
type() )
251 return lst_r.
set( 0, 0, headerget.
type() );
252#if RPM_CHAR_TYPE != RPM_INT8_TYPE
261 return lst_r.
set( headerget.
val(), headerget.
cnt(), headerget.
type() );
264 INT <<
"RPM_TAG MISMATCH: RPM_INTxx_TYPE " << tag_r <<
" got type " << headerget.
type() << endl;
268 return lst_r.
set( 0, 0, RPM_NULL_TYPE );
285 if ( headerget.
val() )
287 switch ( headerget.
type() )
290 return lst_r.
set( 0, 0 );
291 case RPM_STRING_ARRAY_TYPE:
292 return lst_r.
set( (
char**)headerget.
val(), headerget.
cnt() );
295 INT <<
"RPM_TAG MISMATCH: RPM_STRING_ARRAY_TYPE " << tag_r <<
" got type " << headerget.
type() << endl;
299 return lst_r.
set( 0, 0 );
316 if ( headerget.
val() )
318 switch ( headerget.
type() )
322#if RPM_CHAR_TYPE != RPM_INT8_TYPE
324 return *((
char*)headerget.
val());
327 return *((int8_t*)headerget.
val());
329 return *((int16_t*)headerget.
val());
331 return *((int32_t*)headerget.
val());
334 return *((int64_t*)headerget.
val());
338 INT <<
"RPM_TAG MISMATCH: RPM_INTxx_TYPE " << tag_r <<
" got type " << headerget.
type() << endl;
351 if ( headerget.
val() )
353 switch ( headerget.
type() )
358 return ByteArray(
reinterpret_cast<char *
>( headerget.
val() ), headerget.
cnt() );
360 INT <<
"RPM_TAG MISSMATCH: RPM_BIN_TYPE " << tag_r <<
" got type " << headerget.
type() << endl;
381 if ( headerget.
val() )
383 switch ( headerget.
type() )
387 case RPM_STRING_TYPE:
388 return (
char*)headerget.
val();
391 INT <<
"RPM_TAG MISMATCH: RPM_STRING_TYPE " << tag_r <<
" got type " << headerget.
type() << endl;
402 return std::string();
404 return std::string(form);
422 std::list<std::string> ret;
428 for (
unsigned i = 0; i < count; ++i )
430 ret.push_back( lines[i] );
446 ReferenceCounted::dumpOn(
str );
447 return str <<
'{' << (
void*)
_h <<
'}';
std::list< PublicKeyData > _data
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
String related utilities and Regular expression matching.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Easy-to use interface to the ZYPP dependency resolver.