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.
///
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.
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)
/// 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.
/**
/// 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;
bool operator==(DocFileName const &, DocFileName const &);
bool operator!=(DocFileName const &, DocFileName const &);
-
} // namespace support
} // namespace lyx