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"
18 module ALib.Resources;
20 import ALib.EnumRecords;
41 const NString& resourceCategory,
43 strings::util::Token* token,
50 Substring parser= resourcePool.Get( resourceCategory, resourceName
ALIB_DBG(,
false ) );
56 parser= resourcePool.Get( resourceCategory,
NString256() << resourceName << resourceNo++
60 "Resource string(s) \"{}/{}(nn)\" not found when parsing token.",
61 resourceCategory, resourceName )
63 if( parser.IsEmpty() )
66 while( parser.IsNotEmpty() ) {
67 String actValue= parser.ConsumeToken( outerSeparator );
68 token->Define( actValue, innerSeparator );
72 switch( token->DbgGetError() ) {
76 errorMessage=
"No token name found.";
79 errorMessage=
"Sensitivity value not found.";
82 errorMessage=
"Error parsing the list of minimum lengths.";
85 errorMessage=
" A maximum of 7 minimum length values was exceeded.";
88 errorMessage=
"The number of given minimum length values is greater than 1 "
89 "but does not match the number of segments in the identifier.";
92 errorMessage=
"More than one minimum length value was given but no "
93 "segmentation scheme could be detected." ;
96 errorMessage=
"A minimum length is specified to be higher than the token "
97 "name, respectively the according segment name.";
100 errorMessage=
"The definition string was not completely consumed.";
103 errorMessage=
"Zero minimum length provided for segment which is not the last\n"
104 "of a camel case token.";
107 default:
ALIB_ERROR(
"RESOURCES",
"Illegal switch state." ) break;
110 if( errorMessage.IsNotEmpty() ) {
112 "\n(While reading token table.)\n"
113 " Resource category (module name): \"{}\"\n"
114 " Resource name: \"{}\"\n"
115 " Token value parsed: \"{}\"",
116 resourceCategory, resourceName, actValue )
129 for(
int i= 0 ; i < 35 ; ++i ) {
130 if( resourcePool.Get( resourceCategory,
NString256() << resourceName << (resourceNo + i)
134 "Detected a \"gap\" in numbering of resource strings while parsing "
135 "resource token table: "
136 "From index {} to {}.\n"
137 " Resource category/name: {} / {}",
138 resourceNo - 1, resourceNo + i - 1, resourceCategory, resourceName )
144 "Size mismatch in resourced token table:\n"
145 " Resource category (module name): \"{}\"\n"
146 " Resource name: \"{}\"\n"
147 " Resourced table size: [{}]\n"
148 " Expected table size: [{}]",
149 resourceCategory, resourceName, tableSize, dbgSizeVerifier )
@ ErrorReadingSensitivity
Sensitivity value not found.
@ TooManyMinLengthsGiven
A maximum of 7 minimum length values was exceeded.
@ EmptyName
No token name found.
@ ZeroMinLengthAndNotLastCamelHump
@ ErrorReadingMinLengths
Error parsing the list of minimum lengths.
@ DefinitionStringNotConsumed
The definition string was not completely consumed.
@ MinLenExceedsSegmentLength
#define ALIB_ERROR(domain,...)
#define ALIB_ASSERT_ERROR(cond, domain,...)
constexpr bool IsNotNull(const T &t)
void LoadResourcedTokens(camp::Camp &module, const NString &resourceName, strings::util::Token *target, int dbgSizeVerifier, character outerSeparator=',', character innerSeparator=' ')
strings::TString< nchar > NString
Type alias in namespace alib.
resources::ResourcePool ResourcePool
Type alias in namespace alib.
strings::TCString< nchar > NCString
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
NLocalString< 256 > NString256
Type alias name for TLocalString<nchar,256>.
characters::character character
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.