wxrust_base/generated/methods_f.rs
1use super::*;
2
3// wxFileName
4/// This trait represents [C++ `wxFileName` class](https://docs.wxwidgets.org/3.2/classwx_file_name.html)'s methods and inheritance.
5///
6/// See [`FileNameIsOwned`] documentation for the class usage.
7pub trait FileNameMethods: WxRustMethods {
8 /// Appends a directory component to the path.
9 ///
10 /// See [C++ `wxFileName::AppendDir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#acd4448c31bed17a4d1886fc01bac6daa).
11 fn append_dir(&self, dir: &str) -> bool {
12 unsafe {
13 let dir = WxString::from(dir);
14 let dir = dir.as_ptr();
15 ffi::wxFileName_AppendDir(self.as_ptr(), dir)
16 }
17 }
18 /// Creates the file name from another filename object.
19 ///
20 /// See [C++ `wxFileName::Assign()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ab75d82f4024c6f15cc4247c8835da557).
21 fn assign<F: FileNameMethods>(&self, filepath: &F) {
22 unsafe {
23 let filepath = filepath.as_ptr();
24 ffi::wxFileName_Assign(self.as_ptr(), filepath)
25 }
26 }
27 // NOT_SUPPORTED: fn Assign1()
28 // NOT_SUPPORTED: fn Assign2()
29 // NOT_SUPPORTED: fn Assign3()
30 // NOT_SUPPORTED: fn Assign4()
31 // NOT_SUPPORTED: fn Assign5()
32 /// Makes this object refer to the current working directory on the specified volume (or current volume if volume is empty).
33 ///
34 /// See [C++ `wxFileName::AssignCwd()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a1cf7a6e3a6ac0f34260ea79f48663cc8).
35 fn assign_cwd(&self, volume: &str) {
36 unsafe {
37 let volume = WxString::from(volume);
38 let volume = volume.as_ptr();
39 ffi::wxFileName_AssignCwd(self.as_ptr(), volume)
40 }
41 }
42 // NOT_SUPPORTED: fn AssignDir()
43 /// Sets this file name object to the home directory.
44 ///
45 /// See [C++ `wxFileName::AssignHomeDir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a021419b87e867a31ff4af5b6e84911cd).
46 fn assign_home_dir(&self) {
47 unsafe { ffi::wxFileName_AssignHomeDir(self.as_ptr()) }
48 }
49 /// The function calls CreateTempFileName() to create a temporary file and sets this object to the name of the file.
50 ///
51 /// See [C++ `wxFileName::AssignTempFileName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a6c56af101aea8c3d98c693811a44db69).
52 fn assign_temp_file_name(&self, prefix: &str) {
53 unsafe {
54 let prefix = WxString::from(prefix);
55 let prefix = prefix.as_ptr();
56 ffi::wxFileName_AssignTempFileName(self.as_ptr(), prefix)
57 }
58 }
59 /// The function calls CreateTempFileName() to create a temporary file name and open fileTemp with it.
60 ///
61 /// See [C++ `wxFileName::AssignTempFileName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#acf47b12b1de8c47fc5cbc2ec7b5fe628).
62 fn assign_temp_file_name_file(&self, prefix: &str, file_temp: *mut c_void) {
63 unsafe {
64 let prefix = WxString::from(prefix);
65 let prefix = prefix.as_ptr();
66 ffi::wxFileName_AssignTempFileName1(self.as_ptr(), prefix, file_temp)
67 }
68 }
69 /// The function calls CreateTempFileName() to create a temporary file name and open fileTemp with it.
70 ///
71 /// See [C++ `wxFileName::AssignTempFileName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a0807cf78dcddc42d2467ee45cc108d08).
72 fn assign_temp_file_name_ffile(&self, prefix: &str, file_temp: *mut c_void) {
73 unsafe {
74 let prefix = WxString::from(prefix);
75 let prefix = prefix.as_ptr();
76 ffi::wxFileName_AssignTempFileName2(self.as_ptr(), prefix, file_temp)
77 }
78 }
79 /// Reset all components to default, uninitialized state.
80 ///
81 /// See [C++ `wxFileName::Clear()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#aa4fbb922dd41ee6012f15c6d162fb0b3).
82 fn clear(&self) {
83 unsafe { ffi::wxFileName_Clear(self.as_ptr()) }
84 }
85 /// Removes the extension from the file name resulting in a file name with no trailing dot.
86 ///
87 /// See [C++ `wxFileName::ClearExt()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a03a2f73191dbf2392b9f1c8e850b407a).
88 fn clear_ext(&self) {
89 unsafe { ffi::wxFileName_ClearExt(self.as_ptr()) }
90 }
91 /// Returns true if the directory with this name exists.
92 ///
93 /// See [C++ `wxFileName::DirExists()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a787c72b7b71d1fa391c5ffd5170e1b17).
94 fn dir_exists(&self) -> bool {
95 unsafe { ffi::wxFileName_DirExists(self.as_ptr()) }
96 }
97 /// Turns off symlink dereferencing.
98 ///
99 /// See [C++ `wxFileName::DontFollowLink()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#af1430dafaf1f522710b52f0a0bf0f060).
100 fn dont_follow_link(&self) {
101 unsafe { ffi::wxFileName_DontFollowLink(self.as_ptr()) }
102 }
103 /// Calls the static overload of this function with the full path of this object.
104 ///
105 /// See [C++ `wxFileName::Exists()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a3a67a151411ee2e7eabbcd6087691ee4).
106 fn exists_int(&self, flags: c_int) -> bool {
107 unsafe { ffi::wxFileName_Exists(self.as_ptr(), flags) }
108 }
109 /// Returns true if the file with this name exists.
110 ///
111 /// See [C++ `wxFileName::FileExists()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a52cb500b34e5338fbd8d3db5867ace9e).
112 fn file_exists(&self) -> bool {
113 unsafe { ffi::wxFileName_FileExists(self.as_ptr()) }
114 }
115 // NOT_SUPPORTED: fn GetAbsolutePath()
116 /// Returns the number of directories in the file name.
117 ///
118 /// See [C++ `wxFileName::GetDirCount()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a3706feaa2a3d3576aa62eeac5094bdd4).
119 fn get_dir_count(&self) -> usize {
120 unsafe { ffi::wxFileName_GetDirCount(self.as_ptr()) }
121 }
122 /// Returns the directories in string array form.
123 ///
124 /// See [C++ `wxFileName::GetDirs()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ae7a4a2abba5a95a547dc35e1ed43a67b).
125 fn get_dirs(&self) -> ArrayStringIsOwned<false> {
126 unsafe { ArrayStringIsOwned::from_ptr(ffi::wxFileName_GetDirs(self.as_ptr())) }
127 }
128 /// Returns the file name extension.
129 ///
130 /// See [C++ `wxFileName::GetExt()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ae5e2d1095dceb2ff315dcfd57e824945).
131 fn get_ext(&self) -> String {
132 unsafe { WxString::from_ptr(ffi::wxFileName_GetExt(self.as_ptr())).into() }
133 }
134 /// Returns the full name (including extension but excluding directories).
135 ///
136 /// See [C++ `wxFileName::GetFullName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#abc779377cd917cc2487b76a5e0ff7949).
137 fn get_full_name(&self) -> String {
138 unsafe { WxString::from_ptr(ffi::wxFileName_GetFullName(self.as_ptr())).into() }
139 }
140 // NOT_SUPPORTED: fn GetFullPath()
141 // NOT_SUPPORTED: fn GetHumanReadableSize()
142 /// Return the long form of the path (returns identity on non-Windows platforms).
143 ///
144 /// See [C++ `wxFileName::GetLongPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ac9866d9a346e6baaa70371ce49d1e29c).
145 fn get_long_path(&self) -> String {
146 unsafe { WxString::from_ptr(ffi::wxFileName_GetLongPath(self.as_ptr())).into() }
147 }
148 /// Returns the last time the file was last modified.
149 ///
150 /// See [C++ `wxFileName::GetModificationTime()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a81fb52063e04c58128f996c8292ce81f).
151 fn get_modification_time(&self) -> DateTime {
152 unsafe { DateTime::from_ptr(ffi::wxFileName_GetModificationTime(self.as_ptr())) }
153 }
154 /// Returns the name part of the filename (without extension).
155 ///
156 /// See [C++ `wxFileName::GetName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ad8f3f744b2c926eee9567bb30f9868a9).
157 fn get_name(&self) -> String {
158 unsafe { WxString::from_ptr(ffi::wxFileName_GetName(self.as_ptr())).into() }
159 }
160 // NOT_SUPPORTED: fn GetPath()
161 // NOT_SUPPORTED: fn GetPathWithSep()
162 /// Return the short form of the path (returns identity on non-Windows platforms).
163 ///
164 /// See [C++ `wxFileName::GetShortPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a522f1e656caef976efd87f82b34b6a85).
165 fn get_short_path(&self) -> String {
166 unsafe { WxString::from_ptr(ffi::wxFileName_GetShortPath(self.as_ptr())).into() }
167 }
168 // NOT_SUPPORTED: fn GetSize()
169 /// Returns the last access, last modification and creation times.
170 ///
171 /// See [C++ `wxFileName::GetTimes()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a57f5777485c1409be723755b54a92a12).
172 fn get_times<D: DateTimeMethods, D2: DateTimeMethods, D3: DateTimeMethods>(
173 &self,
174 dt_access: Option<&D>,
175 dt_mod: Option<&D2>,
176 dt_create: Option<&D3>,
177 ) -> bool {
178 unsafe {
179 let dt_access = match dt_access {
180 Some(r) => r.as_ptr(),
181 None => ptr::null_mut(),
182 };
183 let dt_mod = match dt_mod {
184 Some(r) => r.as_ptr(),
185 None => ptr::null_mut(),
186 };
187 let dt_create = match dt_create {
188 Some(r) => r.as_ptr(),
189 None => ptr::null_mut(),
190 };
191 ffi::wxFileName_GetTimes(self.as_ptr(), dt_access, dt_mod, dt_create)
192 }
193 }
194 /// Returns the string containing the volume for this file name.
195 ///
196 /// See [C++ `wxFileName::GetVolume()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a51afe14188bbfa6442598730db8a9881).
197 fn get_volume(&self) -> String {
198 unsafe { WxString::from_ptr(ffi::wxFileName_GetVolume(self.as_ptr())).into() }
199 }
200 /// Returns true if an extension is present.
201 ///
202 /// See [C++ `wxFileName::HasExt()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#afc1569201ca209ef97457f60cf272bfc).
203 fn has_ext(&self) -> bool {
204 unsafe { ffi::wxFileName_HasExt(self.as_ptr()) }
205 }
206 /// Returns true if a name is present.
207 ///
208 /// See [C++ `wxFileName::HasName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a98f33bc4f026e7e396afdb0e1802f1cf).
209 fn has_name(&self) -> bool {
210 unsafe { ffi::wxFileName_HasName(self.as_ptr()) }
211 }
212 /// Returns true if a volume specifier is present.
213 ///
214 /// See [C++ `wxFileName::HasVolume()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a80820a2958875e8e3a4a4d6e367ae538).
215 fn has_volume(&self) -> bool {
216 unsafe { ffi::wxFileName_HasVolume(self.as_ptr()) }
217 }
218 /// Inserts a directory component before the zero-based position in the directory list.
219 ///
220 /// See [C++ `wxFileName::InsertDir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ae722c59b18f226312565cccb1c70a83f).
221 fn insert_dir(&self, before: usize, dir: &str) -> bool {
222 unsafe {
223 let dir = WxString::from(dir);
224 let dir = dir.as_ptr();
225 ffi::wxFileName_InsertDir(self.as_ptr(), before, dir)
226 }
227 }
228 // NOT_SUPPORTED: fn IsAbsolute()
229 /// Returns true if this object represents a directory, false otherwise (i.e.
230 ///
231 /// See [C++ `wxFileName::IsDir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#abd3d69deb2de515f51e76065f35e75cf).
232 fn is_dir(&self) -> bool {
233 unsafe { ffi::wxFileName_IsDir(self.as_ptr()) }
234 }
235 /// Returns true if the directory component of this instance is an existing directory and this process has read permissions on it.
236 ///
237 /// See [C++ `wxFileName::IsDirReadable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a6d3e8730fe07ccc288a9712f5272ea52).
238 fn is_dir_readable(&self) -> bool {
239 unsafe { ffi::wxFileName_IsDirReadable(self.as_ptr()) }
240 }
241 /// Returns true if the directory component of this instance is an existing directory and this process has write permissions on it.
242 ///
243 /// See [C++ `wxFileName::IsDirWritable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a56d601e5a5a79b75b550da0e1a35e0da).
244 fn is_dir_writable(&self) -> bool {
245 unsafe { ffi::wxFileName_IsDirWritable(self.as_ptr()) }
246 }
247 /// Returns true if a file with this name exists and if this process has execute permissions on it.
248 ///
249 /// See [C++ `wxFileName::IsFileExecutable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#afd7126bf8ce3f1d5ffe675179f5e4ca0).
250 fn is_file_executable(&self) -> bool {
251 unsafe { ffi::wxFileName_IsFileExecutable(self.as_ptr()) }
252 }
253 /// Returns true if a file with this name exists and if this process has read permissions on it.
254 ///
255 /// See [C++ `wxFileName::IsFileReadable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ae1d433eda553c7db2ed533eef8ce3766).
256 fn is_file_readable(&self) -> bool {
257 unsafe { ffi::wxFileName_IsFileReadable(self.as_ptr()) }
258 }
259 /// Returns true if a file with this name exists and if this process has write permissions on it.
260 ///
261 /// See [C++ `wxFileName::IsFileWritable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a097707017ebc8d068e6fa4d38d9efb56).
262 fn is_file_writable(&self) -> bool {
263 unsafe { ffi::wxFileName_IsFileWritable(self.as_ptr()) }
264 }
265 /// Returns true if the filename is valid, false if it is not initialized yet.
266 ///
267 /// See [C++ `wxFileName::IsOk()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a1abe6ced5f0a8f69761cc91711b2a69f).
268 fn is_ok(&self) -> bool {
269 unsafe { ffi::wxFileName_IsOk(self.as_ptr()) }
270 }
271 // NOT_SUPPORTED: fn IsRelative()
272 // NOT_SUPPORTED: fn MakeAbsolute()
273 // NOT_SUPPORTED: fn MakeRelativeTo()
274 /// Creates a directory.
275 ///
276 /// See [C++ `wxFileName::Mkdir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#aa6cc6ee8389c6ce4f94fffa6bdf94b17).
277 fn mkdir_int(&self, perm: c_int, flags: c_int) -> bool {
278 unsafe { ffi::wxFileName_Mkdir(self.as_ptr(), perm, flags) }
279 }
280 // NOT_SUPPORTED: fn Normalize()
281 /// Prepends a directory to the file path.
282 ///
283 /// See [C++ `wxFileName::PrependDir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a577475123161b94cb8f8a597cefe64d5).
284 fn prepend_dir(&self, dir: &str) {
285 unsafe {
286 let dir = WxString::from(dir);
287 let dir = dir.as_ptr();
288 ffi::wxFileName_PrependDir(self.as_ptr(), dir)
289 }
290 }
291 /// Removes the specified directory component from the path.
292 ///
293 /// See [C++ `wxFileName::RemoveDir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ad2b8491684c5bf97395ab9aa2f3d398b).
294 fn remove_dir(&self, pos: usize) {
295 unsafe { ffi::wxFileName_RemoveDir(self.as_ptr(), pos) }
296 }
297 /// Removes last directory component from the path.
298 ///
299 /// See [C++ `wxFileName::RemoveLastDir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ab1336b56add13e0f2830197a3680da94).
300 fn remove_last_dir(&self) {
301 unsafe { ffi::wxFileName_RemoveLastDir(self.as_ptr()) }
302 }
303 // NOT_SUPPORTED: fn ReplaceEnvVariable()
304 // NOT_SUPPORTED: fn ReplaceHomeDir()
305 /// Find the absolute path of the file/directory that is pointed to by this path.
306 ///
307 /// See [C++ `wxFileName::ResolveLink()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a9c4d1743f75827d99951d033b00719ba).
308 fn resolve_link(&self) -> FileName {
309 unsafe { FileName::from_ptr(ffi::wxFileName_ResolveLink(self.as_ptr())) }
310 }
311 /// Deletes the specified directory from the file system.
312 ///
313 /// See [C++ `wxFileName::Rmdir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a55d5f2f9af1a6430a74dfd75ec538028).
314 fn rmdir_int(&self, flags: c_int) -> bool {
315 unsafe { ffi::wxFileName_Rmdir(self.as_ptr(), flags) }
316 }
317 // NOT_SUPPORTED: fn SameAs()
318 /// Changes the current working directory.
319 ///
320 /// See [C++ `wxFileName::SetCwd()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#aa35ca9aa25e0db539031de039c63fd16).
321 fn set_cwd(&self) -> bool {
322 unsafe { ffi::wxFileName_SetCwd(self.as_ptr()) }
323 }
324 /// Sets the extension of the file name to be an empty extension.
325 ///
326 /// See [C++ `wxFileName::SetEmptyExt()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a2d5df1c71c011b0f8897dc51fe8d91ce).
327 fn set_empty_ext(&self) {
328 unsafe { ffi::wxFileName_SetEmptyExt(self.as_ptr()) }
329 }
330 /// Sets the extension of the file name.
331 ///
332 /// See [C++ `wxFileName::SetExt()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a65c37fa5017b400d41009bbab56f2774).
333 fn set_ext(&self, ext: &str) {
334 unsafe {
335 let ext = WxString::from(ext);
336 let ext = ext.as_ptr();
337 ffi::wxFileName_SetExt(self.as_ptr(), ext)
338 }
339 }
340 /// The full name is the file name and extension (but without the path).
341 ///
342 /// See [C++ `wxFileName::SetFullName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a2490c8f2cc92fb88196adc33809a36c0).
343 fn set_full_name(&self, fullname: &str) {
344 unsafe {
345 let fullname = WxString::from(fullname);
346 let fullname = fullname.as_ptr();
347 ffi::wxFileName_SetFullName(self.as_ptr(), fullname)
348 }
349 }
350 /// Sets the name part (without extension).
351 ///
352 /// See [C++ `wxFileName::SetName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a1bf12dfe55c3a2a56982a7a731fa1230).
353 fn set_name(&self, name: &str) {
354 unsafe {
355 let name = WxString::from(name);
356 let name = name.as_ptr();
357 ffi::wxFileName_SetName(self.as_ptr(), name)
358 }
359 }
360 // NOT_SUPPORTED: fn SetPath()
361 /// Sets permissions for this file or directory.
362 ///
363 /// See [C++ `wxFileName::SetPermissions()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ae1b6847990f5b41f5b53fb46a5e5fb79).
364 fn set_permissions(&self, permissions: c_int) -> bool {
365 unsafe { ffi::wxFileName_SetPermissions(self.as_ptr(), permissions) }
366 }
367 /// Sets the file creation and last access/modification times (any of the pointers may be NULL).
368 ///
369 /// See [C++ `wxFileName::SetTimes()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a38d689624c41dd79170fc94fc6be47cf).
370 fn set_times<D: DateTimeMethods, D2: DateTimeMethods, D3: DateTimeMethods>(
371 &self,
372 dt_access: Option<&D>,
373 dt_mod: Option<&D2>,
374 dt_create: Option<&D3>,
375 ) -> bool {
376 unsafe {
377 let dt_access = match dt_access {
378 Some(r) => r.as_ptr(),
379 None => ptr::null_mut(),
380 };
381 let dt_mod = match dt_mod {
382 Some(r) => r.as_ptr(),
383 None => ptr::null_mut(),
384 };
385 let dt_create = match dt_create {
386 Some(r) => r.as_ptr(),
387 None => ptr::null_mut(),
388 };
389 ffi::wxFileName_SetTimes(self.as_ptr(), dt_access, dt_mod, dt_create)
390 }
391 }
392 /// Sets the volume specifier.
393 ///
394 /// See [C++ `wxFileName::SetVolume()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a0c8e256bd978ab9d0cc3c640758b2e2f).
395 fn set_volume(&self, volume: &str) {
396 unsafe {
397 let volume = WxString::from(volume);
398 let volume = volume.as_ptr();
399 ffi::wxFileName_SetVolume(self.as_ptr(), volume)
400 }
401 }
402 /// Return whether some operations will follow symlink.
403 ///
404 /// See [C++ `wxFileName::ShouldFollowLink()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a70a36037ef773e2a00eddb7532e8a3f7).
405 fn should_follow_link(&self) -> bool {
406 unsafe { ffi::wxFileName_ShouldFollowLink(self.as_ptr()) }
407 }
408 /// Sets the access and modification times to the current moment.
409 ///
410 /// See [C++ `wxFileName::Touch()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#aaf2926a7cb0ad2dd79f9c9e14d4c38c1).
411 fn touch(&self) -> bool {
412 unsafe { ffi::wxFileName_Touch(self.as_ptr()) }
413 }
414 // BLOCKED: fn operator!=()
415 // BLOCKED: fn operator!=1()
416 // BLOCKED: fn operator==()
417 // BLOCKED: fn operator==1()
418 // BLOCKED: fn operator=()
419 // BLOCKED: fn operator=1()
420 /// Returns a temporary file name starting with the given prefix.
421 ///
422 /// See [C++ `wxFileName::CreateTempFileName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a416af84fddd624a3b457dbffbe174317).
423 fn create_temp_file_name_file(prefix: &str, file_temp: *mut c_void) -> String {
424 unsafe {
425 let prefix = WxString::from(prefix);
426 let prefix = prefix.as_ptr();
427 WxString::from_ptr(ffi::wxFileName_CreateTempFileName(prefix, file_temp)).into()
428 }
429 }
430 /// This is the same as CreateTempFileName(const wxString &prefix, wxFile *fileTemp) but takes a wxFFile parameter instead of wxFile.
431 ///
432 /// See [C++ `wxFileName::CreateTempFileName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a5a03fe160df4807b4de1c3bd0696d2ad).
433 fn create_temp_file_name_ffile(prefix: &str, file_temp: *mut c_void) -> String {
434 unsafe {
435 let prefix = WxString::from(prefix);
436 let prefix = prefix.as_ptr();
437 WxString::from_ptr(ffi::wxFileName_CreateTempFileName1(prefix, file_temp)).into()
438 }
439 }
440 /// Returns true if the directory with name dir exists.
441 ///
442 /// See [C++ `wxFileName::DirExists()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a706cd439af5469ff913bb022dff1ed71).
443 fn dir_exists_str(dir: &str) -> bool {
444 unsafe {
445 let dir = WxString::from(dir);
446 let dir = dir.as_ptr();
447 ffi::wxFileName_DirExists1(dir)
448 }
449 }
450 // NOT_SUPPORTED: fn DirName()
451 /// Returns true if either a file or a directory or something else with this name exists in the file system.
452 ///
453 /// See [C++ `wxFileName::Exists()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a1229d995f7ba67e0b66f5fb556debfb1).
454 fn exists_str(path: &str, flags: c_int) -> bool {
455 unsafe {
456 let path = WxString::from(path);
457 let path = path.as_ptr();
458 ffi::wxFileName_Exists1(path, flags)
459 }
460 }
461 /// Returns true if the file with name file exists.
462 ///
463 /// See [C++ `wxFileName::FileExists()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ab8a8e5bfeaf12b6479ffc295a68137b9).
464 fn file_exists_str(file: &str) -> bool {
465 unsafe {
466 let file = WxString::from(file);
467 let file = file.as_ptr();
468 ffi::wxFileName_FileExists1(file)
469 }
470 }
471 // NOT_SUPPORTED: fn FileName()
472 /// Retrieves the value of the current working directory on the specified volume.
473 ///
474 /// See [C++ `wxFileName::GetCwd()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#af697f1c0f7864fc35ac0e8198eacc84d).
475 fn get_cwd(volume: &str) -> String {
476 unsafe {
477 let volume = WxString::from(volume);
478 let volume = volume.as_ptr();
479 WxString::from_ptr(ffi::wxFileName_GetCwd(volume)).into()
480 }
481 }
482 // NOT_SUPPORTED: fn GetForbiddenChars()
483 // NOT_SUPPORTED: fn GetFormat()
484 /// Returns the home directory.
485 ///
486 /// See [C++ `wxFileName::GetHomeDir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a8699fafd7b38069c2af0b4f0de89c180).
487 fn get_home_dir() -> String {
488 unsafe { WxString::from_ptr(ffi::wxFileName_GetHomeDir()).into() }
489 }
490 // NOT_SUPPORTED: fn GetHumanReadableSize1()
491 // NOT_SUPPORTED: fn GetPathSeparator()
492 // NOT_SUPPORTED: fn GetPathSeparators()
493 // NOT_SUPPORTED: fn GetPathTerminators()
494 // NOT_SUPPORTED: fn GetSize1()
495 /// Returns the directory used for temporary files, for current user.
496 ///
497 /// See [C++ `wxFileName::GetTempDir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ada549d0b26eb20fc03f42f2182b05fc9).
498 fn get_temp_dir() -> String {
499 unsafe { WxString::from_ptr(ffi::wxFileName_GetTempDir()).into() }
500 }
501 // NOT_SUPPORTED: fn GetVolumeSeparator()
502 // NOT_SUPPORTED: fn GetVolumeString()
503 // NOT_SUPPORTED: fn IsCaseSensitive()
504 /// Returns true if the given dir is an existing directory and this process has read permissions on it.
505 ///
506 /// See [C++ `wxFileName::IsDirReadable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a37759678b0b0e4f01076c4358a2e63b9).
507 fn is_dir_readable_str(dir: &str) -> bool {
508 unsafe {
509 let dir = WxString::from(dir);
510 let dir = dir.as_ptr();
511 ffi::wxFileName_IsDirReadable1(dir)
512 }
513 }
514 /// Returns true if the given dir is an existing directory and this process has write permissions on it.
515 ///
516 /// See [C++ `wxFileName::IsDirWritable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a1af163f5c99159a34be2f905eb1ec03b).
517 fn is_dir_writable_str(dir: &str) -> bool {
518 unsafe {
519 let dir = WxString::from(dir);
520 let dir = dir.as_ptr();
521 ffi::wxFileName_IsDirWritable1(dir)
522 }
523 }
524 /// Returns true if a file with this name exists and if this process has execute permissions on it.
525 ///
526 /// See [C++ `wxFileName::IsFileExecutable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a65973db654e5b7b03eac0079b34f4694).
527 fn is_file_executable_str(file: &str) -> bool {
528 unsafe {
529 let file = WxString::from(file);
530 let file = file.as_ptr();
531 ffi::wxFileName_IsFileExecutable1(file)
532 }
533 }
534 /// Returns true if a file with this name exists and if this process has read permissions on it.
535 ///
536 /// See [C++ `wxFileName::IsFileReadable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#aaf33a5de7f79587a58f9e20ae22d89b4).
537 fn is_file_readable_str(file: &str) -> bool {
538 unsafe {
539 let file = WxString::from(file);
540 let file = file.as_ptr();
541 ffi::wxFileName_IsFileReadable1(file)
542 }
543 }
544 /// Returns true if a file with this name exists and if this process has write permissions on it.
545 ///
546 /// See [C++ `wxFileName::IsFileWritable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ac430b77411e87a46f7a354bcf384cf65).
547 fn is_file_writable_str(file: &str) -> bool {
548 unsafe {
549 let file = WxString::from(file);
550 let file = file.as_ptr();
551 ffi::wxFileName_IsFileWritable1(file)
552 }
553 }
554 // NOT_SUPPORTED: fn IsPathSeparator()
555 // NOT_SUPPORTED: fn IsMSWUniqueVolumeNamePath()
556 /// Creates a directory.
557 ///
558 /// See [C++ `wxFileName::Mkdir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#ac2006b2fb30c0c0f11ef44560e1a62c7).
559 fn mkdir_str(dir: &str, perm: c_int, flags: c_int) -> bool {
560 unsafe {
561 let dir = WxString::from(dir);
562 let dir = dir.as_ptr();
563 ffi::wxFileName_Mkdir1(dir, perm, flags)
564 }
565 }
566 /// Deletes the specified directory from the file system.
567 ///
568 /// See [C++ `wxFileName::Rmdir()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#aa0aa5becff9a6d91ac5108bea7f12932).
569 fn rmdir_str(dir: &str, flags: c_int) -> bool {
570 unsafe {
571 let dir = WxString::from(dir);
572 let dir = dir.as_ptr();
573 ffi::wxFileName_Rmdir1(dir, flags)
574 }
575 }
576 /// Changes the current working directory.
577 ///
578 /// See [C++ `wxFileName::SetCwd()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a5c1d005ca788d42ca5d1c7bf8ff3d6b6).
579 fn set_cwd_str(cwd: &str) -> bool {
580 unsafe {
581 let cwd = WxString::from(cwd);
582 let cwd = cwd.as_ptr();
583 ffi::wxFileName_SetCwd1(cwd)
584 }
585 }
586 /// Converts URL into a well-formed filename.
587 ///
588 /// See [C++ `wxFileName::URLToFileName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a2741a6fa2caf95bb539a562dd4cbadf9).
589 fn url_to_file_name(url: &str) -> FileName {
590 unsafe {
591 let url = WxString::from(url);
592 let url = url.as_ptr();
593 FileName::from_ptr(ffi::wxFileName_URLToFileName(url))
594 }
595 }
596 /// Converts wxFileName into an URL.
597 ///
598 /// See [C++ `wxFileName::FileNameToURL()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a0eed399043b21d4e397e539c46e557e8).
599 fn file_name_to_url<F: FileNameMethods>(filename: &F) -> String {
600 unsafe {
601 let filename = filename.as_ptr();
602 WxString::from_ptr(ffi::wxFileName_FileNameToURL(filename)).into()
603 }
604 }
605 // NOT_SUPPORTED: fn SplitPath()
606 // NOT_SUPPORTED: fn SplitPath1()
607 // NOT_SUPPORTED: fn SplitPath2()
608 // NOT_SUPPORTED: fn SplitVolume()
609 /// Strip the file extension.
610 ///
611 /// See [C++ `wxFileName::StripExtension()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_name.html#a1cc6ef65bdf702fc220893d1e1db1141).
612 fn strip_extension(fullname: &str) -> String {
613 unsafe {
614 let fullname = WxString::from(fullname);
615 let fullname = fullname.as_ptr();
616 WxString::from_ptr(ffi::wxFileName_StripExtension(fullname)).into()
617 }
618 }
619}