]> git.lyx.org Git - lyx.git/blobdiff - src/support/filetools.h
add onoff support for "inset-modify changetype xxx" in include inset
[lyx.git] / src / support / filetools.h
index 6d717a58c66783794d9fe45b66f36377c4713fdc..782ba2cc31773218b868d3441b116d849d3a1655 100644 (file)
@@ -4,7 +4,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  *
  * Full author contact details are available in file CREDITS.
  */
 #define LYX_FILETOOL_H
 
 #include "support/docstring.h"
-#include "support/FileName.h"
 
-#include <vector>
 #include <utility>
 #include <string>
 
 namespace lyx {
 namespace support {
 
-/// remove directory and all contents, returns true on success
-bool destroyDir(FileName const & tmpdir);
-
-/// Creates the per buffer temporary directory
-std::string const createBufferTmpDir();
-
-/// Creates directory. Returns true on success
-bool createDirectory(FileName const & name, int permissions);
+class FileName;
 
 /** Creates the global LyX temp dir.
   \p deflt can be an existing directory name. In this case a new directory
@@ -55,11 +46,11 @@ FileName const fileOpenSearch(std::string const & path,
 
 /// How to search files
 enum search_mode {
-       // The file must exist (return an empty file name otherwise)
-       standard_mode,
+       /// The file must exist (return an empty file name otherwise)
+       must_exist,
        /// Only do file name expansion, return the complete name even if
        /// the file does not exist
-       allow_unreadable
+       may_not_exist
 };
 
 /** Returns the real name of file name in directory path, with optional
@@ -70,23 +61,7 @@ enum search_mode {
 FileName const fileSearch(std::string const & path,
                             std::string const & name,
                             std::string const & ext = std::string(),
-                            search_mode mode = standard_mode);
-
-/// Returns a vector of all files in directory dir having extension ext.
-std::vector<FileName> const dirList(FileName const & dir,
-                                      std::string const & ext = std::string());
-
-/** Is directory read only?
-  returns
-    true: dir writeable
-    false: not writeable
-*/
-bool isDirWriteable(FileName const & path);
-
-/** Is a file readable ?
-  Returns true if the file `path' is readable.
- */
-bool isFileReadable(FileName const & path);
+                            search_mode mode = must_exist);
 
 ///
 bool isLyXFilename(std::string const & filename);
@@ -174,7 +149,7 @@ std::string const latex_path(std::string const & path,
                latex_path_dots dots = LEAVE_DOTS);
 
 /// Substitutes active latex characters with underscores in filename
-std::string const makeLatexName(std::string const & file);
+FileName const makeLatexName(FileName const & file);
 
 /** Put the name in quotes suitable for the current shell or python,
     depending on \p style. */
@@ -207,15 +182,6 @@ addExtension(std::string const & name, std::string const & extension);
 /// Return the extension of the file (not including the .)
 std::string const getExtension(std::string const & name);
 
-/** Guess the file format name (as in Format::name()) from contents.
- Normally you don't want to use this directly, but rather
- Formats::getFormatFromFile().
- */
-std::string const getFormatFromContents(FileName const & name);
-
-/// check for zipped file
-bool zippedFile(FileName const & name);
-
 /** \return the name that LyX will give to the unzipped file \p zipped_file
   if the second argument of unzipFile() is empty.
  */
@@ -229,9 +195,6 @@ std::string const unzippedFileName(std::string const & zipped_file);
 FileName const unzipFile(FileName const & zipped_file,
                         std::string const & unzipped_file = std::string());
 
-/// Returns true is path is absolute
-bool absolutePath(std::string const & path);
-
 /// Create absolute path. If impossible, don't do anything
 std::string const expandPath(std::string const & path);
 
@@ -261,17 +224,9 @@ makeRelPath(docstring const & abspath, docstring const & basepath);
 /// Strip filename from path name
 std::string const onlyPath(std::string const & fname);
 
-/** Normalize a path. Constracts path/../path
- *  Also converts paths like /foo//bar ==> /foo/bar
- */
-std::string const normalizePath(std::string const & path);
-
 /// Strips path from filename
 std::string const onlyFilename(std::string const & fname);
 
-/// Get the contents of a file as a huge std::string
-std::string const getFileContents(FileName const & fname);
-
 /** Check and Replace Environmentvariables ${NAME} in Path.
     Replaces all occurences of these, if they are found in the
     environment.
@@ -295,9 +250,6 @@ bool readLink(FileName const & file, FileName & link);
 FileName const findtexfile(std::string const & fil,
                              std::string const & format);
 
-/// remove the autosave-file and give a Message if it can't be done
-void removeAutosaveFile(std::string const & filename);
-
 /// read the BoundingBox entry from a ps/eps/pdf-file
 std::string const readBB_from_PSFile(FileName const & file);
 
@@ -314,7 +266,10 @@ typedef std::pair<int, std::string> cmd_ret;
 
 cmd_ret const runCommand(std::string const & cmd);
 
+
 } // namespace support
 } // namespace lyx
 
+
+
 #endif