19 for (
int i= 0; i<
Count; ++i) {
44 if ( lastChar ==
'\0')
46 actParam.
_<
NC>(lastChar);
47 if ( depth == 0 &&
String(
"=,)").IndexOf(lastChar) >= 0 )
50 if (
String(
"<([{").IndexOf(lastChar) >= 0 ) { depth++;
continue; }
51 if (
String(
">)]}").IndexOf(lastChar) >= 0 ) { depth--;
continue; }
60 for ( ; paramNameStart>=0
62 && ( isalnum(actParam[paramNameStart])
63 ||
'_' == actParam[paramNameStart] )
76 if ( paramNameStart>0 && paramNameStart < actParam.
Length() ) {
86 while ((actIdx= actParam.
IndexOf(
'&', actIdx)) > 0) {
87 if (actParam.
CharAt(actIdx-1) ==
' ')
88 actParam.
Delete(actIdx-1, 1);
92 while ((actIdx= actParam.
IndexOf(
'*', actIdx)) > 0) {
93 if (actParam.
CharAt(actIdx-1) ==
' ')
94 actParam.
Delete(actIdx-1, 1);
99 while ((actIdx= actParam.
IndexOf(
"...", actIdx)) > 0) {
100 if (actParam.
CharAt(actIdx-1) !=
' ')
105 if ( lastChar ==
'=') {
107 bool inLiteral=
false;
112 if ( lastChar ==
'\0')
114 bool isLitChar= lastChar==
'\'' || lastChar ==
'"';
115 bool isEscChar= lastChar==
'\\';
116 if ( inLiteral ) {
if ( escaped ) { escaped =
false;
continue; }
117 if ( isEscChar) { escaped =
true;
continue; } }
118 if (isLitChar) { inLiteral= !inLiteral;
continue; }
119 if (inLiteral)
continue;
120 if (
String8(
"({[<").IndexOf(lastChar) >= 0)
122 if (
String8(
">)}]").IndexOf(lastChar) >= 0)
123 {
if (--depth < 0)
break;
continue;}
125 if ( depth==0 && (lastChar==
',' || lastChar==
')'))
134 parsed[cntArgs++]=
String(ma, actParam);
146 result->
Count = cntArgs;
149 for (
int i= 0; i< cntArgs; ++i)
160 ALIB_ERROR(
"DXL/TARGET",
"Template brackets expected.")
173 if ( lastChar ==
'\0') {
176 if (
String(
"<([{").IndexOf(lastChar) >= 0 ) ++depth;
177 if (
String(
")]}").IndexOf(lastChar) >= 0 ) --depth;
178 if ( lastChar ==
'>' && --depth< 0 )
break;
179 if ( lastChar ==
',' && depth==0 )
break;
181 actParam.
_<
NC>(lastChar);
187 parsed[cntArgs++]=
String(ma, actParam);
188 if ( depth<0 || lastChar==0) {
199 result->
Count = cntArgs;
202 for (
int i= 0; i< cntArgs; ++i)
210 if (target==
nullptr || target->
Count == 0 ) {
211 if (linkArgs ==
nullptr)
return 2;
212 if (linkArgs->
Count==0)
return 3;
217 if (linkArgs ==
nullptr || linkArgs->
Count==0)
223 bool exactMatch =
true;
224 for (;argNoLink<linkArgs->
Count && argNoTarget<target->
Count;) {
232 if ( argNoLink < linkArgs->
Count )
234 if ( exactMatch && linkArgs->
Count == target->
Count )
244 bool exactMatch =
true;
245 for (;argNoSearch <
Count && argNoTarget < target.
Count;) {
246 auto& tArg= target.
Arguments[argNoTarget];
247 if ( tArg.StartsWith(
Arguments[argNoSearch])
248 || (tArg.StartsWith(
"typename ") && tArg.Substring(9).StartsWith(
Arguments[argNoSearch]) )
249 || (tArg.StartsWith(
"class ") && tArg.Substring(6).StartsWith(
Arguments[argNoSearch]) )
251 if (tArg.Length() !=
Arguments[argNoSearch].Length())
257 if ( argNoSearch <
Count )
266 for (
int i= 0; i<
Count; ++i) {
#define ALIB_ERROR(domain,...)
TAString & Delete(integer regionStart, integer regionLength=MAX_LEN)
TAString & InsertAt(const TString< TChar > &src, integer pos)
integer SearchAndReplace(const TString< TChar > &needle, const TString< TChar > &replacement, integer startIdx=0, integer maxReplacements=strings::MAX_LEN, lang::Case sensitivity=lang::Case::Sensitive, integer endIdx=strings::MAX_LEN)
TAString & ShortenTo(integer newLength)
TAString & ShortenBy(integer charsToRemove)
TAString & Trim(const TCString< TChar > &trimChars=CStringConstantsTraits< TChar >::DefaultWhitespaces())
TAString & TrimEnd(const TCString< TChar > &trimChars=CStringConstantsTraits< TChar >::DefaultWhitespaces())
constexpr integer Length() const
bool EndsWith(const TString &needle) const
TChar CharAt(integer idx) const
constexpr bool IsNotEmpty() const
integer IndexOf(const TString &needle, integer startIdx=0, integer endIdx=strings::MAX_LEN) const
TString< TChar > Substring(integer regionStart, integer regionLength=MAX_LEN) const
bool StartsWith(const TString &needle) const
TSubstring & TrimStart(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
TSubstring & TrimEnd(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
static size_t MAX_TEMPLATE_ARGS
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
strings::TString< character > String
strings::TSubstring< character > Substring
LocalString< 256 > String256
strings::TAString< character, lang::HeapAllocator > AString
FunctionArguments()=default
Constructor.
void Print(alib::AString &dest)
alib::String * Arguments
An array of length Count of strings.
static int MATCH(FunctionArguments *linkArgs, FunctionArguments *targetArgs)
int Count
The number of arguments.
static FunctionArguments * PARSE(alib::MonoAllocator &ma, alib::Substring &parser)
TemplateArguments()
Constructor.
int Count
The number of arguments.
static TemplateArguments * PARSE(alib::MonoAllocator &ma, alib::Substring &parser)
int Match(TemplateArguments &target)
void Print(alib::AString &dest)
alib::String * Arguments
An array of length Count of strings.