mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GP-3174 Indexed attribute marshaling
This commit is contained in:
parent
a3ca5a67e1
commit
b39c60e221
16 changed files with 162 additions and 66 deletions
|
@ -152,6 +152,15 @@ public:
|
|||
/// \return the id of the next attribute or 0
|
||||
virtual uint4 getNextAttributeId(void)=0;
|
||||
|
||||
/// \brief Get the id for the (current) attribute, assuming it is indexed
|
||||
///
|
||||
/// Assuming the previous call to getNextAttributeId() returned the id of ATTRIB_UNKNOWN,
|
||||
/// reinterpret the attribute as being an indexed form of the given attribute. If the attribute
|
||||
/// matches, return this indexed id, otherwise return ATTRIB_UNKNOWN.
|
||||
/// \param attribId is the attribute being indexed
|
||||
/// \return the indexed id or ATTRIB_UNKNOWN
|
||||
virtual uint4 getIndexedAttributeId(const AttributeId &attribId)=0;
|
||||
|
||||
/// \brief Reset attribute traversal for the current element
|
||||
///
|
||||
/// Attributes for a single element can be traversed more than once using the getNextAttributeId method.
|
||||
|
@ -322,6 +331,17 @@ public:
|
|||
/// \param val is the string to encode
|
||||
virtual void writeString(const AttributeId &attribId,const string &val)=0;
|
||||
|
||||
/// \brief Write an annotated string, using an indexed attribute, into the encoding
|
||||
///
|
||||
/// Multiple attributes with a shared name can be written to the same element by calling this method
|
||||
/// multiple times with a different \b index value. The encoding will use attribute ids up to the base id
|
||||
/// plus the maximum index passed in. Implementors must be careful to not use other attributes with ids
|
||||
/// bigger than the base id within the element taking the indexed attribute.
|
||||
/// \param attribId is the shared AttributeId
|
||||
/// \param index is the unique index to associated with the string
|
||||
/// \param val is the string to encode
|
||||
virtual void writeStringIndexed(const AttributeId &attribId,uint4 index,const string &val)=0;
|
||||
|
||||
/// \brief Write an address space reference into the encoding
|
||||
///
|
||||
/// The address space is associated with the given AttributeId annotation and the current open element.
|
||||
|
@ -357,6 +377,7 @@ public:
|
|||
virtual void closeElementSkipping(uint4 id);
|
||||
virtual void rewindAttributes(void);
|
||||
virtual uint4 getNextAttributeId(void);
|
||||
virtual uint4 getIndexedAttributeId(const AttributeId &attribId);
|
||||
virtual bool readBool(void);
|
||||
virtual bool readBool(const AttributeId &attribId);
|
||||
virtual intb readSignedInteger(void);
|
||||
|
@ -387,6 +408,7 @@ public:
|
|||
virtual void writeSignedInteger(const AttributeId &attribId,intb val);
|
||||
virtual void writeUnsignedInteger(const AttributeId &attribId,uintb val);
|
||||
virtual void writeString(const AttributeId &attribId,const string &val);
|
||||
virtual void writeStringIndexed(const AttributeId &attribId,uint4 index,const string &val);
|
||||
virtual void writeSpace(const AttributeId &attribId,const AddrSpace *spc);
|
||||
};
|
||||
|
||||
|
@ -492,6 +514,7 @@ public:
|
|||
virtual void closeElementSkipping(uint4 id);
|
||||
virtual void rewindAttributes(void);
|
||||
virtual uint4 getNextAttributeId(void);
|
||||
virtual uint4 getIndexedAttributeId(const AttributeId &attribId);
|
||||
virtual bool readBool(void);
|
||||
virtual bool readBool(const AttributeId &attribId);
|
||||
virtual intb readSignedInteger(void);
|
||||
|
@ -521,6 +544,7 @@ public:
|
|||
virtual void writeSignedInteger(const AttributeId &attribId,intb val);
|
||||
virtual void writeUnsignedInteger(const AttributeId &attribId,uintb val);
|
||||
virtual void writeString(const AttributeId &attribId,const string &val);
|
||||
virtual void writeStringIndexed(const AttributeId &attribId,uint4 index,const string &val);
|
||||
virtual void writeSpace(const AttributeId &attribId,const AddrSpace *spc);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue