#include "support/strfwd.h"
#include <ctime>
-#include <vector>
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.
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)
/// \retrun true on success.
bool removeFile() const;
+ /// rename pointed file.
+ /// \retrun true on success.
+ bool renameTo(FileName const & target) const;
+
+ /// change mode of pointed file.
+ /// \retrun true on success.
+ bool changeMode(unsigned long int mode) const;
+
/// remove directory and all contents, returns true on success
bool destroyDirectory() const;
/// 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.
/**
/// change to a directory, return success
bool chdir() const;
-
- /// \return list other files in the directory having optional extension 'ext'.
- std::vector<FileName> dirList(std::string const & ext = empty_string());
/// \param buffer_path if empty, uses `pwd`
docstring const relPath(std::string const & path) const;
+
+ docstring const absoluteFilePath() const;
private:
///
bool operator==(DocFileName const &, DocFileName const &);
bool operator!=(DocFileName const &, DocFileName const &);
-
} // namespace support
} // namespace lyx