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() ) {
85 while ((actIdx= actParam.
IndexOf(
'&', actIdx)) > 0) {
86 if (actParam.
CharAt(actIdx-1) ==
' ')
87 actParam.
Delete(actIdx-1, 1);
91 while ((actIdx= actParam.
IndexOf(
'*', actIdx)) > 0) {
92 if (actParam.
CharAt(actIdx-1) ==
' ')
93 actParam.
Delete(actIdx-1, 1);
98 while ((actIdx= actParam.
IndexOf(
"...", actIdx)) > 0) {
99 if (actParam.
CharAt(actIdx-1) !=
' ')
104 if ( lastChar ==
'=') {
106 bool inLiteral=
false;
111 if ( lastChar ==
'\0')
113 bool isLitChar= lastChar==
'\'' || lastChar ==
'"';
114 bool isEscChar= lastChar==
'\\';
115 if ( inLiteral ) {
if ( escaped ) { escaped =
false;
continue; }
116 if ( isEscChar) { escaped =
true;
continue; } }
117 if (isLitChar) { inLiteral= !inLiteral;
continue; }
118 if (inLiteral)
continue;
119 if (
String8(
"({[<").IndexOf(lastChar) >= 0)
121 if (
String8(
">)}]").IndexOf(lastChar) >= 0)
122 {
if (--depth < 0)
break;
continue;}
124 if ( depth==0 && (lastChar==
',' || lastChar==
')'))
132 parsed[cntArgs++]=
String(ma, actParam);
144 result->
Count = cntArgs;
147 for (
int i= 0; i< cntArgs; ++i)
158 ALIB_ERROR(
"DXL/TARGET",
"Template brackets expected.")
171 if ( lastChar ==
'\0') {
174 if (
String(
"<([{").IndexOf(lastChar) >= 0 ) ++depth;
175 if (
String(
")]}").IndexOf(lastChar) >= 0 ) --depth;
176 if ( lastChar ==
'>' && --depth< 0 )
break;
177 if ( lastChar ==
',' && depth==0 )
break;
179 actParam.
_<
NC>(lastChar);
185 parsed[cntArgs++]=
String(ma, actParam);
186 if ( depth<0 || lastChar==0) {
197 result->
Count = cntArgs;
200 for (
int i= 0; i< cntArgs; ++i)
208 if (target==
nullptr || target->
Count == 0 ) {
209 if (linkArgs ==
nullptr)
return 2;
210 if (linkArgs->
Count==0)
return 3;
215 if (linkArgs ==
nullptr || linkArgs->
Count==0)
221 bool exactMatch =
true;
222 for (;argNoLink<linkArgs->
Count && argNoTarget<target->
Count;) {
230 if ( argNoLink < linkArgs->
Count )
232 if ( exactMatch && linkArgs->
Count == target->
Count )
242 bool exactMatch =
true;
243 for (;argNoSearch <
Count && argNoTarget < target.
Count;) {
244 auto& tArg= target.
Arguments[argNoTarget];
245 if ( tArg.StartsWith(
Arguments[argNoSearch])
246 || (tArg.StartsWith(
"typename ") && tArg.Substring(9).StartsWith(
Arguments[argNoSearch]) )
247 || (tArg.StartsWith(
"class ") && tArg.Substring(6).StartsWith(
Arguments[argNoSearch]) )
249 if (tArg.Length() !=
Arguments[argNoSearch].Length())
255 if ( argNoSearch <
Count )
264 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.