Applied patch [ 1531615 ] size support for wxFileName

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-08-18 15:30:28 +00:00
parent 95f090310c
commit 23b8a26299
5 changed files with 203 additions and 1 deletions

View File

@@ -137,7 +137,7 @@ See also: \helpref{Traverse}{wxdirtraverse}
\constfunc{bool}{GetFirst}{\param{wxString* }{filename}, \param{const wxString\& }{filespec = wxEmptyString}, \param{int }{flags = wxDIR\_DEFAULT}}
Start enumerating all files matching {\it filespec} (or all files if it is
empty) and flags, return true on success.
empty) and {\it flags}, return \true on success.
\membersection{wxDir::GetName}\label{wxdirgetname}
@@ -156,6 +156,25 @@ Continue enumerating files which satisfy the criteria specified by the last
call to \helpref{GetFirst}{wxdirgetfirst}.
\membersection{wxDir::GetTotalSize}\label{wxdirgettotalsize}
\func{static wxULongLong}{GetTotalSize}{\param{const wxString\& }{dir}, \param{wxArrayString* }{filesSkipped = NULL}}
Returns the size (in bytes) of all files recursively found in {\tt dir} or
{\tt wxInvalidSize} in case of error.
In case it happens that while traversing folders a file's size can not be read,
that file is added to the {\tt filesSkipped} array, if not \NULL, and then
skipped.
This usually happens with some special folders which are locked by the operating system
or by another process. Remember that when {\tt filesSkipped->GetCount()} is not zero,
then the returned value is not 100\% accurate and, if the skipped files were big, it could be
far from real size of the directory.
See also: \helpref{wxFileName::GetHumanReadableSize}{wxfilenamegethumanreadablesize},
\helpref{wxGetDiskSpace}{wxgetdiskspace}
\membersection{wxDir::HasFiles}\label{wxdirhasfiles}
\func{bool}{HasFiles}{\param{const wxString\& }{filespec = wxEmptyString}}

View File

@@ -513,6 +513,33 @@ This is the same as calling \helpref{GetPath}{wxfilenamegetpath}
Return the short form of the path (returns identity on non-Windows platforms).
\membersection{wxFileName::GetSize}\label{wxfilenamegetsize}
\constfunc{wxULongLong}{GetSize}{\void}
\func{static wxULongLong}{GetSize}{\param{const wxString\& }{filename}}
Returns the size of this file (first form) or the size of the given file (second form).
If the file does not exist or its size could not be read (because e.g. the file is locked
by another process) the returned value is {\tt wxInvalidSize}.
\membersection{wxFileName::GetHumanReadableSize}\label{wxfilenamegethumanreadablesize}
\constfunc{wxString}{GetHumanReadableSize}{\param{const wxString\& }{failmsg = "Not available"}, \param{int }{precision = 1}}
\func{static wxString}{GetHumanReadableSize}{\param{const wxULongLong\& }{bytes}, \param{const wxString\& }{nullsize = "Not available"}, \param{int }{precision = 1}}
Returns the size of this file (first form) or the given number of bytes (second form)
in a human-readable form.
If the size could not be retrieved the {\tt failmsg} string is returned (first form).
If {\tt bytes} is {\tt wxInvalidSize} or zero, then {\tt nullsize} is returned (second form).
In case of success, the returned string is a floating-point number with {\tt precision} decimal digits
followed by the size unit (B, kB, MB, GB, TB: respectively bytes, kilobytes, megabytes, gigabytes, terabytes).
\membersection{wxFileName::GetTimes}\label{wxfilenamegettimes}
\constfunc{bool}{GetTimes}{\param{wxDateTime* }{dtAccess}, \param{wxDateTime* }{dtMod}, \param{wxDateTime* }{dtCreate}}