From 04ae32cdab5a96467db7a8d4eedb31c9799f0b56 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 26 Feb 2009 00:17:23 +0000 Subject: [PATCH] added wxXmlResource::LoadFile() to avoid URL-vs-filename ambiguity in Load() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59150 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/xrc/xmlres.h | 5 ++++- interface/wx/xrc/xmlres.h | 19 ++++++++++++++++++- src/xrc/xmlres.cpp | 5 +++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h index c15202e..0c80dfc 100644 --- a/include/wx/xrc/xmlres.h +++ b/include/wx/xrc/xmlres.h @@ -109,9 +109,12 @@ public: virtual ~wxXmlResource(); // Loads resources from XML files that match given filemask. - // This method understands VFS (see filesys.h). + // This method understands wxFileSystem URLs if wxUSE_FILESYS. bool Load(const wxString& filemask); + // Loads resources from single XRC file. + bool LoadFile(const wxFileName& file); + // Unload resource from the given XML file (wildcards not allowed) bool Unload(const wxString& filename); diff --git a/interface/wx/xrc/xmlres.h b/interface/wx/xrc/xmlres.h index 41fdb74..460b7fa 100644 --- a/interface/wx/xrc/xmlres.h +++ b/interface/wx/xrc/xmlres.h @@ -196,11 +196,28 @@ public: wxLogError("Couldn't load resources!"); @endcode - This method understands VFS (see wxFileSystem::FindFirst). + @note + If wxUSE_FILESYS is enabled, this method understands wxFileSystem URLs + (see wxFileSystem::FindFirst()). + + @note + If you are sure that the argument is name of single XRC file (rather + than an URL or a wildcard), use LoadFile() instead. + + @see LoadFile() */ bool Load(const wxString& filemask); /** + Simpler form of Load() for loading a single XRC file. + + @since 2.9.0 + + @see Load() + */ + bool LoadFile(const wxFileName& file); + + /** Loads a bitmap resource from a file. */ wxBitmap LoadBitmap(const wxString& name); diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index b8d8b35..115f346 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -178,6 +178,11 @@ bool wxXmlResource::IsArchive(const wxString& filename) #endif // wxUSE_FILESYSTEM +bool wxXmlResource::LoadFile(const wxFileName& file) +{ + return Load(wxFileSystem::FileNameToURL(file)); +} + bool wxXmlResource::Load(const wxString& filemask_) { wxString filemask = ConvertFileNameToURL(filemask_); -- 2.7.4