14#if ALIB_DEBUG_RESOURCES
21#if ALIB_DEBUG_RESOURCES
33#if ALIB_DEBUG_RESOURCES
42#if !ALIB_DEBUG_RESOURCES
48 (*DbgResourceLoadObserver) << (it.second ?
"Adding Resource: " :
"Replacing Resource: " )
50 <<
"/" << name <<
"=" << resource << std::endl;
63 va_start(args, category);
67 if( key.Name.IsNull() )
71#if ALIB_DEBUG_RESOURCES
73 (*DbgResourceLoadObserver) <<
"Bulk Resource: " << category
74 <<
"/" << key.Name <<
"=" << val << std::endl;
78#if !ALIB_DEBUG_RESOURCES
85 NString4K () <<
"Replacing resource with BootstrapBulk: "
86 << category <<
"/" << key.Name <<
"=" << val )
101#if !ALIB_DEBUG_RESOURCES
102 return dataIt.Mapped();
104 dataIt.Mapped().second++;
105 return dataIt.Mapped().first;
109 NString1K() <<
"Unknown resource! Category: \"" << category
110 <<
"\", Name: \"" << name
117#if ALIB_DEBUG_RESOURCES
118std::vector<std::tuple<NString, NString, String, integer>>
122 "ResourcePool::DbgGetList was not overridden by the ResourcePool type set. "
123 "Note that type built-in ALib type LocalResourcePool does provide an implementation." )
125 return std::vector<std::tuple<NString, NString, String, integer>>();
129std::vector<std::pair<NString, integer>>
133 "ResourcePool::DbgGetCategories was not overridden by the ResourcePool type set. "
134 "Note that type built-in ALib type LocalResourcePool does provide an implementation." )
136 return std::vector<std::pair<NString, integer>>();
139std::vector<std::tuple<NString, NString, String, integer>>
142 std::vector<std::tuple<NString, NString, String, integer>> result;
144 result.reserve(
size_t(
data.
Size() ) );
145 for(
auto& it :
data )
154 std::sort( result.begin(), result.end(),
155 [] (
const std::tuple<NString, NString, String, integer>& a,
156 const std::tuple<NString, NString, String, integer>& b )
159 auto comp= std::get<0>(a).template CompareTo<CHK, Case::Ignore>( std::get<0>(b) );
163 return std::get<1>(a).template CompareTo<CHK, Case::Ignore>( std::get<1>(b) ) < 0;
169std::vector<std::pair<NString, integer>>
172 std::vector<std::pair<NString, integer>> result;
176 for(
auto& entry : list )
178 if( !lastCat.
Equals( std::get<0>(entry) ) )
180 lastCat= std::get<0>(entry);
181 result.push_back( { std::get<0>(entry), 0 } );
183 ++result.back().second;
195 NString actCategory(
nullptr );
198 for(
auto it : list )
210 if( actCategory != std::get<0>(it) )
212 actCategory= std::get<0>(it);
214 <<
'[' << actCategory <<
']' <<
NEW_LINE;
217 formatter->Format( result, format, std::get<0>(it), std::get<1>(it),
218 std::get<2>(it), std::get<3>(it) );
InsertOrAssign(const KeyType &key, const MappedType &mapped)
integer Size() const noexcept
std::pair< Iterator, bool > EmplaceOrAssign(const KeyType &key, TArgs &&... args)
Iterator Find(const KeyType &key)
virtual ALIB_API std::vector< std::tuple< NString, NString, String, integer > > DbgGetList() override
virtual ALIB_API void BootstrapBulk(const nchar *category,...) override
virtual ALIB_API bool BootstrapAddOrReplace(const NString &category, const NString &name, const String &data) override
detail::StaticResourceMap data
A hash map used to store static resources.
static std::ostream * DbgResourceLoadObserver
virtual NALIB_API const String & Get(const NString &category, const NString &name, bool dbgAssert) override
virtual ALIB_API std::vector< std::pair< NString, integer > > DbgGetCategories() override
virtual ALIB_API std::vector< std::tuple< NString, NString, String, integer > > DbgGetList()
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 ALIB_API std::vector< std::pair< NString, integer > > DbgGetCategories()
constexpr bool IsNotEmpty() const
bool Equals(const TString< TChar > &rhs) const
ALIB_API TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
#define ALIB_WARNING(...)
#define ALIB_LOCK_RECURSIVE_WITH(lock)
#define ALIB_ASSERT_ERROR(cond,...)
#define ALIB_ASSERT_WARNING(cond,...)
strings::TString< nchar > NString
Type alias in namespace alib.
constexpr CString NEW_LINE
A zero-terminated string containing the new-line character sequence.
NLocalString< 1024 > NString1K
Type alias name for TLocalString<nchar,1024>.
characters::character character
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
constexpr String NULL_STRING
A nulled string of the default character type.
Key type for hashing resource values.