X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmover.h;h=79a6a01f998da0015b05a84287f4789999884862;hb=e7f4618bcce770369cf46335c2c7f0164b4b8857;hp=1aae717766fb089249c36d50fbe0007dc7a10254;hpb=5ed606f9c5ae2ee31cd665e7d4408f858b6ef9f2;p=lyx.git diff --git a/src/mover.h b/src/mover.h index 1aae717766..79a6a01f99 100644 --- a/src/mover.h +++ b/src/mover.h @@ -18,6 +18,8 @@ namespace lyx { +namespace support { class FileName; } + /** * Utility to copy a file of a specified format from one place to another. * This base class simply invokes the command support::copy(). @@ -34,11 +36,8 @@ public: * \returns true if successful. */ bool - copy(std::string const & from, std::string const & to, - unsigned long int mode = (unsigned long int)-1) const - { - return do_copy(from, to, to, mode); - } + copy(support::FileName const & from, support::FileName const & to, + unsigned long int mode = (unsigned long int)-1) const; /** Copy file @c from to @c to. * \see SpecialisedMover::SpecialisedMover() for an explanation of @@ -49,7 +48,7 @@ public: * \returns true if successful. */ bool - copy(std::string const & from, std::string const & to, + copy(support::FileName const & from, support::FileName const & to, std::string const & latex, unsigned long int mode = (unsigned long int)-1) const { @@ -63,10 +62,7 @@ public: * \returns true if successful. */ bool - rename(std::string const & from, std::string const & to) const - { - return do_rename(from, to, to); - } + rename(support::FileName const & from, support::FileName const & to) const; /** Rename file @c from as @c to. * \see SpecialisedMover::SpecialisedMover() for an explanation of @@ -77,7 +73,7 @@ public: * \returns true if successful. */ bool - rename(std::string const & from, std::string const & to, + rename(support::FileName const & from, support::FileName const & to, std::string const & latex) const { return do_rename(from, to, latex); @@ -85,11 +81,11 @@ public: protected: virtual bool - do_copy(std::string const & from, std::string const & to, + do_copy(support::FileName const & from, support::FileName const & to, std::string const &, unsigned long int mode) const; virtual bool - do_rename(std::string const & from, std::string const & to, + do_rename(support::FileName const & from, support::FileName const & to, std::string const &) const; }; @@ -108,6 +104,8 @@ class SpecialisedMover : public Mover public: SpecialisedMover() {} + virtual ~SpecialisedMover() {} + /** @c command should be of the form * * python $$s/scripts/fig_copy.py $$i $$o $$l @@ -132,11 +130,11 @@ public: private: virtual bool - do_copy(std::string const & from, std::string const & to, + do_copy(support::FileName const & from, support::FileName const & to, std::string const & latex, unsigned long int mode) const; virtual bool - do_rename(std::string const & from, std::string const & to, + do_rename(support::FileName const & from, support::FileName const & to, std::string const & latex) const; std::string command_; @@ -166,9 +164,9 @@ private: typedef std::map SpecialsMap; public: - typedef SpecialsMap::const_iterator iterator; - iterator begin() const { return specials_.begin(); } - iterator end() const { return specials_.end(); } + typedef SpecialsMap::const_iterator const_iterator; + const_iterator begin() const { return specials_.begin(); } + const_iterator end() const { return specials_.end(); } private: Mover default_; @@ -176,8 +174,14 @@ private: }; -extern Movers movers; -extern Movers system_movers; +extern Movers & theMovers(); +/// @c returns the Mover registered for format @c fmt. +extern Mover const & getMover(std::string const & fmt); +/** Register a specialised @c command to be used to copy a file + * of format @c fmt. + */ +extern void setMover(std::string const & fmt, std::string const & command); +extern Movers & theSystemMovers(); } // namespace lyx