Convert ti_Tag values in a list via map pairing.
Source position: utility.pas line 255
procedure MapTags( |
TagList: PTagItem; |
const Maplist: PTagItem; |
MapType: LongWord |
); |
TagList |
|
Input list of tag items which is to be mapped to tag values as specified in MapList. |
Maplist |
|
A "mapping list" tag list which pairs tag values expected to appear in tagList with new values to be substituted in the ti_Tag fields of tagList (may be nil) |
MapType |
|
one of the available mapping types (MAP_*) |
Apply a "mapping list" mapList to tagList.
If the ti_Tag field of an item in tagList appears as ti_Tag in some item in mapList, overwrite ti_Tag with the corresponding ti_Data from the map list.
The mapType parameter specifies how the mapping operation is to proceed, with the following available types:
MapTags() is central to BOOPSI gadget interconnections where you want to convert the tag values from one space (the sender) to another (the receiver).
The procedure will change the values of the input tag list tagList (but not mapList).
You can "filter" a list by passing MAP_REMOVE_NOT_FOUND as mapType, and having the data items in mapList equal the corresponding tags.
You can perform the inverse filter ("everything but") by passing a mapType of MAP_KEEP_NOT_FOUND, and creating a map item for every tag you want to filter out, pairing it with a mapped data value of TAG_IGNORE.
For safety and "order independence" of tag item arrays, if you attempt to map some tag to the value TAG_DONE, the value TAG_IGNORE will be substituted instead.
|
Change a tag list based on a second tag list. |
|
|
Eliminate tags which specify no change. |
|
|
Mapping types for use with MapTags() remove tags that aren't in mapList |
|
|
Mapping types for use with MapTags() keep tags that aren't in mapList |