]> git.siccegge.de Git - frida/frida.git/blobdiff - src/core/InformationManager.hxx
Pass NewFunctionEvents as objects, not pointers
[frida/frida.git] / src / core / InformationManager.hxx
index 610ece50da253f51820e9af3679ed934008808cb..a866e0adf62c39791d8a8effe7453794f989cb60 100644 (file)
@@ -2,14 +2,17 @@
 #define INCLUDE__InformationManager_hxx
 
 #include <log4cxx/logger.h>
-#include <boost/signals2.hpp>
 #include <functional>
 #include <string>
 #include <map>
 #include <vector>
+#include <memory>
 
+#include "qt.hxx"
 #include "disassembler/Disassembler.hxx"
 
+#include "core/events/NewFunctionEvent.hxx"
+
 class Interpreter;
 
 class Function;
@@ -17,12 +20,24 @@ class BasicBlock;
 class Comment;
 
 class RenameFunctionEvent;
+class NewFunctionEvent;
+class ChangeCommentEvent;
 
 class QString;
 class QTemporaryFile;
 class QPluginLoader;
 
-class InformationManager {
+class InformationManager : public QObject {
+#ifndef SWIG
+       Q_OBJECT
+signals:
+#else
+public:
+#endif
+       void renameFunctionEvent(RenameFunctionEvent* event);
+       void newFunctionEvent(NewFunctionEvent event);
+       void changeCommentEvent(ChangeCommentEvent* event);
+       void resetEvent();
 public:
        InformationManager();
        ~InformationManager();
@@ -31,33 +46,10 @@ public:
        void load(const std::string& filename);
        void save(const std::string& filename);
 
-       void signal_new_function(Function* f);
-       void signal_new_dyn_symbol(const std::string& f)
-               { new_dyn_symbol_signal(f); }
-
-       boost::signals2::connection
-       connect_new_function_signal(std::function<void(Function*)> f)
-               { return new_function_signal.connect(f); }
-
-       boost::signals2::connection
-       connect_new_dyn_symbol_signal(std::function<void(const std::string& name)> f)
-               { return new_dyn_symbol_signal.connect(f); }
-
-       boost::signals2::connection
-       connect_reset_signal(std::function<void ()> f)
-               { return reset_signal.connect(f); }
-
-       boost::signals2::connection
-       connect_rename_function_signal(std::function<void (RenameFunctionEvent*)> f)
-               { return rename_function_signal.connect(f); }
-
        Disassembler* getDisassembler()
                { return disassembler.get(); }
 
-       void dispatch(RenameFunctionEvent* event)
-               { rename_function_signal(event); }
-
-
+       // Accessors
        Function* getFunction(uint64_t address);
        bool hasFunctions() const {return functions.size() != 0;}
        std::map<uint64_t, Function*>::const_iterator beginFunctions();
@@ -68,13 +60,19 @@ public:
        std::map<uint64_t, BasicBlock*>::const_iterator beginBasicBlocks();
        std::map<uint64_t, BasicBlock*>::const_iterator endBasicBlocks();
 
+       std::pair<
+               std::multimap<uint64_t, Comment*>::const_iterator,
+               std::multimap<uint64_t, Comment*>::const_iterator>
+       getComments(uint64_t address);
+       bool hasComments() const {return ! comments.empty();}
+       std::multimap<uint64_t,Comment*>::const_iterator beginComments();
+       std::multimap<uint64_t,Comment*>::const_iterator endComments();
 
        Interpreter* getInterpreter(const std::string& name);
        bool hasInterpreters() const {return interpreters.size() != 0;}
        std::map<std::string, Interpreter*>::const_iterator beginInterpreters();
        std::map<std::string, Interpreter*>::const_iterator endInterpreters();
 
-
        /* Protocoll:
         *
         * Users may allocate new Data containers with the new*()
@@ -95,25 +93,25 @@ public:
         * thingsmay happen.
         */
        Function* newFunction(uint64_t address);
+       Function* newDynamicFunction(uint64_t address);
        BasicBlock* newBasicBlock(uint64_t address);
        Comment* newGlobalComment(uint64_t address);
        Comment* newLocalComment(uint64_t address, Function* f);
        void finishFunction(Function* f);
        void finishBasicBlock(BasicBlock* b);
-       void finnishComment(Comment* c);
+       void finishComment(Comment* c);
        void deleteFunction(Function* f);
        void deleteBasicBlock(BasicBlock* b);
        void deleteComment(Comment* c);
 
 private:
-       boost::signals2::signal<void ()> reset_signal;
-       boost::signals2::signal<void (Function*)> new_function_signal;
-       boost::signals2::signal<void (const std::string& name)> new_dyn_symbol_signal;
-       boost::signals2::signal<void (RenameFunctionEvent*)> rename_function_signal;
        std::unique_ptr<Disassembler> disassembler;
+
        std::map<std::string, Interpreter*> interpreters;
        std::map<uint64_t, Function*> functions;
        std::map<uint64_t, BasicBlock*> blocks;
+       std::multimap<uint64_t, Comment*> comments;
+
        std::string filename;
        std::unique_ptr<QTemporaryFile> tmpfile;
        std::vector<QPluginLoader*> plugins;