Class SizeRestrictedFilter
java.lang.Object
ghidra.program.model.lang.protorules.SizeRestrictedFilter
- All Implemented Interfaces:
DatatypeFilter
- Direct Known Subclasses:
HomogeneousAggregate
,MetaTypeFilter
A common base class for data-type filters that tests for a size range.
Any filter that inherits from this, can use ATTRIB_MINSIZE and ATTRIB_MAXSIZE
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Make a copy of this filtervoid
Encode this filter and its configuration to a streamprotected void
encodeAttributes
(Encoder encoder) boolean
Test whether the given data-type belongs to this filter's data-type classboolean
filterOnSize
(DataType dt) Enforce any size bounds on a given data-type.boolean
Test if the given filter is configured and performs identically to thisprotected void
void
restoreXml
(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
-
-
Constructor Details
-
SizeRestrictedFilter
public SizeRestrictedFilter() -
SizeRestrictedFilter
public SizeRestrictedFilter(int min, int max)
-
-
Method Details
-
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.- Parameters:
dt
- is the data-type to test- Returns:
- true if the data-type meets the size restrictions
-
clone
Description copied from interface:DatatypeFilter
Make a copy of this filter- Specified by:
clone
in interfaceDatatypeFilter
- Overrides:
clone
in classObject
- Returns:
- the new copy
-
isEquivalent
Description copied from interface:DatatypeFilter
Test if the given filter is configured and performs identically to this- Specified by:
isEquivalent
in interfaceDatatypeFilter
- Parameters:
op
- is the given filter- Returns:
- true if the two filters are equivalent
-
filter
Description copied from interface:DatatypeFilter
Test whether the given data-type belongs to this filter's data-type class- Specified by:
filter
in 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
-
encode
Description copied from interface:DatatypeFilter
Encode this filter and its configuration to a stream- Specified by:
encode
in interfaceDatatypeFilter
- Parameters:
encoder
- is the stream encoder- Throws:
IOException
- for problems writing to the stream
-
restoreXml
Description copied from interface:DatatypeFilter
Configure details of the data-type class being filtered from the given stream- Specified by:
restoreXml
in interfaceDatatypeFilter
- Parameters:
parser
- is the given stream decoder- Throws:
XmlParseException
- if there are problems with the stream
-