[glibmm] Resource: Move enums into class.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Resource: Move enums into class.
- Date: Tue, 18 Apr 2017 20:04:34 +0000 (UTC)
commit cac9b5e396414831ee44293aa78a6bd604e15148
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Apr 18 21:39:46 2017 +0200
Resource: Move enums into class.
gio/src/resource.ccg | 22 +++++++++++-----------
gio/src/resource.hg | 42 +++++++++++++++++++++---------------------
tools/m4/convert_gio.m4 | 4 ++--
3 files changed, 34 insertions(+), 34 deletions(-)
---
diff --git a/gio/src/resource.ccg b/gio/src/resource.ccg
index 0c7a599..7a579b4 100644
--- a/gio/src/resource.ccg
+++ b/gio/src/resource.ccg
@@ -19,10 +19,10 @@
namespace Gio
{
-// Hand-coded because we want ResourceFlags& instead of guint32&.
+// Hand-coded because we want Flags& instead of guint32&.
void
-Resource::get_info(const std::string& path, gsize& size, ResourceFlags& flags,
- ResourceLookupFlags lookup_flags) const
+Resource::get_info(const std::string& path, gsize& size, Flags& flags,
+ LookupFlags lookup_flags) const
{
guint32 file_flags = 0;
GError* gerror = nullptr;
@@ -32,11 +32,11 @@ Resource::get_info(const std::string& path, gsize& size, ResourceFlags& flags,
(GResourceLookupFlags)lookup_flags, &size, &file_flags, &gerror);
if (gerror)
::Glib::Error::throw_exception(gerror);
- flags = static_cast<ResourceFlags>(file_flags);
+ flags = static_cast<Flags>(file_flags);
}
void
-Resource::get_file_exists(const std::string& path, ResourceLookupFlags lookup_flags) const
+Resource::get_file_exists(const std::string& path, LookupFlags lookup_flags) const
{
GError* gerror = nullptr;
g_resource_get_info(const_cast<GResource*>(gobj()), path.c_str(),
@@ -46,17 +46,17 @@ Resource::get_file_exists(const std::string& path, ResourceLookupFlags lookup_fl
}
bool
-Resource::get_file_exists_nothrow(const std::string& path, ResourceLookupFlags lookup_flags) const
+Resource::get_file_exists_nothrow(const std::string& path, LookupFlags lookup_flags) const
{
return g_resource_get_info(const_cast<GResource*>(gobj()), path.c_str(),
(GResourceLookupFlags)lookup_flags, nullptr, nullptr, nullptr);
}
-// Hand-coded because we want ResourceFlags& instead of guint32&.
+// Hand-coded because we want Flags& instead of guint32&.
// static
void
Resource::get_info_global(
- const std::string& path, gsize& size, ResourceFlags& flags, ResourceLookupFlags lookup_flags)
+ const std::string& path, gsize& size, Flags& flags, LookupFlags lookup_flags)
{
guint32 file_flags = 0;
GError* gerror = nullptr;
@@ -66,12 +66,12 @@ Resource::get_info_global(
path.c_str(), (GResourceLookupFlags)lookup_flags, &size, &file_flags, &gerror);
if (gerror)
::Glib::Error::throw_exception(gerror);
- flags = static_cast<ResourceFlags>(file_flags);
+ flags = static_cast<Flags>(file_flags);
}
// static
void
-Resource::get_file_exists_global(const std::string& path, ResourceLookupFlags lookup_flags)
+Resource::get_file_exists_global(const std::string& path, LookupFlags lookup_flags)
{
GError* gerror = nullptr;
g_resources_get_info(path.c_str(), (GResourceLookupFlags)lookup_flags, nullptr, nullptr, &gerror);
@@ -81,7 +81,7 @@ Resource::get_file_exists_global(const std::string& path, ResourceLookupFlags lo
// static
bool
-Resource::get_file_exists_global_nothrow(const std::string& path, ResourceLookupFlags lookup_flags)
+Resource::get_file_exists_global_nothrow(const std::string& path, LookupFlags lookup_flags)
{
return g_resources_get_info(
path.c_str(), (GResourceLookupFlags)lookup_flags, nullptr, nullptr, nullptr);
diff --git a/gio/src/resource.hg b/gio/src/resource.hg
index 32e8589..96f3b51 100644
--- a/gio/src/resource.hg
+++ b/gio/src/resource.hg
@@ -35,9 +35,6 @@ namespace Gio
*/
_WRAP_GERROR(ResourceError, GResourceError, G_RESOURCE_ERROR, NO_GTYPE, newin "2,34")
-_WRAP_ENUM(ResourceFlags, GResourceFlags, newin "2,44")
-_WRAP_ENUM(ResourceLookupFlags, GResourceLookupFlags, newin "2,44")
-
/** %Resource framework.
*
* Applications and libraries often contain binary or textual data that is
@@ -134,13 +131,16 @@ class Resource final
_IGNORE(g_resource_ref, g_resource_unref)
public:
+ _WRAP_ENUM(Flags, GResourceFlags, newin "2,44")
+ _WRAP_ENUM(LookupFlags, GResourceLookupFlags, newin "2,44")
+
_WRAP_METHOD(static Glib::RefPtr<Resource> create_from_data(const Glib::RefPtr<const Glib::Bytes>& data),
g_resource_new_from_data, errthrow, newin "2,44")
_WRAP_METHOD(static Glib::RefPtr<Resource> create_from_file(const std::string& filename), g_resource_load,
errthrow, newin "2,44")
- _WRAP_METHOD(Glib::RefPtr<InputStream> open_stream(const std::string& path, ResourceLookupFlags
lookup_flags = ResourceLookupFlags::NONE) const, g_resource_open_stream, errthrow, newin "2,44")
- _WRAP_METHOD(Glib::RefPtr<const Glib::Bytes> lookup_data(const std::string& path, ResourceLookupFlags
lookup_flags = ResourceLookupFlags::NONE) const, g_resource_lookup_data, errthrow, newin "2,44")
+ _WRAP_METHOD(Glib::RefPtr<InputStream> open_stream(const std::string& path, LookupFlags lookup_flags =
LookupFlags::NONE) const, g_resource_open_stream, errthrow, newin "2,44")
+ _WRAP_METHOD(Glib::RefPtr<const Glib::Bytes> lookup_data(const std::string& path, LookupFlags lookup_flags
= LookupFlags::NONE) const, g_resource_lookup_data, errthrow, newin "2,44")
#m4 _CONVERSION(`char**',`std::vector<std::string>',`Glib::ArrayHandler<std::string>::array_to_vector($3,
Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(std::vector<std::string> enumerate_children(const std::string& path, ResourceLookupFlags
lookup_flags = ResourceLookupFlags::NONE) const, g_resource_enumerate_children, errthrow, newin "2,44")
+ _WRAP_METHOD(std::vector<std::string> enumerate_children(const std::string& path, LookupFlags lookup_flags
= LookupFlags::NONE) const, g_resource_enumerate_children, errthrow, newin "2,44")
/** Looks for a file at the specified @a path in the resource and
* if found returns information about it.
@@ -152,10 +152,10 @@ public:
* @param path A pathname inside the resource.
* @param[out] size A location to place the length of the contents of the file.
* @param[out] flags A location to place the flags about the file.
- * @param lookup_flags A ResourceLookupFlags.
+ * @param lookup_flags A LookupFlags.
* @throw Gio::ResourceError if the file was not found.
*/
- void get_info(const std::string& path, gsize& size, ResourceFlags& flags, ResourceLookupFlags lookup_flags
= ResourceLookupFlags::NONE) const;
+ void get_info(const std::string& path, gsize& size, Flags& flags, LookupFlags lookup_flags =
LookupFlags::NONE) const;
_IGNORE(g_resource_get_info)
/** Looks for a file at the specified @a path in the resource.
@@ -165,10 +165,10 @@ public:
* @newin{2,44}
*
* @param path A pathname inside the resource.
- * @param lookup_flags A ResourceLookupFlags.
+ * @param lookup_flags A LookupFlags.
* @throw Gio::ResourceError if the file was not found.
*/
- void get_file_exists(const std::string& path, ResourceLookupFlags lookup_flags =
ResourceLookupFlags::NONE) const;
+ void get_file_exists(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE) const;
/** Looks for a file at the specified @a path in the resource.
*
@@ -178,17 +178,17 @@ public:
* @newin{2,44}
*
* @param path A pathname inside the resource.
- * @param lookup_flags A ResourceLookupFlags.
+ * @param lookup_flags A LookupFlags.
* @return <tt>true</tt> if the file was found, <tt>false</tt> if there were errors.
*/
- bool get_file_exists_nothrow(const std::string& path, ResourceLookupFlags lookup_flags =
ResourceLookupFlags::NONE) const;
+ bool get_file_exists_nothrow(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE) const;
// 'register' is a keyword. Can't be the name of a method.
_WRAP_METHOD(void register_global(), g_resources_register, newin "2,44")
_WRAP_METHOD(void unregister_global(), g_resources_unregister, newin "2,44")
- _WRAP_METHOD(static Glib::RefPtr<InputStream> open_stream_global(const std::string& path,
ResourceLookupFlags lookup_flags = ResourceLookupFlags::NONE), g_resources_open_stream, errthrow, newin
"2,44")
- _WRAP_METHOD(static Glib::RefPtr<const Glib::Bytes> lookup_data_global(const std::string& path,
ResourceLookupFlags lookup_flags = ResourceLookupFlags::NONE), g_resources_lookup_data, errthrow, newin
"2,44")
- _WRAP_METHOD(static std::vector<std::string> enumerate_children_global(const std::string& path,
ResourceLookupFlags lookup_flags = ResourceLookupFlags::NONE), g_resources_enumerate_children, errthrow,
newin "2,44")
+ _WRAP_METHOD(static Glib::RefPtr<InputStream> open_stream_global(const std::string& path, LookupFlags
lookup_flags = LookupFlags::NONE), g_resources_open_stream, errthrow, newin "2,44")
+ _WRAP_METHOD(static Glib::RefPtr<const Glib::Bytes> lookup_data_global(const std::string& path,
LookupFlags lookup_flags = LookupFlags::NONE), g_resources_lookup_data, errthrow, newin "2,44")
+ _WRAP_METHOD(static std::vector<std::string> enumerate_children_global(const std::string& path,
LookupFlags lookup_flags = LookupFlags::NONE), g_resources_enumerate_children, errthrow, newin "2,44")
/** Looks for a file at the specified @a path in the set of
* globally registered resources and if found returns information about it.
@@ -200,10 +200,10 @@ public:
* @param path A pathname inside the resource.
* @param[out] size A location to place the length of the contents of the file.
* @param[out] flags A location to place the flags about the file.
- * @param lookup_flags A ResourceLookupFlags.
+ * @param lookup_flags A LookupFlags.
* @throw Gio::ResourceError if the file was not found.
*/
- static void get_info_global(const std::string& path, gsize& size, ResourceFlags& flags,
ResourceLookupFlags lookup_flags = ResourceLookupFlags::NONE);
+ static void get_info_global(const std::string& path, gsize& size, Flags& flags, LookupFlags lookup_flags =
LookupFlags::NONE);
_IGNORE(g_resources_get_info)
/** Looks for a file at the specified @a path in the set of
@@ -214,10 +214,10 @@ public:
* @newin{2,44}
*
* @param path A pathname inside the resource.
- * @param lookup_flags A ResourceLookupFlags.
+ * @param lookup_flags A LookupFlags.
* @throw Gio::ResourceError if the file was not found.
*/
- static void get_file_exists_global(const std::string& path, ResourceLookupFlags lookup_flags =
ResourceLookupFlags::NONE);
+ static void get_file_exists_global(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE);
/** Looks for a file at the specified @a path in the set of
* globally registered resources.
@@ -228,10 +228,10 @@ public:
* @newin{2,44}
*
* @param path A pathname inside the resource.
- * @param lookup_flags A ResourceLookupFlags.
+ * @param lookup_flags A LookupFlags.
* @return <tt>true</tt> if the file was found, <tt>false</tt> if there were errors.
*/
- static bool get_file_exists_global_nothrow(const std::string& path, ResourceLookupFlags lookup_flags =
ResourceLookupFlags::NONE);
+ static bool get_file_exists_global_nothrow(const std::string& path, LookupFlags lookup_flags =
LookupFlags::NONE);
_IGNORE(g_static_resource_init, g_static_resource_fini, g_static_resource_get_resource)dnl//Used only by
the glib-compile-resources command
};
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 3adde7e..474c14b 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -63,8 +63,8 @@ _CONV_GIO_INCLASS_ENUM(Notification,Priority)
_CONV_GIO_INCLASS_ENUM(OutputStream,SpliceFlags)
_CONV_GIO_ENUM(PasswordSave)
_CONV_GIO_INCLASS_ENUM(Resolver,RecordType)
-_CONV_GIO_ENUM(ResourceFlags)
-_CONV_GIO_ENUM(ResourceLookupFlags)
+_CONV_GIO_INCLASS_ENUM(Resource,Flags)
+_CONV_GIO_INCLASS_ENUM(Resource,LookupFlags)
_CONV_GIO_INCLASS_ENUM(Settings,BindFlags)
_CONV_GIO_ENUM(SocketClientEvent)
_CONV_GIO_ENUM(SocketFamily)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]