17 #define RPM_NULL_TYPE rpmTagType(0)
18 typedef rpmuint32_t rpm_count_t;
21 typedef int32_t rpm_count_t;
36 #define Y2LOG "BinHeader"
69 inline HeaderEntryGetter::HeaderEntryGetter(
const Header & h_r, rpmTag & tag_r )
70 : _rpmtd( ::rpmtdNew() )
71 { ::headerGet( h_r, tag_r, _rpmtd, HEADERGET_DEFAULT ); }
73 { ::rpmtdFreeData( _rpmtd ); ::rpmtdFree( _rpmtd ); }
79 : _type( RPM_NULL_TYPE )
82 { ::headerGetEntry( h_r, tag_r, hTYP_t(&
_type), &
_val, &
_cnt ); }
84 {
if (
_val &&
_type == RPM_STRING_ARRAY_TYPE ) free(
_val ); }
102 #if RPM_CHAR_TYPE != RPM_INT8_TYPE
104 std::vector<long>( (
char*)val_r, ((
char*)val_r)+cnt_r ).swap(
_data );
108 std::vector<long>( (int8_t*)val_r, ((int8_t*)val_r)+cnt_r ).swap(
_data );
111 std::vector<long>( (int16_t*)val_r, ((int16_t*)val_r)+cnt_r ).swap(
_data );
114 std::vector<long>( (int32_t*)val_r, ((int32_t*)val_r)+cnt_r ).swap(
_data );
118 std::vector<long>( (int64_t*)val_r, ((int64_t*)val_r)+cnt_r ).swap(
_data );
122 std::vector<long>( cnt_r, 0L ).swap(
_data );
139 std::vector<std::string>( val_r, val_r+cnt_r ).swap(
_data );
174 INT <<
"INJECT from " << rhs;
175 if ( ! (rhs && rhs->_h) )
184 INT <<
": " << *
this <<
" (" << rhs <<
")" << endl;
214 INT <<
"OOPS: NULL HEADER created!" << endl;
231 return( !
empty() && ::headerIsEntry(
_h, tag_r ) );
248 if ( headerget.
val() )
250 switch ( headerget.
type() )
253 return lst_r.
set( 0, 0, headerget.
type() );
254 #if RPM_CHAR_TYPE != RPM_INT8_TYPE
263 return lst_r.
set( headerget.
val(), headerget.
cnt(), headerget.
type() );
266 INT <<
"RPM_TAG MISSMATCH: RPM_INTxx_TYPE " << tag_r <<
" got type " << headerget.
type() << endl;
270 return lst_r.
set( 0, 0, RPM_NULL_TYPE );
287 if ( headerget.
val() )
289 switch ( headerget.
type() )
292 return lst_r.
set( 0, 0 );
293 case RPM_STRING_ARRAY_TYPE:
294 return lst_r.
set( (
char**)headerget.
val(), headerget.
cnt() );
297 INT <<
"RPM_TAG MISSMATCH: RPM_STRING_ARRAY_TYPE " << tag_r <<
" got type " << headerget.
type() << endl;
301 return lst_r.
set( 0, 0 );
318 if ( headerget.
val() )
320 switch ( headerget.
type() )
324 #if RPM_CHAR_TYPE != RPM_INT8_TYPE
326 return *((
char*)headerget.
val());
329 return *((int8_t*)headerget.
val());
331 return *((int16_t*)headerget.
val());
333 return *((int32_t*)headerget.
val());
336 return *((int64_t*)headerget.
val());
340 INT <<
"RPM_TAG MISSMATCH: RPM_INTxx_TYPE " << tag_r <<
" got type " << headerget.
type() << endl;
361 if ( headerget.
val() )
363 switch ( headerget.
type() )
367 case RPM_STRING_TYPE:
368 return (
char*)headerget.
val();
371 INT <<
"RPM_TAG MISSMATCH: RPM_STRING_TYPE " << tag_r <<
" got type " << headerget.
type() << endl;
388 std::list<std::string> ret;
394 for (
unsigned i = 0; i < count; ++i )
396 ret.push_back( lines[i] );
413 return str <<
'{' << (
void*)
_h <<
'}';
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
std::list< PublicKeyData > _data
std::ostream & dumpOn(std::ostream &str, const Capability &obj)