Ghidra 11.3.2
Ghidra internal decompiler documentation.
Loading...
Searching...
No Matches
ghidra::SizeRestrictedFilter Class Reference

A common base class for data-type filters that tests for a size range. More...

#include <modelrules.hh>

Inheritance diagram for ghidra::SizeRestrictedFilter:
[legend]
Collaboration diagram for ghidra::SizeRestrictedFilter:
[legend]

Public Member Functions

 SizeRestrictedFilter (void)
 Constructor for use with decode()
 
 SizeRestrictedFilter (int4 min, int4 max)
 Constructor.
 
bool filterOnSize (Datatype *dt) const
 Enforce any size bounds on a given data-type.
 
virtual DatatypeFilterclone (void) const
 Make a copy of this filter.
 
virtual bool filter (Datatype *dt) const
 Test whether the given data-type belongs to this filter's data-type class.
 
virtual void decode (Decoder &decoder)
 Configure details of the data-type class being filtered from the given stream.
 
- Public Member Functions inherited from ghidra::DatatypeFilter
virtual ~DatatypeFilter (void)
 Destructor.
 

Protected Attributes

int4 minSize
 Minimum size of the data-type in bytes.
 
int4 maxSize
 Maximum size of the data-type in bytes.
 

Additional Inherited Members

- Static Public Member Functions inherited from ghidra::DatatypeFilter
static DatatypeFilterdecodeFilter (Decoder &decoder)
 Instantiate a filter from the given stream.
 

Detailed Description

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.

Member Function Documentation

◆ clone()

virtual DatatypeFilter * ghidra::SizeRestrictedFilter::clone ( void  ) const
inlinevirtual

Make a copy of this filter.

Returns
the newly allocated copy

Implements ghidra::DatatypeFilter.

Reimplemented in ghidra::MetaTypeFilter, and ghidra::HomogeneousAggregate.

References maxSize, minSize, and SizeRestrictedFilter().

◆ decode()

void ghidra::SizeRestrictedFilter::decode ( Decoder decoder)
virtual

Configure details of the data-type class being filtered from the given stream.

Parameters
decoderis the given stream decoder

Implements ghidra::DatatypeFilter.

References ghidra::Decoder::getNextAttributeId(), maxSize, minSize, and ghidra::Decoder::readUnsignedInteger().

◆ filter()

virtual bool ghidra::SizeRestrictedFilter::filter ( Datatype dt) const
inlinevirtual

Test whether the given data-type belongs to this filter's data-type class.

Parameters
dtis the given data-type to test
Returns
true if the data-type is in the class, false otherwise

Implements ghidra::DatatypeFilter.

Reimplemented in ghidra::MetaTypeFilter, and ghidra::HomogeneousAggregate.

References filterOnSize().

◆ filterOnSize()

bool ghidra::SizeRestrictedFilter::filterOnSize ( Datatype dt) const

Enforce any size bounds on a given data-type.

If maxSize is not zero, the data-type is checked to see if its size in bytes falls between minSize and maxSize inclusive.

Parameters
dtis the data-type to test
Returns
true if the data-type meets the size restrictions

References ghidra::Datatype::getSize(), maxSize, and minSize.

Referenced by filter(), and ghidra::MetaTypeFilter::filter().


The documentation for this class was generated from the following files: