decompiler
1.0.0
|
A comment attached to a specific function and code address. More...
#include <comment.hh>
Public Types | |
enum | comment_type { user1 = 1, user2 = 2, user3 = 4, header = 8, warning = 16, warningheader = 32 } |
Possible properties associated with a comment. More... | |
Public Member Functions | |
Comment (uint4 tp, const Address &fad, const Address &ad, int4 uq, const string &txt) | |
Constructor. More... | |
Comment (void) | |
Constructor for use with restoreXml. | |
uint4 | getType (void) const |
Get the properties associated with the comment. | |
const Address & | getFuncAddr (void) const |
Get the address of the function containing the comment. | |
const Address & | getAddr (void) const |
Get the address to which the instruction is attached. | |
int4 | getUniq (void) const |
Get the sub-sorting index. | |
const string & | getText (void) const |
Get the body of the comment. | |
void | saveXml (ostream &s) const |
Save the comment to an XML stream. More... | |
void | restoreXml (const Element *el, const AddrSpaceManager *manage) |
Restore the comment from XML. More... | |
Static Public Member Functions | |
static uint4 | encodeCommentType (const string &name) |
Convert name string to comment property. More... | |
static string | decodeCommentType (uint4 val) |
Convert comment property to string. More... | |
Private Attributes | |
uint4 | type |
The properties associated with the comment. | |
Address | funcaddr |
Address of the function containing the comment. | |
Address | addr |
Address associated with the comment. | |
int4 | uniq |
Sub-identifier for uniqueness. | |
string | text |
The body of the comment. | |
Friends | |
class | CommentDatabaseInternal |
A comment attached to a specific function and code address.
Things contains the actual character data of the comment. It is fundamentally attached to a specific function and to the address of an instruction (within the function's body). Comments can be categorized as a header (or not) depending on whether it should be displayed as part of the general description of the function or not. Other properties can be assigned to a comment, to allow the user to specify the subset of all comments they want to display.
Possible properties associated with a comment.
Constructor.
tp | is the set of properties to associate with the comment (or 0 for no properties) |
fad | is the Address of the function containing the comment |
ad | is the Address of the instruction associated with the comment |
uq | is used internally to sub-sort comments at the same address |
txt | is the body of the comment |
|
static |
|
static |
Convert name string to comment property.
name | is a string representation of a single comment property |
References header, user1, user2, user3, warning, and warningheader.
Referenced by OptionCommentHeader::apply(), OptionCommentInstruction::apply(), getText(), and restoreXml().
void Comment::restoreXml | ( | const Element * | el, |
const AddrSpaceManager * | manage | ||
) |
Restore the comment from XML.
The comment is parsed from a <comment> tag.
el | is the <comment> element |
manage | is a manager for resolving address space references |
References addr, encodeCommentType(), funcaddr, Element::getAttributeValue(), Element::getChildren(), Address::restoreXml(), text, and type.
Referenced by getText(), CommentDatabaseInternal::restoreXml(), and CommentDatabase::~CommentDatabase().
void Comment::saveXml | ( | ostream & | s | ) | const |
Save the comment to an XML stream.
The single comment is saved as a <comment> tag.
s | is the output stream |
References a_v(), addr, decodeCommentType(), funcaddr, Address::getOffset(), Address::getSpace(), AddrSpace::saveXmlAttributes(), text, type, and xml_escape().
Referenced by getText(), and CommentDatabase::~CommentDatabase().