📄 filename.tex
字号:
\membersection{wxFileName::IsFileExecutable}\label{wxfilenameisfileexecutable}\constfunc{bool}{IsFileExecutable}{\void}\func{static bool}{IsFileExecutable}{\param{const wxString\& }{file}}Returns {\tt true} if a file with this name exists and if this process has execute permissions on it.\membersection{wxFileName::IsFileReadable}\label{wxfilenameisfilereadable}\constfunc{bool}{IsFileReadable}{\void}\func{static bool}{IsFileReadable}{\param{const wxString\& }{file}}Returns {\tt true} if a file with this name exists and if this process has read permissions on it.\membersection{wxFileName::IsFileWritable}\label{wxfilenameisfilewritable}\constfunc{bool}{IsFileWritable}{\void}\func{static bool}{IsFileWritable}{\param{const wxString\& }{file}}Returns {\tt true} if a file with this name exists and if this process has write permissions on it.\membersection{wxFileName::IsOk}\label{wxfilenameisok}\constfunc{bool}{IsOk}{\void}Returns {\tt true} if the filename is valid, {\tt false} if it is notinitialized yet. The assignment functions and\helpref{Clear}{wxfilenameclear} may reset the object to the uninitialized,invalid state (the former only do it on failure).\membersection{wxFileName::IsPathSeparator}\label{wxfilenameispathseparator}\func{static bool}{IsPathSeparator}{\param{wxChar }{ch}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}Returns {\tt true} if the char is a path separator for this format.\membersection{wxFileName::IsRelative}\label{wxfilenameisrelative}\func{bool}{IsRelative}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}Returns {\tt true} if this filename is not absolute.\membersection{wxFileName::IsDir}\label{wxfilenameisdir}\constfunc{bool}{IsDir}{\void}Returns {\tt true} if this object represents a directory, {\tt false} otherwise(i.e. if it is a file). Note that this method doesn't test whether thedirectory or file really exists, you should use \helpref{DirExists}{wxfilenamedirexists} or \helpref{FileExists}{wxfilenamefileexists} for this.\membersection{wxFileName::MacFindDefaultTypeAndCreator}\label{wxfilenamemacfinddefaulttypeandcreator}\func{static bool}{MacFindDefaultTypeAndCreator}{\param{const wxString\& }{ext}, \param{wxUint32* }{type}, \param{wxUint32* }{creator}}On Mac OS, gets the common type and creator for the given extension.\membersection{wxFileName::MacRegisterDefaultTypeAndCreator}\label{wxfilenamemacregisterdefaulttypeandcreator}\func{static void}{MacRegisterDefaultTypeAndCreator}{\param{const wxString\& }{ext}, \param{wxUint32 }{type}, \param{wxUint32 }{creator}}On Mac OS, registers application defined extensions and their default type and creator.\membersection{wxFileName::MacSetDefaultTypeAndCreator}\label{wxfilenamemacsetdefaulttypeandcreator}\func{bool}{MacSetDefaultTypeAndCreator}{\void}On Mac OS, looks up the appropriate type and creator from the registration and then sets it.\membersection{wxFileName::MakeAbsolute}\label{wxfilenamemakeabsolute}\func{bool}{MakeAbsolute}{\param{const wxString\& }{cwd = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}Make the file name absolute. This is a shortcut for{\tt \helpref{Normalize}{wxfilenamenormalize}(wxPATH\_NORM\_DOTS | wxPATH\_NORM\_ABSOLUTE | wxPATH\_NORM\_TILDE, cwd, format)}.\wxheading{See also}\helpref{MakeRelativeTo}{wxfilenamemakerelativeto},\helpref{Normalize}{wxfilenamenormalize},\helpref{IsAbsolute}{wxfilenameisabsolute}\membersection{wxFileName::MakeRelativeTo}\label{wxfilenamemakerelativeto}\func{bool}{MakeRelativeTo}{\param{const wxString\& }{pathBase = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}This function tries to put this file name in a form relative to {\it pathBase}.In other words, it returns the file name which should be used to access thisfile if the current directory were {\it pathBase}.\docparam{pathBase}{the directory to use as root, current directory is used bydefault}\docparam{format}{the file name format, native by default}\wxheading{Return value}{\tt true} if the file name has been changed, {\tt false} if we failed to doanything with it (currently this only happens if the file name is on a volumedifferent from the volume specified by {\it pathBase}).\wxheading{See also}\helpref{Normalize}{wxfilenamenormalize}\membersection{wxFileName::Mkdir}\label{wxfilenamemkdir}\func{bool}{Mkdir}{\param{int }{perm = 0777}, \param{int }{flags = $0$}}\func{static bool}{Mkdir}{\param{const wxString\& }{dir}, \param{int }{perm = 0777}, \param{int }{flags = $0$}}\docparam{dir}{the directory to create}\docparam{parm}{the permissions for the newly created directory}\docparam{flags}{if the flags contain {\tt wxPATH\_MKDIR\_FULL} flag,try to create each directory in the path and also don't return an errorif the target directory already exists.}\wxheading{Return value}Returns {\tt true} if the directory was successfully created, {\tt false}otherwise.\membersection{wxFileName::Normalize}\label{wxfilenamenormalize}\func{bool}{Normalize}{\param{int }{flags = wxPATH\_NORM\_ALL}, \param{const wxString\& }{cwd = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}Normalize the path. With the default flags value, the path will bemade absolute, without any ".." and "." and all environmentvariables will be expanded in it.\docparam{flags}{The kind of normalization to do with the file name. It can beany or-combination of the following constants:\begin{twocollist}\twocolitem{{\bf wxPATH\_NORM\_ENV\_VARS}}{replace env vars with their values}\twocolitem{{\bf wxPATH\_NORM\_DOTS}}{squeeze all .. and . when possible; if there are too many .. and thus they cannot be all removed, \false will be returned}\twocolitem{{\bf wxPATH\_NORM\_CASE}}{if filesystem is case insensitive, transform to lower case}\twocolitem{{\bf wxPATH\_NORM\_ABSOLUTE}}{make the path absolute prepending \arg{cwd}}\twocolitem{{\bf wxPATH\_NORM\_LONG}}{make the path the long form}\twocolitem{{\bf wxPATH\_NORM\_SHORTCUT}}{resolve if it is a shortcut (Windows only)}\twocolitem{{\bf wxPATH\_NORM\_TILDE}}{replace ~ and ~user (Unix only)}\twocolitem{{\bf wxPATH\_NORM\_ALL}}{all of previous flags except \texttt{wxPATH\_NORM\_CASE}}\end{twocollist}}%\docparam{cwd}{If not empty, this directory will be used instead of currentworking directory in normalization (see wxPATH\_NORM\_ABSOLUTE).}\docparam{format}{The file name format to use when processing the paths, native by default.}\wxheading{Return value}\true if normalization was successfully or \false otherwise.\membersection{wxFileName::PrependDir}\label{wxfilenameprependdir}\func{void}{PrependDir}{\param{const wxString\& }{dir}}Prepends a directory to the file path. Please see \helpref{AppendDir}{wxfilenameappenddir} for important notes.\membersection{wxFileName::RemoveDir}\label{wxfilenameremovedir}\func{void}{RemoveDir}{\param{size\_t }{pos}}Removes the specified directory component from the path.\wxheading{See also}\helpref{GetDirCount}{wxfilenamegetdircount}\membersection{wxFileName::RemoveLastDir}\label{wxfilenameremovelastdir}\func{void}{RemoveLastDir}{\void}Removes last directory component from the path.\membersection{wxFileName::Rmdir}\label{wxfilenamermdir}\func{bool}{Rmdir}{\void}\func{static bool}{Rmdir}{\param{const wxString\& }{dir}}Deletes the specified directory from the file system.\membersection{wxFileName::SameAs}\label{wxfilenamesameas}\constfunc{bool}{SameAs}{\param{const wxFileName\& }{filepath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}Compares the filename using the rules of this platform.\membersection{wxFileName::SetCwd}\label{wxfilenamesetcwd}\func{bool}{SetCwd}{\void}\func{static bool}{SetCwd}{\param{const wxString\& }{cwd}}Changes the current working directory.\membersection{wxFileName::SetExt}\label{wxfilenamesetext}\func{void}{SetExt}{\param{const wxString\& }{ext}}Sets the extension of the file name. Setting an empty stringas the extension will remove the extension resulting in a file name without a trailing dot, unlike a call to \helpref{SetEmptyExt}{wxfilenamesetemptyext}.\wxheading{See also}\helpref{SetEmptyExt}{wxfilenamesetemptyext}\helpref{ClearExt}{wxfilenameclearext}\membersection{wxFileName::SetEmptyExt}\label{wxfilenamesetemptyext}\func{void}{SetEmptyExt}{\void}Sets the extension of the file name to be an empty extension. This is different from having no extension at all as the file name will have a trailing dot after a call to this method.\wxheading{See also}\helpref{SetExt}{wxfilenamesetext}\helpref{ClearExt}{wxfilenameclearext}\membersection{wxFileName::SetFullName}\label{wxfilenamesetfullname}\func{void}{SetFullName}{\param{const wxString\& }{fullname}}The full name is the file name and extension (but without the path).\membersection{wxFileName::SetName}\label{wxfilenamesetname}\func{void}{SetName}{\param{const wxString\& }{name}}Sets the name part (without extension).\wxheading{See also}\helpref{SetFullName}{wxfilenamesetfullname}\membersection{wxFileName::SetTimes}\label{wxfilenamesettimes}\func{bool}{SetTimes}{\param{const wxDateTime* }{dtAccess}, \param{const wxDateTime* }{dtMod}, \param{const wxDateTime* }{dtCreate}}Sets the file creation and last access/modification times (any of the pointers may be NULL).\membersection{wxFileName::SetVolume}\label{wxfilenamesetvolume}\func{void}{SetVolume}{\param{const wxString\& }{volume}}Sets the volume specifier.\membersection{wxFileName::SplitPath}\label{wxfilenamesplitpath}\func{static void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{volume}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{bool }{*hasExt = \texttt{NULL}}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}\func{static void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{volume}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}\func{static void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}This function splits a full file name into components: the volume (with thefirst version) path (including the volume in the second version), the base nameand the extension. Any of the output parameters ({\it volume}, {\it path}, {\it name} or {\it ext}) may be {\tt NULL} if you are not interested in thevalue of a particular component. Also, {\it fullpath} may be empty on entry.On return, {\it path} contains the file path (without the trailing separator), {\it name} contains the file name and {\it ext} contains the file extensionwithout leading dot. All three of them may be empty if the correspondingcomponent is. The old contents of the strings pointed to by these parameterswill be overwritten in any case (if the pointers are not {\tt NULL}).Note that for a filename ``foo.'' the extension is present, as indicated by thetrailing dot, but empty. If you need to cope with such cases, you should use \arg{hasExt} instead of relying on testing whether \arg{ext} is empty or not.\membersection{wxFileName::SplitVolume}\label{wxfilenamesplitvolume}\func{static void}{SplitVolume}{\param{const wxString\& }{fullpath}, \param{wxString* }{volume}, \param{wxString* }{path}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}Splits the given \arg{fullpath} into the volume part (which may be empty) andthe pure path part, not containing any volume.\wxheading{See also}\helpref{SplitPath}{wxfilenamesplitpath}\membersection{wxFileName::Touch}\label{wxfilenametouch}\func{bool}{Touch}{\void}Sets the access and modification times to the current moment.\membersection{wxFileName::operator=}\label{wxfilenameoperatorassign}\func{wxFileName\& operator}{operator=}{\param{const wxFileName\& }{filename}}\func{wxFileName\& operator}{operator=}{\param{const wxString\& }{filename}}Assigns the new value to this filename object.\membersection{wxFileName::operator==}\label{wxfilenameoperatorequal}\constfunc{bool operator}{operator==}{\param{const wxFileName\& }{filename}}\constfunc{bool operator}{operator==}{\param{const wxString\& }{filename}}Returns {\tt true} if the filenames are equal. The string {\it filenames} isinterpreted as a path in the native filename format.\membersection{wxFileName::operator!=}\label{wxfilenameoperatornotequal}\constfunc{bool operator}{operator!=}{\param{const wxFileName\& }{filename}}\constfunc{bool operator}{operator!=}{\param{const wxString\& }{filename}}Returns {\tt true} if the filenames are different. The string {\it filenames}is interpreted as a path in the native filename format.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -