Search in sources :

Example 1 with CCodeNodeComments

use of com.google.security.zynamics.binnavi.disassembly.CCodeNodeComments in project binnavi by google.

the class LocalInstructionCommentAccessor method getAllComments.

@Override
public ArrayList<Pair<INaviInstruction, IComment>> getAllComments() {
    final ArrayList<Pair<INaviInstruction, IComment>> values = new ArrayList<>();
    final CCodeNodeComments currentComments = m_codeNode.getComments();
    for (final INaviInstruction instruction : m_codeNode.getInstructions()) {
        final List<IComment> comments = currentComments.getLocalInstructionComment(instruction);
        if ((comments == null) || comments.isEmpty()) {
            values.add(new Pair<INaviInstruction, IComment>(instruction, new EmptyComment()));
            continue;
        } else {
            for (final IComment comment : comments) {
                values.add(new Pair<INaviInstruction, IComment>(instruction, comment));
            }
            values.add(new Pair<INaviInstruction, IComment>(instruction, new EmptyComment()));
        }
    }
    return values;
}
Also used : EmptyComment(com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.EmptyComment) IComment(com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment) CCodeNodeComments(com.google.security.zynamics.binnavi.disassembly.CCodeNodeComments) ArrayList(java.util.ArrayList) Pair(com.google.security.zynamics.zylib.general.Pair) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction)

Example 2 with CCodeNodeComments

use of com.google.security.zynamics.binnavi.disassembly.CCodeNodeComments in project binnavi by google.

the class CCommentUtilities method getLocalInstructionComments.

/**
 * TODO (timkornau): either comment the function or find a better way on how the commenting for
 * instructions can access all comments.
 */
public static List<Pair<INaviInstruction, IComment>> getLocalInstructionComments(final CCodeNode codeNode) {
    Preconditions.checkNotNull(codeNode, "IE02633: codeNode argument can not be null");
    final List<Pair<INaviInstruction, IComment>> values = new ArrayList<Pair<INaviInstruction, IComment>>();
    final CCodeNodeComments currentComments = codeNode.getComments();
    for (final INaviInstruction instruction : codeNode.getInstructions()) {
        final List<IComment> comments = currentComments.getLocalInstructionComment(instruction);
        if ((comments == null) || comments.isEmpty()) {
            values.add(new Pair<INaviInstruction, IComment>(instruction, null));
            continue;
        } else {
            for (final IComment comment : comments) {
                values.add(new Pair<INaviInstruction, IComment>(instruction, comment));
            }
        }
    }
    return values;
}
Also used : IComment(com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment) CCodeNodeComments(com.google.security.zynamics.binnavi.disassembly.CCodeNodeComments) ArrayList(java.util.ArrayList) Pair(com.google.security.zynamics.zylib.general.Pair) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction)

Aggregations

IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)2 CCodeNodeComments (com.google.security.zynamics.binnavi.disassembly.CCodeNodeComments)2 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)2 Pair (com.google.security.zynamics.zylib.general.Pair)2 ArrayList (java.util.ArrayList)2 EmptyComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.EmptyComment)1