]> git.lyx.org Git - lyx.git/blobdiff - src/EmbeddedFiles.h
this we don't need anymore
[lyx.git] / src / EmbeddedFiles.h
index 0b1376b2d0c95d6f8fd2b98d2f03cac6b85d1a91..1ef99b34fb870ff6873469ade28d474207a35a92 100644 (file)
@@ -143,7 +143,7 @@ public:
        /// set embedding status. 
        void setEmbed(bool embed);
 
-       /// whether or not embedding is enabled in the current buffer
+       /// whether or not embedding is enabled for the current file
        /**
         * An embedded file needs to know the temp path of a buffer to know
         * where its embedded copy is. This has to be stored within EmbeddedFile
@@ -151,16 +151,16 @@ public:
         * when an embedded file is copied to another buffer, temp_path_ has
         * to be updated and file copying may be needed.
         */
-       bool enabled() const { return !temp_path_.empty(); }
+       bool isEnabled() const { return !temp_path_.empty(); }
        /// enable embedding of this file
-       void enable(bool flag, Buffer const * buf, bool updateFile);
+       void enable(bool enabled, Buffer const & buf, bool updateFile);
 
        /// extract file, does not change embedding status
        bool extract() const;
        /// update embedded file from external file, does not change embedding status
        bool updateFromExternalFile() const;
        /// copy an embedded file to another buffer
-       EmbeddedFile copyTo(Buffer const * buf);
+       EmbeddedFile copyTo(Buffer const & buf);
        ///
        /// After the embedding status is changed, update all insets related
        /// to this file item. For example, a graphic inset may need to monitor
@@ -197,11 +197,38 @@ bool operator==(EmbeddedFile const & lhs, EmbeddedFile const & rhs);
 bool operator!=(EmbeddedFile const & lhs, EmbeddedFile const & rhs);
 
 
-class EmbeddedFileList : public std::vector<EmbeddedFile> {
+class EmbeddedFileList {
 public:
+       ///
+       typedef std::vector<EmbeddedFile>::iterator iterator;
+       ///
+       typedef std::vector<EmbeddedFile>::const_iterator const_iterator;
+       ///
+       iterator begin() { return eflist_.begin(); }
+       iterator end() { return eflist_.end(); }
+       const_iterator begin() const { return eflist_.begin(); }
+       const_iterator end() const { return eflist_.end(); }
+       ///
+       void push_back(EmbeddedFile const & ef) { eflist_.push_back(ef); }
+       ///
+       EmbeddedFile const & back() const { return eflist_.back(); }
+       EmbeddedFile & back() { return eflist_.back(); }
+       ///
+       void clear() { eflist_.clear(); }
+       ///
+       bool empty() const { return eflist_.empty(); }
+       ///
+       void insert(iterator position, const_iterator itbeg, const_iterator itend) 
+               { eflist_.insert(position, itbeg, itend); }
+       void insert(iterator position, EmbeddedFile const & ef)
+               { eflist_.insert(position, ef); }
+       ///
+       iterator erase(iterator position) { return eflist_.erase(position); }
+       
+       
        /// set buffer params embedded flag. Files will be updated or extracted
        /// if such an operation fails, enable will fail.
-       void enable(bool flag, Buffer & buffer, bool updateFile);
+       void enable(bool enabled, Buffer & buffer, bool updateFile);
 
        /// add a file item.
        /** \param file Embedded file to add
@@ -209,8 +236,8 @@ public:
         */
        void registerFile(EmbeddedFile const & file, Inset const * inset,
                Buffer const & buffer);
-       /// returns a pointer to the Embedded file representing this object,
-       /// or null if not found. The filename should be absolute.
+       /// returns an iterator pointing to the Embedded file representing 
+       /// the file with the absolute filename <filename>.
        const_iterator findFile(std::string const & filename) const;
        iterator findFile(std::string const & filename);
 
@@ -220,6 +247,9 @@ public:
        void update(Buffer const & buffer);
        /// write a zip file
        bool writeFile(support::DocFileName const & filename, Buffer const & buffer);
+private:
+       ///
+       std::vector<EmbeddedFile> eflist_;
 };
 
 } // namespace lyx