]> git.lyx.org Git - lyx.git/blobdiff - src/support/filename.h
final compilation: wheel was already invented :(
[lyx.git] / src / support / filename.h
index 8683e2dda28b1dd2396cd65822f52e1d86eb755c..2de36719e8673174f03a9785e9a5eb567e195e8d 100644 (file)
@@ -32,20 +32,32 @@ public:
         * explicit because we don't want implicit conversion of relative
         * paths in function arguments (e.g. of unlink).
         * \param abs_filename the file in question. Must have an absolute path.
+        * Encoding is always UTF-8.
         */
        explicit FileName(std::string const & abs_filename);
        virtual ~FileName();
+       /** Set a new filename.
+        * \param filename the file in question. Must have an absolute path.
+        * Encoding is always UTF-8.
+        */
        virtual void set(std::string const & filename);
        virtual void erase();
        /// Is this filename empty?
        bool empty() const { return name_.empty(); }
-       /// get the absolute file name
+       /// get the absolute file name in UTF-8 encoding
        std::string const absFilename() const { return name_; }
        /**
         * Get the file name in the encoding used by the file system.
         * Only use this for accessing the file, e.g. with an fstream.
         */
        std::string const toFilesystemEncoding() 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.
+        */
+       static FileName const fromFilesystemEncoding(std::string const & name);
 protected:
        /// The absolute file name.
        /// The encoding is currently unspecified, anything else than ASCII
@@ -74,6 +86,7 @@ public:
         *  \param save_abs_path how is the file to be output to file?
         */
        DocFileName(std::string const & abs_filename, bool save_abs_path = true);
+       DocFileName(FileName const & abs_filename, bool save_abs_path = true);
 
        /** \param filename the file in question. May have either a relative
         *  or an absolute path.