A Tag Container holds a collection of FGameplayTags, tags are included explicitly by adding them, and implicitly from adding child tags 更多...
#include <GameplayTagContainer.h>
Public 成员函数 | |
| bool | AddLeafTag (const FGameplayTag &TagToAdd) |
| Adds a tag to the container and removes any direct parents, wont add if child already exists 更多... | |
| void | AddTag (const FGameplayTag &TagToAdd) |
| Add the specified tag to the container 更多... | |
| void | AddTagFast (const FGameplayTag &TagToAdd) |
| Add the specified tag to the container without checking for uniqueness 更多... | |
| void | AppendMatchingTags (FGameplayTagContainer const &OtherA, FGameplayTagContainer const &OtherB) |
| Adds all the tags that match between the two specified containers to this container. 更多... | |
| void | AppendTags (FGameplayTagContainer const &Other) |
| Adds all the tags from one container to this container NOTE: From set theory, this effectively is the union of the container this is called on with Other. 更多... | |
| bool | ComplexHasTag (FGameplayTag const &TagToCheck, TEnumAsByte< EGameplayTagMatchType::Type > TagMatchType, TEnumAsByte< EGameplayTagMatchType::Type > TagToCheckMatchType) const |
| Determine if the container has the specified tag 更多... | |
| TArray< FGameplayTag >::TConstIterator | CreateConstIterator () const |
| Creates a const iterator for the contents of this array | |
| FORCEINLINE_DEBUGGABLE bool | DoesTagContainerMatch (const FGameplayTagContainer &OtherContainer, TEnumAsByte< EGameplayTagMatchType::Type > TagMatchType, TEnumAsByte< EGameplayTagMatchType::Type > OtherTagMatchType, EGameplayContainerMatchType ContainerMatchType) const |
| Returns true if the tags in this container match the tags in OtherContainer for the specified matching types. 更多... | |
| FGameplayTagContainer () | |
| Constructors | |
| FGameplayTagContainer (const FGameplayTag &Tag) | |
| Explicit to prevent people from accidentally using the wrong type of operation | |
| void | FillParentTags () |
| Fills in ParentTags from GameplayTags | |
| FGameplayTagContainer | Filter (const FGameplayTagContainer &OtherContainer) const |
| Returns a filtered version of this container, returns all tags that match against any of the tags in OtherContainer, expanding parents 更多... | |
| FGameplayTagContainer | Filter (const FGameplayTagContainer &OtherContainer, TEnumAsByte< EGameplayTagMatchType::Type > TagMatchType, TEnumAsByte< EGameplayTagMatchType::Type > OtherTagMatchType) const |
| Returns a filtered version of this container, as if the container were filtered by matches from the parameter container 更多... | |
| FGameplayTagContainer | FilterExact (const FGameplayTagContainer &OtherContainer) const |
| Returns a filtered version of this container, returns all tags that match exactly one in OtherContainer 更多... | |
| void | FromExportString (const FString &ExportString) |
| Sets from a ImportText string, used in asset registry | |
| void | GetGameplayTagArray (TArray< FGameplayTag > &InOutGameplayTags) const |
| Gets the explicit list of gameplay tags | |
| FGameplayTagContainer | GetGameplayTagParents () const |
| Returns a new container explicitly containing the tags of this container and all of their parent tags | |
| FORCEINLINE_DEBUGGABLE bool | HasAll (const FGameplayTagContainer &ContainerToCheck) const |
| Checks if this container contains ALL of the tags in the specified container, also checks against parent tags {"A.1","B.1"}.HasAll({"A","B"}) will return True, {"A","B"}.HasAll({"A.1","B.1"}) will return False If ContainerToCheck is empty/invalid it will always return True, because there were no failed checks 更多... | |
| FORCEINLINE_DEBUGGABLE bool | HasAllExact (const FGameplayTagContainer &ContainerToCheck) const |
| Checks if this container contains ALL of the tags in the specified container, only allowing exact matches {"A.1","B.1"}.HasAll({"A","B"}) will return False If ContainerToCheck is empty/invalid it will always return True, because there were no failed checks 更多... | |
| FORCEINLINE_DEBUGGABLE bool | HasAny (const FGameplayTagContainer &ContainerToCheck) const |
| Checks if this container contains ANY of the tags in the specified container, also checks against parent tags {"A.1"}.HasAny({"A","B"}) will return True, {"A"}.HasAny({"A.1","B"}) will return False If ContainerToCheck is empty/invalid it will always return False 更多... | |
| FORCEINLINE_DEBUGGABLE bool | HasAnyExact (const FGameplayTagContainer &ContainerToCheck) const |
| Checks if this container contains ANY of the tags in the specified container, only allowing exact matches {"A.1"}.HasAny({"A","B"}) will return False If ContainerToCheck is empty/invalid it will always return False 更多... | |
| FORCEINLINE_DEBUGGABLE bool | HasTag (const FGameplayTag &TagToCheck) const |
| Determine if TagToCheck is present in this container, also checking against parent tags {"A.1"}.HasTag("A") will return True, {"A"}.HasTag("A.1") will return False If TagToCheck is not Valid it will always return False 更多... | |
| FORCEINLINE_DEBUGGABLE bool | HasTag (FGameplayTag const &TagToCheck, TEnumAsByte< EGameplayTagMatchType::Type > TagMatchType, TEnumAsByte< EGameplayTagMatchType::Type > TagToCheckMatchType) const |
| Determine if the container has the specified tag 更多... | |
| FORCEINLINE_DEBUGGABLE bool | HasTagExact (const FGameplayTag &TagToCheck) const |
| Determine if TagToCheck is explicitly present in this container, only allowing exact matches {"A.1"}.HasTagExact("A") will return False If TagToCheck is not Valid it will always return False 更多... | |
| FORCEINLINE_DEBUGGABLE bool | HasTagExplicit (FGameplayTag const &TagToCheck) const |
| Determine if the container has the specified tag. 更多... | |
| FORCEINLINE_DEBUGGABLE bool | HasTagFast (FGameplayTag const &TagToCheck, TEnumAsByte< EGameplayTagMatchType::Type > TagMatchType, TEnumAsByte< EGameplayTagMatchType::Type > TagToCheckMatchType) const |
| Version of above that is called from conditions where you know tag is valid | |
| bool | ImportTextItem (const TCHAR *&Buffer, int32 PortFlags, UObject *Parent, FOutputDevice *ErrorText) |
| Handles fixup after importing from text | |
| FORCEINLINE bool | IsEmpty () const |
| Returns true if container is empty | |
| FORCEINLINE bool | IsValid () const |
| Returns whether the container has any valid tags | |
| FORCEINLINE_DEBUGGABLE bool | MatchesAll (const FGameplayTagContainer &Other, bool bCountEmptyAsMatch) const |
| Checks if this container matches ALL of the tags in the specified container. 更多... | |
| FORCEINLINE_DEBUGGABLE bool | MatchesAny (const FGameplayTagContainer &Other, bool bCountEmptyAsMatch) const |
| Checks if this container matches ANY of the tags in the specified container. 更多... | |
| bool | MatchesQuery (const struct FGameplayTagQuery &Query) const |
| Checks if this container matches the given query. 更多... | |
| bool | NetSerialize (FArchive &Ar, class UPackageMap *Map, bool &bOutSuccess) |
| Efficient network serialize, takes advantage of the dictionary | |
| FORCEINLINE int32 | Num () const |
| Returns the number of explicitly added tags | |
| FGameplayTagContainer & | operator= (FGameplayTagContainer const &Other) |
| Assignment/Equality operators | |
| void | PostScriptConstruct () |
| Fill in the ParentTags array and any other transient parameters | |
| bool | RemoveTag (const FGameplayTag &TagToRemove, bool bDeferParentTags=false) |
| Tag to remove from the container 更多... | |
| void | RemoveTags (const FGameplayTagContainer &TagsToRemove) |
| Removes all tags in TagsToRemove from this container 更多... | |
| void | Reset (int32 Slack=0) |
| Remove all tags from the container. 更多... | |
| bool | Serialize (FStructuredArchive::FSlot Slot) |
| Serialize the tag container | |
| FText | ToMatchingText (EGameplayContainerMatchType MatchType, bool bInvertCondition) const |
| Returns human readable description of what match is being looked for on the readable tag list. | |
| FString | ToString () const |
| Returns string version of container in ImportText format | |
| FString | ToStringSimple (bool bQuoted=false) const |
| Returns abbreviated human readable Tag list without parens or property names. 更多... | |
| TArray< FString > | ToStringsMaxLen (int32 MaxLen) const |
| Returns abbreviated human readable Tag list without parens or property names, but will limit each string to specified len. 更多... | |
静态 Public 成员函数 | |
| template<class AllocatorType > | |
| static FGameplayTagContainer | CreateFromArray (const TArray< FGameplayTag, AllocatorType > &SourceTags) |
| Creates a container from an array of tags, this is more efficient than adding them all individually | |
静态 Public 属性 | |
| static const FGameplayTagContainer | EmptyContainer |
| An empty Gameplay Tag Container | |
Protected 成员函数 | |
| void | AddParentsForTag (const FGameplayTag &Tag) |
| Adds parent tags for a single tag | |
| bool | DoesTagContainerMatchComplex (const FGameplayTagContainer &OtherContainer, TEnumAsByte< EGameplayTagMatchType::Type > TagMatchType, TEnumAsByte< EGameplayTagMatchType::Type > OtherTagMatchType, EGameplayContainerMatchType ContainerMatchType) const |
| Returns true if the tags in this container match the tags in OtherContainer for the specified matching types. 更多... | |
| bool | RemoveTagByExplicitName (const FName &TagName) |
| If a Tag with the specified tag name explicitly exists, it will remove that tag and return true. 更多... | |
Protected 属性 | |
| TArray< FGameplayTag > | GameplayTags |
| Array of gameplay tags | |
| TArray< FGameplayTag > | ParentTags |
| Array of expanded parent tags, in addition to GameplayTags. 更多... | |
友元 | |
| FORCEINLINE friend TArray< FGameplayTag >::TConstIterator | begin (const FGameplayTagContainer &Array) |
| DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support. | |
| struct | FGameplayTag |
| struct | FGameplayTagNode |
| struct | FGameplayTagQuery |
| class | UGameplayTagsManager |
A Tag Container holds a collection of FGameplayTags, tags are included explicitly by adding them, and implicitly from adding child tags
| bool FGameplayTagContainer::AddLeafTag | ( | const FGameplayTag & | TagToAdd | ) |
Adds a tag to the container and removes any direct parents, wont add if child already exists
| Tag | The tag to try and add to this container |
| void FGameplayTagContainer::AddTag | ( | const FGameplayTag & | TagToAdd | ) |
Add the specified tag to the container
| TagToAdd | Tag to add to the container |
| void FGameplayTagContainer::AddTagFast | ( | const FGameplayTag & | TagToAdd | ) |
Add the specified tag to the container without checking for uniqueness
| TagToAdd | Tag to add to the container |
Useful when building container from another data struct (TMap for example)
| void FGameplayTagContainer::AppendMatchingTags | ( | FGameplayTagContainer const & | OtherA, |
| FGameplayTagContainer const & | OtherB | ||
| ) |
Adds all the tags that match between the two specified containers to this container.
WARNING: This matches any parent tag in A, not just exact matches! So while this should be the union of the container this is called on with the intersection of OtherA and OtherB, it's not exactly that. Since OtherB matches against its parents, any tag in OtherA which has a parent match with a parent of OtherB will count. For example, if OtherA has Color.Green and OtherB has Color.Red, that will count as a match due to the Color parent match! If you want an exact match, you need to call A.FilterExact(B) (above) to get the intersection of A with B. If you need the disjunctive union (the union of two sets minus their intersection), use AppendTags to create Union, FilterExact to create Intersection, and then call Union.RemoveTags(Intersection).
| OtherA | TagContainer that has the matching tags you want to add to this container, these tags have their parents expanded |
| OtherB | TagContainer used to check for matching tags. If the tag matches on any parent, it counts as a match. |
| void FGameplayTagContainer::AppendTags | ( | FGameplayTagContainer const & | Other | ) |
Adds all the tags from one container to this container NOTE: From set theory, this effectively is the union of the container this is called on with Other.
| Other | TagContainer that has the tags you want to add to this container |
| bool FGameplayTagContainer::ComplexHasTag | ( | FGameplayTag const & | TagToCheck, |
| TEnumAsByte< EGameplayTagMatchType::Type > | TagMatchType, | ||
| TEnumAsByte< EGameplayTagMatchType::Type > | TagToCheckMatchType | ||
| ) | const |
Determine if the container has the specified tag
| TagToCheck | Tag to check if it is present in the container |
| TagMatchType | Type of match to use for the tags in this container |
| TagToCheckMatchType | Type of match to use for the TagToCheck Param |
|
inline |
Returns true if the tags in this container match the tags in OtherContainer for the specified matching types.
| OtherContainer | The Container to filter against |
| TagMatchType | Type of match to use for the tags in this container |
| OtherTagMatchType | Type of match to use for the tags in the OtherContainer param |
| ContainerMatchType | Type of match to use for filtering |
|
protected |
Returns true if the tags in this container match the tags in OtherContainer for the specified matching types.
| OtherContainer | The Container to filter against |
| TagMatchType | Type of match to use for the tags in this container |
| OtherTagMatchType | Type of match to use for the tags in the OtherContainer param |
| ContainerMatchType | Type of match to use for filtering |
| FGameplayTagContainer FGameplayTagContainer::Filter | ( | const FGameplayTagContainer & | OtherContainer | ) | const |
Returns a filtered version of this container, returns all tags that match against any of the tags in OtherContainer, expanding parents
| OtherContainer | The Container to filter against |
| FGameplayTagContainer FGameplayTagContainer::Filter | ( | const FGameplayTagContainer & | OtherContainer, |
| TEnumAsByte< EGameplayTagMatchType::Type > | TagMatchType, | ||
| TEnumAsByte< EGameplayTagMatchType::Type > | OtherTagMatchType | ||
| ) | const |
Returns a filtered version of this container, as if the container were filtered by matches from the parameter container
| OtherContainer | The Container to filter against |
| TagMatchType | Type of match to use for the tags in this container |
| OtherTagMatchType | Type of match to use for the tags in the OtherContainer param |
| FGameplayTagContainer FGameplayTagContainer::FilterExact | ( | const FGameplayTagContainer & | OtherContainer | ) | const |
Returns a filtered version of this container, returns all tags that match exactly one in OtherContainer
| OtherContainer | The Container to filter against |
|
inline |
Checks if this container contains ALL of the tags in the specified container, also checks against parent tags {"A.1","B.1"}.HasAll({"A","B"}) will return True, {"A","B"}.HasAll({"A.1","B.1"}) will return False If ContainerToCheck is empty/invalid it will always return True, because there were no failed checks
|
inline |
Checks if this container contains ALL of the tags in the specified container, only allowing exact matches {"A.1","B.1"}.HasAll({"A","B"}) will return False If ContainerToCheck is empty/invalid it will always return True, because there were no failed checks
|
inline |
Checks if this container contains ANY of the tags in the specified container, also checks against parent tags {"A.1"}.HasAny({"A","B"}) will return True, {"A"}.HasAny({"A.1","B"}) will return False If ContainerToCheck is empty/invalid it will always return False
|
inline |
Checks if this container contains ANY of the tags in the specified container, only allowing exact matches {"A.1"}.HasAny({"A","B"}) will return False If ContainerToCheck is empty/invalid it will always return False
|
inline |
Determine if TagToCheck is present in this container, also checking against parent tags {"A.1"}.HasTag("A") will return True, {"A"}.HasTag("A.1") will return False If TagToCheck is not Valid it will always return False
|
inline |
Determine if the container has the specified tag
| TagToCheck | Tag to check if it is present in the container |
| TagMatchType | Type of match to use for the tags in this container |
| TagToCheckMatchType | Type of match to use for the TagToCheck Param |
|
inline |
Determine if TagToCheck is explicitly present in this container, only allowing exact matches {"A.1"}.HasTagExact("A") will return False If TagToCheck is not Valid it will always return False
|
inline |
Determine if the container has the specified tag.
This forces an explicit match. This function exists for convenience and brevity. We do not wish to use default values for HasTag match type parameters, to avoid confusion on what the default behavior is. (E.g., we want people to think and use the right match type).
| TagToCheck | Tag to check if it is present in the container |
|
inline |
Checks if this container matches ALL of the tags in the specified container.
Performs matching by expanding this container out to include its parent tags.
| Other | Container we are checking against |
| bCountEmptyAsMatch | If true, the parameter tag container will count as matching even if it's empty |
|
inline |
Checks if this container matches ANY of the tags in the specified container.
Performs matching by expanding this container out to include its parent tags.
| Other | Container we are checking against |
| bCountEmptyAsMatch | If true, the parameter tag container will count as matching even if it's empty |
| bool FGameplayTagContainer::MatchesQuery | ( | const struct FGameplayTagQuery & | Query | ) | const |
Checks if this container matches the given query.
| Query | Query we are checking against |
| bool FGameplayTagContainer::RemoveTag | ( | const FGameplayTag & | TagToRemove, |
| bool | bDeferParentTags = false |
||
| ) |
Tag to remove from the container
| TagToRemove | Tag to remove from the container |
| bDeferParentTags | Skip calling FillParentTags for performance (must be handled by calling code) |
|
protected |
If a Tag with the specified tag name explicitly exists, it will remove that tag and return true.
Otherwise, it returns false. It does NOT check the TagName for validity (i.e. the tag could be obsolete and so not exist in the table). It also does NOT check parents (because it cannot do so for a tag that isn't in the table). NOTE: This function should ONLY ever be used by GameplayTagsManager when redirecting tags. Do NOT make this function public!
| void FGameplayTagContainer::RemoveTags | ( | const FGameplayTagContainer & | TagsToRemove | ) |
Removes all tags in TagsToRemove from this container
| TagsToRemove | Tags to remove from the container |
| void FGameplayTagContainer::Reset | ( | int32 | Slack = 0 | ) |
Remove all tags from the container.
Will maintain slack by default
| FString FGameplayTagContainer::ToStringSimple | ( | bool | bQuoted = false | ) | const |
Returns abbreviated human readable Tag list without parens or property names.
If bQuoted is true it will quote each tag
Returns abbreviated human readable Tag list without parens or property names, but will limit each string to specified len.
This is to get around output restrictions
|
protected |
Array of expanded parent tags, in addition to GameplayTags.
Used to accelerate parent searches. May contain duplicates in some cases