From 98080d5c1977bf9fbf5bc8b65fc807cded76f592 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 18 Aug 2006 20:56:34 +0000 Subject: [PATCH] wxFileName size patch git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40662 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/filename.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/include/wx/filename.h b/include/wx/filename.h index 1d4f7f66d2..0012850c91 100644 --- a/include/wx/filename.h +++ b/include/wx/filename.h @@ -19,16 +19,16 @@ 2. more file operations: a) chmod() b) [acm]time() - get and set - c) file size - d) file permissions with readable accessors for most common bits + c) file permissions with readable accessors for most common bits such as IsReadable() &c - e) rename()? + d) rename()? 3. SameFileAs() function to compare inodes under Unix */ #include "wx/arrstr.h" #include "wx/filefn.h" #include "wx/datetime.h" +#include "wx/intl.h" #if wxUSE_FILE class WXDLLIMPEXP_BASE wxFile; @@ -82,6 +82,10 @@ enum wxPATH_MKDIR_FULL = 0x0001 // create directories recursively }; +// error code of wxFileName::GetSize() +extern wxULongLong wxInvalidSize; + + // ---------------------------------------------------------------------------- // wxFileName: encapsulates a file path // ---------------------------------------------------------------------------- @@ -435,6 +439,20 @@ public: wxString *path, wxPathFormat format = wxPATH_NATIVE); + // Filesize + + // returns the size of the given filename + wxULongLong GetSize() const; + static wxULongLong GetSize(const wxString &file); + + // returns the size in a human readable form + wxString GetHumanReadableSize(const wxString &nullsize = _("Not available"), + int precision = 1) const; + static wxString GetHumanReadableSize(const wxULongLong &sz, + const wxString &nullsize = _("Not available"), + int precision = 1); + + // deprecated methods, don't use any more // -------------------------------------- -- 2.45.2