23 #if !defined (octave_file_ops_h)
24 #define octave_file_ops_h 1
28 #include <sys/types.h>
43 const std::string& dir_sep_str_arg = std::string (
"/"),
44 const std::string& dir_sep_chars_arg = std::string (
"/"))
45 : xdir_sep_char (dir_sep_char_arg), xdir_sep_str (dir_sep_str_arg),
46 xdir_sep_chars (dir_sep_chars_arg) { }
48 typedef std::string (*tilde_expansion_hook) (
const std::string&);
60 return instance_ok () ? instance->xdir_sep_char : 0;
65 return instance_ok () ? instance->xdir_sep_str : std::string ();
70 return instance_ok () ? instance->xdir_sep_chars : std::string ();
75 std::string tmp = dir_sep_chars ();
76 return tmp.find (c) != std::string::npos;
79 static std::string tilde_expand (
const std::string&);
83 static std::string
concat (
const std::string&,
const std::string&);
86 static std::string
tail (
const std::string& path)
88 size_t ipos = path.find_last_of (dir_sep_chars ());
90 if (ipos != std::string::npos)
95 return path.substr (ipos);
99 static std::string native_separator_path (
const std::string& path);
113 static bool instance_ok (
void);
124 extern OCTAVE_API
int
127 extern OCTAVE_API
int
130 extern OCTAVE_API
int
133 extern OCTAVE_API
int
136 extern OCTAVE_API
int
137 octave_link (
const std::string&,
const std::string&);
139 extern OCTAVE_API
int
140 octave_link (
const std::string&,
const std::string&, std::string&);
142 extern OCTAVE_API
int
145 extern OCTAVE_API
int
146 octave_symlink (
const std::string&,
const std::string&, std::string&);
148 extern OCTAVE_API
int
151 extern OCTAVE_API
int
154 extern OCTAVE_API
int
157 extern OCTAVE_API
int
158 octave_rename (
const std::string&,
const std::string&, std::string&);
160 extern OCTAVE_API
int
163 extern OCTAVE_API
int
166 extern OCTAVE_API
int
169 extern OCTAVE_API
int
172 extern OCTAVE_API
int
175 extern OCTAVE_API
int
178 extern OCTAVE_API
int
181 extern OCTAVE_API std::string
184 extern OCTAVE_API std::string
185 octave_tempnam (
const std::string&,
const std::string&, std::string&);
187 extern OCTAVE_API std::string
190 extern OCTAVE_API std::string
OCTAVE_API int octave_rename(const std::string &, const std::string &)
static tilde_expansion_hook tilde_expansion_preexpansion_hook
OCTAVE_API int octave_umask(mode_t)
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
OCTAVE_API std::string octave_canonicalize_file_name(const std::string &)
OCTAVE_API int octave_mkfifo(const std::string &nm, mode_t md)
static tilde_expansion_hook tilde_expansion_failure_hook
OCTAVE_API int octave_link(const std::string &, const std::string &)
std::string xdir_sep_chars
static void cleanup_instance(void)
static file_ops * instance
OCTAVE_API int octave_unlink(const std::string &)
OCTAVE_API int octave_symlink(const std::string &, const std::string &)
static string_vector tilde_additional_suffixes
static std::string tail(const std::string &path)
static std::string dir_sep_chars(void)
OCTAVE_API int octave_mkdir(const std::string &nm, mode_t md)
static string_vector tilde_additional_prefixes
static bool is_dir_sep(char c)
OCTAVE_API std::string octave_tempnam(const std::string &, const std::string &)
OCTAVE_API int octave_readlink(const std::string &, std::string &)
static std::string dir_sep_str(void)
OCTAVE_API int octave_rmdir(const std::string &)
OCTAVE_API int octave_recursive_rmdir(const std::string &)
file_ops(char dir_sep_char_arg=0, const std::string &dir_sep_str_arg=std::string("/"), const std::string &dir_sep_chars_arg=std::string("/"))
static char dir_sep_char(void)