1 #ifndef EXTERNAL_TEXT_EDITOR_HPP_INCLUDED 2 #define EXTERNAL_TEXT_EDITOR_HPP_INCLUDED 3 #ifndef NO_EDITOR 4 5 #include <string> 6 7 #include <boost/shared_ptr.hpp> 8 9 #include "asserts.hpp" 10 #include "variant.hpp" 11 12 class external_text_editor; 13 14 typedef boost::shared_ptr<external_text_editor> external_text_editor_ptr; 15 16 class external_text_editor 17 { 18 public: 19 struct manager { 20 manager(); 21 ~manager(); 22 }; 23 24 static external_text_editor_ptr create(variant key); 25 26 external_text_editor(); 27 virtual ~external_text_editor(); 28 29 void process(); 30 replace_in_game_editor() const31 bool replace_in_game_editor() const { return replace_in_game_editor_; } 32 33 virtual void load_file(const std::string& fname) = 0; 34 virtual void shutdown() = 0; 35 protected: 36 struct editor_error {}; 37 private: 38 external_text_editor(const external_text_editor&); 39 virtual std::string get_file_contents(const std::string& fname) = 0; 40 virtual int get_line(const std::string& fname) const = 0; 41 virtual std::vector<std::string> loaded_files() const = 0; 42 43 bool replace_in_game_editor_; 44 45 //As long as there's one of these things active, we're dynamically loading 46 //in code, and so want to recover from asserts. 47 assert_recover_scope assert_recovery_; 48 }; 49 50 #endif // NO_EDITOR 51 #endif 52