]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileName.h
cosmetics
[lyx.git] / src / support / FileName.h
index b6a4d85086046b71a73cfe5e1062db1e2010e251..c293f66021fada455cd4ad35df7cabf2aba3d827 100644 (file)
@@ -20,6 +20,9 @@
 namespace lyx {
 namespace support {
 
+/// Defined in "FileNameList.h".
+class FileNameList;
+
 /**
  * Class for storing file names.
  * The file name may be empty. If it is not empty it is an absolute path.
@@ -43,7 +46,7 @@ public:
        ///
        FileName & operator=(FileName const &);
 
-       virtual ~FileName() {}
+       virtual ~FileName();
        /** Set a new filename.
         * \param filename the file in question. Must have an absolute path.
         * Encoding is always UTF-8.
@@ -82,6 +85,8 @@ public:
        bool isWritable() const;
        /// return true when file/directory is writable (write test file)
        bool isDirWritable() const;
+       /// \return list other files in the directory having optional extension 'ext'.
+       FileNameList dirList(std::string const & ext) const;
        
        /// copy a file
        /// \return true when file/directory is writable (write test file)
@@ -98,14 +103,12 @@ public:
        /// Creates directory. Returns true on success
        bool createDirectory(int permissions) const;
 
-       /// Get the contents of a file as a huge std::string
-       std::string fileContents() const;
-       /**
-        * Get a FileName from \p name in the encoding used by the file system.
-        * Only use this for filenames you got directly from the file system,
-        * e.g. from reading a directory.
-        * \p name must have an absolute path.
-        */
+       /// Get the contents of a file as a huge docstring.
+       /// \param encoding defines the encoding of the file contents.
+       /// Only four encodings are supported:
+       /// "UTF-8", "ascii", "latin1" and "local8bit" which uses the
+       /// current system locale.
+       docstring fileContents(std::string const & encoding) const;
 
        /// Change extension.
        /**
@@ -136,8 +139,15 @@ public:
        /// used for display in the Gui
        docstring displayName(int threshold = 1000) const;
 
-//private:
-       friend class DocFileName;
+       /// change to a directory, return success
+       bool chdir() const;
+       
+       /// \param buffer_path if empty, uses `pwd`
+       docstring const relPath(std::string const & path) const;
+       
+       docstring const absoluteFilePath() const;
+
+private:
        ///
        struct Private;
        Private * const d;
@@ -221,7 +231,6 @@ private:
 bool operator==(DocFileName const &, DocFileName const &);
 bool operator!=(DocFileName const &, DocFileName const &);
 
-
 } // namespace support
 } // namespace lyx