libGumball 0.0.1
C23-Based, libGimbal-powered UI Library
Loading...
Searching...
No Matches
gumball_iresource.h
Go to the documentation of this file.
1#ifndef GUM_IRESOURCE_H
2#define GUM_IRESOURCE_H
3
4// View this file's documentation online: https://libgumball.psyops.studio/gumball__iresource_8h.html
5
6/*!
7 * \file gumball_iresource.h
8 * \ref GUM_IResource "GUM_IResource data structure and hierarchy graph"
9 * \ingroup ifaces
10 *
11 * GUM_IResource is the base interface for all resources in libGumball, such as textures and fonts.
12*/
13
14#include <gimbal/gimbal_meta.h>
15#include <gimbal/utils/gimbal_byte_array.h>
16
17/*!
18 * \name Type system
19 * \brief Type UUID and cast operators
20 * @{
21*/
22#define GUM_IRESOURCE_TYPE (GBL_TYPEID (GUM_IResource)) //!< Returns the GUM_IResource Type UUID
23#define GUM_IRESOURCE(instance) (GBL_CAST (GUM_IResource, instance)) //!< Casts an instance of a compatible element to a GUM_IResource
24#define GUM_IRESOURCE_CLASS(klass) (GBL_CLASS_CAST (GUM_IResource, klass)) //!< Casts an class of a compatible element to a GUM_IResource
25#define GUM_IRESOURCE_CLASSOF(instance) (GBL_CLASSOF (GUM_IResource, instance)) //!< Casts an instance of a compatible element to a GUM_IResource
26//! @}
27
28#define GBL_SELF_TYPE GUM_IResource
29
30GBL_DECLS_BEGIN
31GBL_FORWARD_DECLARE_STRUCT(GUM_IResource);
32
33/*!
34 * \struct GUM_IResource
35 * \extends GblInterface
36 * \brief GUM_IResource interface
37 *
38 * GUM_IResource is the base interface for all resources in libGumball.
39*/
40//! \cond
41GBL_INTERFACE_DERIVE(GUM_IResource)
42 GBL_RESULT (*pFnLoad) (GBL_SELF, GblStringRef *path);
43 GBL_RESULT (*pFnUnload) (GBL_SELF);
44 void* (*pFnValue) (GBL_CSELF);
45 GBL_RESULT (*pFnSetValue) (GBL_SELF, void *pValue);
46 GBL_RESULT (*pFnQuark) (GBL_CSELF, GblQuark *quark);
47 GBL_RESULT (*pFnSetQuark) (GBL_SELF, GblQuark quark);
48GBL_INTERFACE_END
49
50GblType GUM_IResource_type(void);
51//! \endcond
52
53//! Returns a new reference to a GUM_IResource, increasing the reference count.
54GBL_EXPORT GUM_IResource *GUM_IResource_ref (GBL_SELF) GBL_NOEXCEPT;
55//! Decrements the reference count for the passed GUM_IResource. \note The GUM_Manager holds a reference to the resource, so to free the resource, call GUM_Manager_unload()
56GBL_EXPORT GblRefCount GUM_IResource_unref (GBL_SELF) GBL_NOEXCEPT;
57//! Returns the backend-specific data of the resource as a void*
58GBL_EXPORT void *GUM_IResource_data (GBL_CSELF) GBL_NOEXCEPT;
59//! Sets the backend-specific data of the resource to the passed void* \note Don't use this function unless you know what you're doing!
60GBL_EXPORT void GUM_IResource_setData (GBL_SELF, void *pValue) GBL_NOEXCEPT;
61
62GBL_DECLS_END
63
64#undef GBL_SELF_TYPE
65
66#endif // GUM_IRESOURCE_H