decompiler  1.0.0
Public Member Functions | List of all members
CommentDatabase Class Referenceabstract

An interface to a container of comments. More...

#include <comment.hh>

Inheritance diagram for CommentDatabase:
CommentDatabaseGhidra CommentDatabaseInternal

Public Member Functions

 CommentDatabase (void)
 Constructor.
 
virtual ~CommentDatabase (void)
 Destructor.
 
virtual void clear (void)=0
 Clear all comments from this container.
 
virtual void clearType (const Address &fad, uint4 tp)=0
 Clear all comments matching (one of) the indicated types. More...
 
virtual void addComment (uint4 tp, const Address &fad, const Address &ad, const string &txt)=0
 Add a new comment to the container. More...
 
virtual bool addCommentNoDuplicate (uint4 tp, const Address &fad, const Address &ad, const string &txt)=0
 Add a new comment to the container, making sure there is no duplicate. More...
 
virtual void deleteComment (Comment *com)=0
 Remove the given Comment object from the container. More...
 
virtual CommentSet::const_iterator beginComment (const Address &fad) const =0
 Get an iterator to the beginning of comments for a single function. More...
 
virtual CommentSet::const_iterator endComment (const Address &fad) const =0
 Get an iterator to the ending of comments for a single function. More...
 
virtual void saveXml (ostream &s) const =0
 Save all comments in the container to an XML stream. More...
 
virtual void restoreXml (const Element *el, const AddrSpaceManager *manage)=0
 Restore all comments from XML. More...
 

Detailed Description

An interface to a container of comments.

Comments can be added (and removed) from a database, keying on the function and address the Comment is attached to. The interface can generate a begin and end iterator covering all Comment objects for a single function.

Member Function Documentation

◆ addComment()

virtual void CommentDatabase::addComment ( uint4  tp,
const Address fad,
const Address ad,
const string &  txt 
)
pure virtual

Add a new comment to the container.

Parameters
tpis a set of properties to associate with the new comment (may be zero)
fadis the address of the function to which the comment belongs
adis the address to which the comment is attached
txtis the body of the comment

Implemented in CommentDatabaseInternal, and CommentDatabaseGhidra.

◆ addCommentNoDuplicate()

virtual bool CommentDatabase::addCommentNoDuplicate ( uint4  tp,
const Address fad,
const Address ad,
const string &  txt 
)
pure virtual

Add a new comment to the container, making sure there is no duplicate.

If there is already a comment at the same address with the same body, no new comment is added.

Parameters
tpis a set of properties to associate with the new comment (may be zero)
fadis the address of the function to which the comment belongs
adis the address to which the comment is attached
txtis the body of the comment
Returns
true if a new Comment was created, false if there was a duplicate

Implemented in CommentDatabaseInternal, and CommentDatabaseGhidra.

Referenced by Funcdata::warning(), and Funcdata::warningHeader().

◆ beginComment()

virtual CommentSet::const_iterator CommentDatabase::beginComment ( const Address fad) const
pure virtual

Get an iterator to the beginning of comments for a single function.

Parameters
fadis the address of the function
Returns
the beginning iterator

Implemented in CommentDatabaseInternal, and CommentDatabaseGhidra.

Referenced by CommentSorter::setupFunctionList().

◆ clearType()

virtual void CommentDatabase::clearType ( const Address fad,
uint4  tp 
)
pure virtual

Clear all comments matching (one of) the indicated types.

Clearing is restricted to comments belonging to a specific function and matching at least one of the given properties

Parameters
fadis the address of the owning function
tpis a set of one or more properties

Implemented in CommentDatabaseInternal, and CommentDatabaseGhidra.

Referenced by Architecture::clearAnalysis().

◆ deleteComment()

virtual void CommentDatabase::deleteComment ( Comment com)
pure virtual

Remove the given Comment object from the container.

Parameters
comis the given Comment

Implemented in CommentDatabaseInternal, and CommentDatabaseGhidra.

◆ endComment()

virtual CommentSet::const_iterator CommentDatabase::endComment ( const Address fad) const
pure virtual

Get an iterator to the ending of comments for a single function.

Parameters
fadis the address of the function
Returns
the ending iterator

Implemented in CommentDatabaseInternal, and CommentDatabaseGhidra.

Referenced by CommentSorter::setupFunctionList().

◆ restoreXml()

virtual void CommentDatabase::restoreXml ( const Element el,
const AddrSpaceManager manage 
)
pure virtual

Restore all comments from XML.

Parameters
elis the root <commentdb> element
manageis a manager for resolving address space references

Implemented in CommentDatabaseInternal, and CommentDatabaseGhidra.

Referenced by Architecture::restoreXml().

◆ saveXml()

virtual void CommentDatabase::saveXml ( ostream &  s) const
pure virtual

Save all comments in the container to an XML stream.

Writes a <commentdb> tag, with <comment> sub-tags for each Comment object.

Parameters
sis the output stream

Implemented in CommentDatabaseInternal, and CommentDatabaseGhidra.

Referenced by Architecture::saveXml().


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