4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
25 /** \param abs_filename the file in question. Must have an absolute path.
26 * \param save_abs_path how is the file to be output to file?
28 FileName(std::string const & abs_filename, bool save_abs_path = true);
30 /** \param filename the file in question. May have either a relative
31 * or an absolute path.
32 * \param buffer_path if \c filename has a relative path, generate
33 * the absolute path using this.
35 void set(std::string const & filename, std::string const & buffer_path);
38 bool empty() const { return name_.empty(); }
40 bool saveAbsPath() const { return save_abs_path_; }
41 std::string const absFilename() const { return name_; }
42 /// \param buffer_path if empty, uses `pwd`
43 std::string const relFilename(std::string const & buffer_path = std::string()) const;
44 /// \param buf_path if empty, uses `pwd`
45 std::string const outputFilename(std::string const & buf_path = std::string()) const;
47 /** @returns a mangled representation of the absolute file name
48 * suitable for use in the temp dir when, for example, converting
49 * an image file to another format.
51 * @param dir the directory that will contain this file with
52 * its mangled name. This information is used by the mangling
53 * algorithm when determining the maximum allowable length of
56 * An example of a mangled name:
57 * C:/foo bar/baz.eps -> 0C__foo_bar_baz.eps
59 * It is guaranteed that
60 * - two different filenames have different mangled names
61 * - two FileName instances with the same filename have identical
64 * Only the mangled file name is returned. It is not prepended
68 mangledFilename(std::string const & dir = std::string()) const;
70 /// \return true if the file is compressed.
71 bool isZipped() const;
72 /// \return the absolute file name without its .gz, .z, .Z extension
73 std::string const unzippedFilename() const;
78 /// Cache for isZipped() because zippedFile() is expensive
81 mutable bool zipped_valid_;
85 bool operator==(FileName const &, FileName const &);
86 bool operator!=(FileName const &, FileName const &);
89 } // namespace support