9#ifndef HPP_ALIB_LANG_RESOURCES_RESOURCES
10#define HPP_ALIB_LANG_RESOURCES_RESOURCES 1
12#if !defined (HPP_ALIB_STRINGS_STRING)
16#if !defined (HPP_ALIB_STRINGS_LOCALSTRING)
21#if !defined(ALIB_RESOURCES_OMIT_DEFAULTS)
22# define ALIB_RESOURCES_OMIT_DEFAULTS 0
25#if ALIB_DEBUG_RESOURCES && !defined (_GLIBCXX_VECTOR) && !defined(_VECTOR_)
31namespace alib {
namespace lang::resources {
103 NString256(
"Doubly defined resource \"" ) << name
104 <<
"\" in category: " << category )
187 #if ALIB_CHARACTERS_WIDE
191 return Get( category, nName
ALIB_DBG(, dbgAssert ) );
196 #if ALIB_DEBUG_RESOURCES
224 std::vector<std::tuple<NString, NString, String, integer>>
245 std::vector<std::pair<NString, integer>>
268 AString DbgDump( std::vector<std::tuple<NString, NString, String, integer>>& list,
269 const NString& catFilter =
nullptr,
270 const String& format =
A_CHAR(
"({3:}) {1}={2!TAB20!ESC<!Q}\n") );
326 #if defined(ALIB_DOX)
335 template<
typename TEnableIf= T>
339 template<
typename TEnableIf= T>
350 #if defined(ALIB_DOX)
363 template<
typename TEnableIf= T>
367 template<
typename TEnableIf= T>
377 #if ALIB_CHARACTERS_WIDE && defined(ALIB_DOX)
392 template<
typename TEnableIf= T>
396 #if ALIB_CHARACTERS_WIDE && !defined(ALIB_DOX)
397 template<
typename TEnableIf= T>
403 resourceName
ALIB_DBG(, dbgAssert) );
533 #if defined(ALIB_DOX)
544 void Set(
const T& sample);
568 #if defined(ALIB_DOX)
588 #if ALIB_CHARACTERS_WIDE && defined(ALIB_DOX)
604 #if ALIB_CHARACTERS_WIDE && !defined(ALIB_DOX)
634#define ALIB_RESOURCED( T, ResPool, ResCategory, ResName ) \
635namespace alib::lang::resources { \
636template<> struct T_Resourced<T> : public std::true_type \
638 static ResourcePool* Pool() { return ResPool; } \
639 static constexpr NString Category() { return ResCategory; } \
640 static constexpr NString Name() { return ResName; } \
644# define ALIB_RESOURCED_IN_MODULE( T, Camp, ResName ) \
645 ALIB_RESOURCED( T, &Camp.GetResourcePool(), Camp.ResourceCategory, ResName )
const String & Get(const NString &category, const String &name, bool dbgAssert)
void Bootstrap(const NString &category, const NString &name, const String &data)
virtual ALIB_API std::vector< std::tuple< NString, NString, String, integer > > DbgGetList()
virtual void BootstrapBulk(const nchar *category,...)=0
static ALIB_API AString DbgDump(std::vector< std::tuple< NString, NString, String, integer > > &list, const NString &catFilter=nullptr, const String &format=A_CHAR("({3:}) {1}={2!TAB20!ESC<!Q}\n"))
virtual const String & Get(const NString &category, const NString &name, bool dbgAssert)=0
virtual ALIB_API std::vector< std::pair< NString, integer > > DbgGetCategories()
virtual bool BootstrapAddOrReplace(const NString &category, const NString &name, const String &data)=0
#define ATMP_VOID_IF(Cond)
#define ALIB_WARNINGS_RESTORE
#define ALIB_WARNINGS_ALLOW_NULL_POINTER_PASSING
#define ALIB_ASSERT_ERROR(cond,...)
#define ATMP_T_IF(T, Cond)
@ Get
Denotes to search data.
ALIB_API CString EMPTY_STRING
A global instance of a nulled zero-terminated string of standard character size.
NLocalString< 256 > NString256
Type alias name for TLocalString<nchar,256> .
constexpr NString NullNString()
characters::nchar nchar
Type alias in namespace alib.
const String & Get(const NString &name, bool dbgAssert)
resources::ResourcePool * Pool
ResourceInfo() noexcept=default
void Set(resources::ResourcePool *pool, NString category, NString name)
ResourceInfo(const T &sample)
void Set(const T &sample)
static const String & Get(const NString &name, bool dbgAssert)
static const String & Get()
static const String & TypeNamePrefix()
static const String & TypeNamePostfix()
static constexpr ResourcePool * Pool()
static constexpr NString Category()
static constexpr NString Name()