Class SizeRestrictedFilter
java.lang.Object
ghidra.program.model.lang.protorules.SizeRestrictedFilter
- All Implemented Interfaces:
DatatypeFilter
- Direct Known Subclasses:
HomogeneousAggregate,MetaTypeFilter
A base class for data-type filters that tests either for either a range or an enumerated list of sizes.
Any filter that inherits from this, can use ATTRIB_MINSIZE, ATTRIB_MAXSIZE, or ATTRIB_SIZES
to place bounds on the possible sizes of data-types. The bounds are enforced
by calling filterOnSize() within the inheriting classes filter() method.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Make a copy of this filtervoidEncode this filter and its configuration to a streamprotected voidencodeAttributes(Encoder encoder) booleanTest whether the given data-type belongs to this filter's data-type classbooleanfilterOnSize(DataType dt) Enforce any size bounds on a given data-type.protected voidinitFromSizeList(String str) Parse the given string as a comma or space separated list of decimal integers, populating the sizes set.booleanTest if the given filter is configured and performs identically to thisprotected voidvoidrestoreXml(XmlPullParser parser) Configure details of the data-type class being filtered from the given stream
-
Field Details
-
NAME
- See Also:
-
minSize
protected int minSize -
maxSize
protected int maxSize -
sizes
-
-
Constructor Details
-
SizeRestrictedFilter
public SizeRestrictedFilter() -
SizeRestrictedFilter
public SizeRestrictedFilter(int min, int max) -
SizeRestrictedFilter
Copy constructor- Parameters:
op2- is the filter to copy
-
-
Method Details
-
initFromSizeList
Parse the given string as a comma or space separated list of decimal integers, populating the sizes set.- Parameters:
str- is the given string to parse- Throws:
XmlParseException- if the string does not valid (positive) integers
-
filterOnSize
Enforce any size bounds on a given data-type. If \b maxSize is not zero, the data-type is checked to see if its size in bytes falls between \b minSize and \b maxSize inclusive. If enumerated sizes are present, also check that the particular size is in the enumerated set.- Parameters:
dt- is the data-type to test- Returns:
- true if the data-type meets the size restrictions
-
clone
Description copied from interface:DatatypeFilterMake a copy of this filter- Specified by:
clonein interfaceDatatypeFilter- Overrides:
clonein classObject- Returns:
- the new copy
-
isEquivalent
Description copied from interface:DatatypeFilterTest if the given filter is configured and performs identically to this- Specified by:
isEquivalentin interfaceDatatypeFilter- Parameters:
op- is the given filter- Returns:
- true if the two filters are equivalent
-
filter
Description copied from interface:DatatypeFilterTest whether the given data-type belongs to this filter's data-type class- Specified by:
filterin interfaceDatatypeFilter- Parameters:
dt- is the given data-type to test- Returns:
- true if the data-type is in the class, false otherwise
-
encodeAttributes
- Throws:
IOException
-
restoreAttributesXml
- Throws:
XmlParseException
-
encode
Description copied from interface:DatatypeFilterEncode this filter and its configuration to a stream- Specified by:
encodein interfaceDatatypeFilter- Parameters:
encoder- is the stream encoder- Throws:
IOException- for problems writing to the stream
-
restoreXml
Description copied from interface:DatatypeFilterConfigure details of the data-type class being filtered from the given stream- Specified by:
restoreXmlin interfaceDatatypeFilter- Parameters:
parser- is the given stream decoder- Throws:
XmlParseException- if there are problems with the stream
-