decompiler 1.0.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ghidra::TypeField Class Reference

A field within a structure or union. More...

#include <type.hh>

Public Member Functions

 TypeField (Decoder &decoder, TypeFactory &typegrp)
 Restore this field from a stream.
 
 TypeField (int4 id, int4 off, const string &nm, Datatype *ct)
 Construct from components.
 
int4 compare (const TypeField &op2) const
 Compare this with another TypeField for propagation ordering.
 
int4 compareDependency (const TypeField &op2) const
 Compare this with another TypeField for functional equivalence.
 
void encode (Encoder &encoder) const
 Encode this field to a stream.
 

Static Public Member Functions

static bool compareMaxByte (int4 off, const TypeField &field)
 

Public Attributes

int4 ident
 Identifier of this within its containing structure or union.
 
int4 offset
 Offset (into containing structure or union) of subfield.
 
string name
 Name of subfield.
 
Datatypetype
 Data-type of subfield.
 

Detailed Description

A field within a structure or union.

Constructor & Destructor Documentation

◆ TypeField()

ghidra::TypeField::TypeField ( Decoder decoder,
TypeFactory typegrp 
)

Restore this field from a stream.

Construct from a <field> element.

Parameters
decoderis the stream decoder
typegrpis the TypeFactory for parsing data-type info

References ghidra::Decoder::closeElement(), ghidra::TypeFactory::decodeType(), ghidra::Decoder::getNextAttributeId(), ident, name, offset, ghidra::Decoder::openElement(), ghidra::Decoder::readSignedInteger(), ghidra::Decoder::readString(), and type.

Member Function Documentation

◆ compare()

int4 ghidra::TypeField::compare ( const TypeField op2) const

Compare this with another TypeField for propagation ordering.

Compare meta-data of the two fields for use with TypeStruct::compare

Parameters
op2is the other TypeField to compare with this
Returns
-1, 0, or 1 for less than, equal, or greater than ordering

References ghidra::Datatype::getMetatype(), name, offset, and type.

◆ compareDependency()

int4 ghidra::TypeField::compareDependency ( const TypeField op2) const

Compare this with another TypeField for functional equivalence.

Compare structure of the two fields for use with TypeStruct::compareDependency.

Parameters
op2is the other TypeField to compare with this
Returns
-1, 0, or 1 for less than, equal, or greater than ordering

References name, offset, and type.

◆ compareMaxByte()

static bool ghidra::TypeField::compareMaxByte ( int4  off,
const TypeField field 
)
inlinestatic

< Compare field end-point to the given offset

Referenced by ghidra::TypeStruct::collectBitFields(), and ghidra::TypeStruct::hasBitFieldsInRange().

◆ encode()

void ghidra::TypeField::encode ( Encoder encoder) const

Encode this field to a stream.

Encode a formal description of this as a <field> element.

Parameters
encoderis the stream encoder

References ghidra::Encoder::closeElement(), ghidra::Datatype::encodeRef(), ident, name, offset, ghidra::Encoder::openElement(), type, ghidra::Encoder::writeSignedInteger(), and ghidra::Encoder::writeString().


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