2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: FilterTagItems() - filter an array of TagItems.
10 /*****************************************************************************
13 #include <proto/utility.h>
15 AROS_LH3(ULONG
, FilterTagItems
,
18 AROS_LHA(struct TagItem
*, tagList
, A0
),
19 AROS_LHA(Tag
*, filterArray
, A1
),
20 AROS_LHA(ULONG
, logic
, D0
),
23 struct Library
*, UtilityBase
, 16, Utility
)
26 Scans a tag list and removes tag items from the list depending
27 upon whether the tag's Tag value is found in an array of tag
30 If 'logic' is TAGFILTER_AND, then all the tags that are NOT
31 in the array filterArray will be removed from the tagList.
33 If 'logic' is TAGFILTER_NOT, then all the tags that ARE in
34 the array filterArray will be removed from the tagList.
36 Tags are removed by setting their ti_Tag value to TAG_IGNORE.
39 tagList - A TagList to filter items from.
40 filterArray - An array (as described by TagInArray())
41 to determine which tag items are to be
43 logic - Whether the tags in filterArray are to be
44 included or excluded from the tag list.
47 The number of valid items left in the resulting filtered list.
61 29-10-95 digulla automatically created from
62 utility_lib.fd and clib/utility_protos.h
64 *****************************************************************************/
69 if(tagList
&& filterArray
)
73 while((ti
= NextTagItem(&tagList
)))
75 if(logic
== TAGFILTER_AND
)
77 if(TagInArray(ti
->ti_Tag
, filterArray
))
80 ti
->ti_Tag
= TAG_IGNORE
;
82 else if(logic
== TAGFILTER_NOT
)
84 if(TagInArray(ti
->ti_Tag
, filterArray
))
85 ti
->ti_Tag
= TAG_IGNORE
;
94 } /* FilterTagItems */