10# if !defined (HPP_ALIB_LANG_RESOURCES_LOCALRESOURCEPOOL)
15#if !defined (_GLIBCXX_CSTDARG) && !defined (_CSTDARG_)
19#if ALIB_DEBUG_RESOURCES && !defined (_GLIBCXX_ALGORITHM) && !defined(_ALGORITHM_)
24# if !defined (HPP_ALIB_LANG_FORMAT_FORMATTER_PYTHONSTYLE)
27# if !defined (HPP_ALIB_STRINGS_UTIL_TOKENIZER)
32#if ALIB_DEBUG_RESOURCES && !defined (HPP_ALIB_COMPATIBILITY_STD_STRINGS_IOSTREAM)
46#if ALIB_DEBUG_RESOURCES
55#if !ALIB_DEBUG_RESOURCES
61 (*DbgResourceLoadObserver) << (it.second ?
"Adding Resource: " :
"Replacing Resource: " )
63 <<
"/" << name <<
"=" << resource << std::endl;
76 va_start(args, category);
80 if( key.Name.IsNull() )
84#if ALIB_DEBUG_RESOURCES
86 (*DbgResourceLoadObserver) <<
"Bulk Resource: " << category
87 <<
"/" << key.Name <<
"=" << val << std::endl;
91#if !ALIB_DEBUG_RESOURCES
98 NString4K () <<
"Replacing resource with BootstrapBulk: "
99 << category <<
"/" << key.Name <<
"=" << val )
114#if !ALIB_DEBUG_RESOURCES
115 return dataIt.Mapped();
117 dataIt.Mapped().second++;
118 return dataIt.Mapped().first;
122 NString1K() <<
"Unknown resource! Category: \"" << category
123 <<
"\", Name: \"" << name
130#if ALIB_DEBUG_RESOURCES
131std::vector<std::tuple<NString, NString, String, integer>>
135 "ResourcePool::DbgGetList was not overridden by the ResourcePool type set. "
136 "Note that type built-in ALib type LocalResourcePool does provide an implementation." )
138 return std::vector<std::tuple<NString, NString, String, integer>>();
142std::vector<std::pair<NString, integer>>
146 "ResourcePool::DbgGetCategories was not overridden by the ResourcePool type set. "
147 "Note that type built-in ALib type LocalResourcePool does provide an implementation." )
149 return std::vector<std::pair<NString, integer>>();
152std::vector<std::tuple<NString, NString, String, integer>>
155 std::vector<std::tuple<NString, NString, String, integer>> result;
157 result.reserve(
static_cast<size_t>(
data.
Size() ) );
158 for(
auto& it :
data )
167 std::sort( result.begin(), result.end(),
168 [] (
const std::tuple<NString, NString, String, integer>& a,
169 const std::tuple<NString, NString, String, integer>& b )
172 auto comp= std::get<0>(a).template CompareTo<true, Case::Ignore>( std::get<0>(b) );
176 return std::get<1>(a).template CompareTo<true, Case::Ignore>( std::get<1>(b) ) < 0;
182std::vector<std::pair<NString, integer>>
185 std::vector<std::pair<NString, integer>> result;
189 for(
auto& entry : list )
191 if( !lastCat.
Equals( std::get<0>(entry) ) )
193 lastCat= std::get<0>(entry);
194 result.push_back( { std::get<0>(entry), 0 } );
196 ++result.back().second;
210 NString actCategory(
nullptr );
212 for(
auto it : list )
224 if( actCategory != std::get<0>(it) )
226 actCategory= std::get<0>(it);
228 <<
'[' << actCategory <<
']' <<
NewLine();
231 formatter->Format( result, format, std::get<0>(it), std::get<1>(it),
232 std::get<2>(it), std::get<3>(it) );
234 formatter->Release();
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
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()
InsertOrAssign(const KeyType &key, const MappedType &mapped)
std::pair< Iterator, bool > EmplaceOrAssign(const KeyType &key, TArgs &&... args)
Iterator Find(const KeyType &key)
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_ASSERT_ERROR(cond,...)
#define ALIB_ASSERT_WARNING(cond,...)
#define ALIB_CALLER_PRUNED
constexpr CString NewLine()
strings::TString< nchar > NString
Type alias in namespace alib.
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.
String NULL_STRING
A global instance of a nulled string of standard character size.