Commit Graph

17 Commits

Author SHA1 Message Date
Panu Matilainen 9c209c8a2d Add rpmtdGetIndex() + rpmtdSetIndex() methods 2008-05-23 17:07:34 +03:00
Panu Matilainen 9979407567 Add rpmtdSetTag() method for setting (or changing) container tag + type
- permit change on non-empty container to compatible type to allow things like
    headerGet(h, RPMTAG_FILENAMES, td, HEADERGET_EXT);
    rpmtdSetTag(td, RPMTAG_OLDFILENAMES);
    headerPut(h, td, HEADERPUT_DEFAULT);
- empty container can be set to any valid type
2008-05-23 17:07:34 +03:00
Panu Matilainen 35c0252857 Add per-datatype iterators to rpmtd
- just uint32 and string iterators for now, those are the most common ones
- allows somewhat more convenient code constructs when type is known,
  eg no need to separately check for non-null inside loops
2008-05-21 14:49:12 +03:00
Panu Matilainen 1c80801ab6 Misplaced assert
- we only care about non-NULL data if we're supposed to free the contents
2008-05-21 12:41:31 +03:00
Panu Matilainen ce70ac8717 Add rpmtdDup() method for deep copying of tag containers 2008-05-21 12:04:51 +03:00
Panu Matilainen 34151a9e35 Turn rpmtd freeData into flag bitfield, allowing more precise control
- headerGet() returns even array data in a single allocation block, but
  regular (string) arrays need to have the pointers in array freed too
- set immutable flag on header data
2008-05-21 12:04:51 +03:00
Panu Matilainen a9920b9299 Fix up for RPM_BIN_TYPE td->count abuse just once, in rpmtdCount() 2008-05-21 12:04:51 +03:00
Panu Matilainen fc38b84c01 Lose the useless rpmtdToString()
- either use rpmtdFormat() or xstrdup() on rpmtdGetString() as appropriate
2008-05-21 12:04:51 +03:00
Panu Matilainen fae1edeb93 Lose padding argument from formatters
- formatPrefix already contains the padding, just use rasprintf() on that
  to get properly allocated buffer without messing with it manually
- xml format doesn't honor padding anyway so don't bother with it
2008-05-21 12:04:50 +03:00
Panu Matilainen 9b32e58e17 Add rpmtdFormat() method and enumeration of supported formats
- permits formatting any rpmtd data to our supported formats over
  iteration
2008-05-21 12:04:50 +03:00
Panu Matilainen d5381c16a7 Handle RPM_CHAR_TYPE too in stringFormat()
- used by filestates and nothing else apparently, duh..
2008-05-21 12:04:50 +03:00
Panu Matilainen 75f62d7c5f Teach rpmtd about the raw i18n string (array) type 2008-05-19 08:27:10 +03:00
Panu Matilainen 30c4e29d33 Add some more rpmtd access methods
- rpmtdGetUint() for 16 and 32 bit integer types, similar to
  rpmtdGetString() (equally usable with scalar types and arrays)
- rpmtdToString() which converts "any" header data into string presentation
2008-05-13 18:09:35 +03:00
Panu Matilainen 11980a42f2 Add methods to construct tag containers from argv and argi arrays
- basic type checking done based on tag (return) type
2008-05-13 16:11:28 +03:00
Panu Matilainen 9de4354a12 Add support for iterating over tag data container
- rpmtd iterator init + next methods
- string accessor method for RPM_STRING_TYPE and RPM_STRING_ARRAY_TYPE
2008-05-13 14:40:55 +03:00
Panu Matilainen 223da12f24 Add rpmtdTag() method 2008-05-13 14:02:40 +03:00
Panu Matilainen a83cfce188 New "tag data" container struct + some basic methods to deal with it
- to be used for passing around header and extension data
- inspired by similar changes in rpm5.org, details and implementation differ
2008-05-13 11:02:45 +03:00