Unit 'utility' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#os4units]

MapTags

Convert ti_Tag values in a list via map pairing.

Declaration

Source position: utility.pas line 255

procedure MapTags(

  TagList: PTagItem;

  const Maplist: PTagItem;

  MapType: LongWord

);

Arguments

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_*)

Description

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:

MAP_REMOVE_NOT_FOUND
If a tag in tagList does not appear in the mapList, remove it from tagList.
MAP_KEEP_NOT_FOUND
To have items which do not appear in the mapList survive the mapping process as-is.

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.

See also

ApplyTagChanges

  

Change a tag list based on a second tag list.

FilterTagChanges

  

Eliminate tags which specify no change.

MAP_REMOVE_NOT_FOUND

  

Mapping types for use with MapTags() remove tags that aren't in mapList

MAP_KEEP_NOT_FOUND

  

Mapping types for use with MapTags() keep tags that aren't in mapList


Documentation generated on: 2021-07-30