]>
git.siccegge.de Git - frida/frida.git/blob - src/core/Comment.cxx
2 #include "Function.hxx"
3 #include "InformationManager.hxx"
4 #include "events/ChangeCommentEvent.hxx"
7 Comment::Comment(uint64_t address
, InformationManager
* manager
)
12 Comment::Comment(uint64_t address
, Function
* location
, InformationManager
* manager
)
17 void Comment::setText(const std::string
& text
) {
18 ChangeCommentEvent
event(address
, location
, this);
20 Q_EMIT manager
->changeCommentEvent(&event
);
23 uint64_t Comment::getAddress() {
27 Function
* Comment::getLocation() {
31 void Comment::serialize(QXmlStreamWriter
& stream
) {
32 stream
.writeStartElement("comment");
34 stream
.writeTextElement("address", QString::number(address
, 16));
35 stream
.writeTextElement("text", text
.c_str());
37 stream
.writeEndElement(); // "comment"
40 Comment
* Comment::deserialize(QXmlStreamReader
& stream
, InformationManager
* manager
, Function
* function
) {
41 Q_ASSERT(stream
.name() == "comment");
47 while (QXmlStreamReader::NoToken
!= stream
.readNext()) {
48 while (QXmlStreamReader::Characters
== stream
.tokenType() &&
49 stream
.isWhitespace())
51 if (QXmlStreamReader::EndElement
== stream
.tokenType())
54 if(QXmlStreamReader::StartElement
!= stream
.tokenType())
57 if (stream
.name() == "text") {
59 if (QXmlStreamReader::Characters
!= stream
.tokenType())
62 text
= stream
.text().toString();
65 if(QXmlStreamReader::EndElement
!= stream
.tokenType())
68 if (stream
.name() == "address") {
70 if (QXmlStreamReader::Characters
!= stream
.tokenType())
73 address
= stream
.text().toULongLong(NULL
, 16);
76 if(QXmlStreamReader::EndElement
!= stream
.tokenType())
81 if (address
== 0 or text
== "")
85 comment
= manager
->newLocalComment(address
, function
);
87 comment
= manager
->newGlobalComment(address
);
89 comment
->text
= text
.toStdString();
91 assert(stream
.name() == "comment");
93 manager
->finishComment(comment
);