ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
resources_debug.cpp
1// #################################################################################################
2// ALib C++ Library
3//
4// Copyright 2013-2025 A-Worx GmbH, Germany
5// Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6// #################################################################################################
7#include "alib_precompile.hpp"
8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
10#endif
11#if ALIB_C20_MODULES
12 module;
13#endif
14// ====================================== Global Fragment ======================================
17#if ALIB_DEBUG_RESOURCES && ALIB_FORMAT
18# include <vector>
19# include <algorithm>
20#endif
21// =========================================== Module ==========================================
22#if ALIB_C20_MODULES
23 module ALib.Format;
25# if ALIB_DEBUG_CONTAINERS
27# endif
28# if ALIB_DEBUG_RESOURCES && ALIB_FORMAT
29 import ALib.Resources;
30 import ALib.Format;
31# endif
32#else
33# include "ALib.Lang.H"
34# include "ALib.Time.H"
36# if ALIB_DEBUG_CONTAINERS
38# endif
39# if ALIB_DEBUG_RESOURCES && ALIB_FORMAT
40# include "ALib.Resources.H"
41# include "ALib.Format.H"
42# endif
43#endif
44
45#if ALIB_DEBUG_RESOURCES && ALIB_FORMAT
46// ====================================== Implementation =======================================
48namespace alib::resources {
49
51AString DbgDump( std::vector<std::tuple<NString, NString, String, integer>>& list,
52 const NString& catFilter, const String& format )
53{
54 AString result;
55 NString actCategory( nullptr );
57 auto& formatter= Formatter::Default;
58 for( auto& it : list )
59 {
60 if( catFilter.IsNotEmpty() )
61 {
62 TokenizerN cats( catFilter, ',');
63 bool found= false;
64 while( cats.HasNext() )
65 found|= cats.Next().Trim().Equals<CHK, lang::Case::Ignore>(std::get<0>(it) );
66 if( !found )
67 continue;
68 }
69
70 if( actCategory != std::get<0>(it) )
71 {
72 actCategory= std::get<0>(it);
73 result << NEW_LINE
74 << '[' << actCategory << ']' << NEW_LINE;
75 }
76
77 formatter->Format( result, format, std::get<0>(it), std::get<1>(it),
78 std::get<2>(it), std::get<3>(it) );
79 }
80
81 return result;
82}
83# include "ALib.Lang.CIMethods.H"
84} // namespace [alib::resources]
85#endif // ALIB_DEBUG_RESOURCES && ALIB_FORMAT
86
static ALIB_DLL threads::RecursiveLock DefaultLock
static ALIB_DLL SPFormatter Default
constexpr bool IsNotEmpty() const
Definition string.inl:371
bool Equals(const TString< TChar > &rhs) const
Definition string.inl:541
TSubstring & Trim(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
ALIB_DLL TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
Definition tokenizer.cpp:26
#define ALIB_LOCK_RECURSIVE_WITH(lock)
Definition alib.inl:1323
AString DbgDump(std::vector< std::tuple< NString, NString, String, integer > > &list, const NString &catFilter, const String &format)
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
strings::util::TTokenizer< nchar > TokenizerN
Type alias in namespace alib.
constexpr CString NEW_LINE
A zero-terminated string containing the new-line character sequence.
Definition cstring.inl:644
strings::TString< nchar > NString
Type alias in namespace alib.
Definition string.inl:2390
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2381
See sibling type NC.
Definition chk_nc.inl:33