X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Ffile_source.h;h=00fb74b426114370723a717526744c9ea78f0451;hb=11a68f7dd38e72c3e497569a60cb0740a33b78cf;hp=e114f8281670dcb9884f8ab19f8cae5cd156ce39;hpb=afb4a5e438b68b15e67bfc5e430c15d4367e2582;p=ardour.git diff --git a/libs/ardour/ardour/file_source.h b/libs/ardour/ardour/file_source.h index e114f82816..00fb74b426 100644 --- a/libs/ardour/ardour/file_source.h +++ b/libs/ardour/ardour/file_source.h @@ -28,34 +28,32 @@ namespace ARDOUR { -class MissingSource : public std::exception +class LIBARDOUR_API MissingSource : public std::exception { public: - MissingSource (const std::string& p, DataType t) throw () - : path (p), type (t) {} - ~MissingSource() throw() {} + MissingSource (const std::string& p, DataType t) throw () + : path (p), type (t) {} + ~MissingSource() throw() {} virtual const char *what() const throw() { return "source file does not exist"; } - std::string path; - DataType type; + std::string path; + DataType type; }; /** A source associated with a file on disk somewhere */ -class FileSource : virtual public Source { +class LIBARDOUR_API FileSource : virtual public Source { public: - virtual ~FileSource () {} - - const std::string& path() const { return _path; } + virtual ~FileSource (); - int unstubify (); - void stubify (); + const std::string& path() const { return _path; } virtual bool safe_file_extension (const std::string& path) const = 0; int move_to_trash (const std::string& trash_dir_name); void mark_take (const std::string& id); - void mark_immutable (); + void mark_immutable (); + void mark_immutable_except_write(); void mark_nonremovable (); const std::string& take_id () const { return _take_id; } @@ -67,31 +65,42 @@ public: int set_source_name (const std::string& newname, bool destructive); static bool find (Session&, DataType type, const std::string& path, - bool must_exist, bool& is_new, uint16_t& chan, - std::string& found_path); + bool must_exist, bool& is_new, uint16_t& chan, + std::string& found_path); static bool find_2X (Session&, DataType type, const std::string& path, - bool must_exist, bool& is_new, uint16_t& chan, - std::string& found_path); + bool must_exist, bool& is_new, uint16_t& chan, + std::string& found_path); - void inc_use_count (); + void inc_use_count (); bool removable () const; + bool is_stub () const; + + const std::string& origin() const { return _origin; } + + virtual void set_path (const std::string&); - const std::string& origin() const { return _origin; } + static PBD::Signal2 > AmbiguousFileName; - static PBD::Signal3 > AmbiguousFileName; + void existence_check (); + virtual void prevent_deletion (); -protected: + /** Rename the file on disk referenced by this source to \param newname + */ + int rename (const std::string& name); + + virtual void close () = 0; + + protected: FileSource (Session& session, DataType type, - const std::string& path, - const std::string& origin, - Source::Flag flags = Source::Flag(0)); + const std::string& path, + const std::string& origin, + Source::Flag flags = Source::Flag(0)); FileSource (Session& session, const XMLNode& node, bool must_exist); virtual int init (const std::string& idstr, bool must_exist); - virtual void set_path (const std::string&); virtual int move_dependents_to_trash() { return 0; } void set_within_session_from_path (const std::string&); @@ -100,9 +109,7 @@ protected: bool _file_is_new; uint16_t _channel; bool _within_session; - std::string _origin; - - void prevent_deletion (); + std::string _origin; }; } // namespace ARDOUR