38 #define ENABLE_TRACING 0 41 #define TRACE(x) printf x 51 bool allowEmptyEntries=
FALSE,
bool cleanup=
TRUE)
56 int i = str.
find( sep, j );
71 else if (allowEmptyEntries)
91 else if (allowEmptyEntries)
107 const char *
p=result.
data();
116 while (*t==
' ' || *t==
'=') {
if (*t++==
'=') found=
TRUE; }
132 static QCString replace(
const char *
s,
char csrc,
char cdst)
135 for (
char *
p=result.
data();*
p;
p++)
137 if (*
p==csrc) *
p=cdst;
147 : m_type(Struct), m_strukt(s), m_raw(
FALSE)
203 else if (tmpType==
List && tmpList ) tmpList->
release();
245 { fields.setAutoDelete(
TRUE); }
262 return ++
p->refCount;
267 int count = --
p->refCount;
325 return ++
p->refCount;
330 int count = --
p->refCount;
340 return p->elems.count();
356 m_it =
m_list.p->elems.begin();
361 m_it =
m_list.p->elems.fromLast();
366 if (m_it!=
m_list.p->elems.end())
386 if (m_index<0 || m_it==m_list.p->elems.end())
410 if (index>=0 && index<(
int)
p->elems.count())
445 Or, And, Not, In, Equal, NotEqual, Less, Greater, LessEqual,
446 GreaterEqual,
Plus, Minus, Multiply, Divide, Modulo, Filter, Colon, Comma,
455 case Or:
return "or";
456 case And:
return "and";
457 case Not:
return "not";
458 case In:
return "in";
459 case Equal:
return "==";
460 case NotEqual:
return "!=";
461 case Less:
return "<";
462 case Greater:
return ">";
463 case LessEqual:
return "<=";
464 case GreaterEqual:
return ">=";
465 case Plus:
return "+";
466 case Minus:
return "-";
467 case Multiply:
return "*";
468 case Divide:
return "/";
469 case Modulo:
return "%";
470 case Filter:
return "|";
471 case Colon:
return ":";
472 case Comma:
return ",";
473 case LeftParen:
return "(";
474 case RightParen:
return ")";
475 case Last:
return "?";
524 { m_outputDir =
dir; }
527 int i=(!ext.
isEmpty() && ext.
at(0)==
'.') ? 1 : 0;
532 m_activeEscapeIntf = ppIntf ? *ppIntf : 0;
541 { m_templateName=templateName; m_line=
line; }
543 int line()
const {
return m_line; }
548 m_spacelessEnabled=
b;
552 if (m_activeEscapeIntf) m_activeEscapeIntf->enableTabbing(b);
558 void openSubIndex(
const QCString &indexName);
559 void closeSubIndex(
const QCString &indexName);
591 return isInt ? v.
toInt() : 0;
600 int lhsValue = variantIntValue(v,lhsIsInt);
602 int rhsValue = variantIntValue(arg,rhsIsInt);
603 if (lhsIsInt && rhsIsInt)
605 return lhsValue+rhsValue;
847 flatten(children.
toList(),list);
925 while ((i=arg.
find(
"{{",p))!=-1)
927 result+=arg.
mid(p,i-p);
928 int j=arg.
find(
"}}",i+2);
1003 if (groupList==0 || elem->
key!=prevKey)
1006 result->
append(groupList);
1007 prevKey = elem->
key;
1054 int pageSize = args.
toInt();
1066 result->
append(pageList);
1105 return item1->
key-item2->
key;
1115 if ((startLetter>=
'0' && startLetter<=
'9') ||
1116 (startLetter>=
'a' && startLetter<=
'z') ||
1117 (startLetter>=
'A' && startLetter<=
'Z'))
1120 if (startLetter>=
'0' && startLetter<=
'9') s[i++] =
'x';
1121 s[i++]=tolower((
char)startLetter);
1126 const char hex[]=
"0123456789abcdef";
1129 if (startLetter>(1<<24))
1131 s[i++]=hex[(startLetter>>28)&0xf];
1132 s[i++]=hex[(startLetter>>24)&0xf];
1134 if (startLetter>(1<<16))
1136 s[i++]=hex[(startLetter>>20)&0xf];
1137 s[i++]=hex[(startLetter>>16)&0xf];
1139 if (startLetter>(1<<8))
1141 s[i++]=hex[(startLetter>>12)&0xf];
1142 s[i++]=hex[(startLetter>>8)&0xf];
1145 s[i++]=hex[(startLetter>>4)&0xf];
1146 s[i++]=hex[(startLetter>>0)&0xf];
1194 if (letter!=elem->
key || indexNode==0)
1199 indexNode->
set(
"letter", keyToLetter(elem->
key));
1200 indexNode->
set(
"label", keyToLabel(elem->
key));
1201 indexNode->
set(
"items",indexList);
1202 result->
append(indexNode);
1229 result=result.
mid(i+1);
1234 result=result.
mid(i+1);
1306 FilterFunction *
func = (FilterFunction*)m_registry.find(name);
1310 return (*func)(v,arg);
1321 m_registry.insert(name,(
void*)func);
1376 {
TRACE((
"ExprAstNumber(%d)\n",num)); }
1388 {
TRACE((
"ExprAstVariable(%s)\n",name)); }
1396 if (ci) ci->
warn(ci->
templateName(),ci->
line(),
"undefined variable '%s' in expression",m_name.data());
1408 : m_var(var), m_args(args)
1409 {
TRACE((
"ExprAstFunctionVariable()\n"));
1410 m_args.setAutoDelete(
TRUE);
1419 for (
uint i=0;i<m_args.count();i++)
1441 {
TRACE((
"ExprAstFilter(%s)\n",name)); }
1447 if (ci==0)
return v;
1450 if (m_arg) arg = m_arg->resolve(c);
1469 : m_expr(expr), m_filter(filter)
1470 {
TRACE((
"ExprAstFilterAppl\n")); }
1474 return m_filter->apply(m_expr->resolve(c),
c);
1486 {
TRACE((
"ExprAstLiteral(%s)\n",lit)); }
1498 {
TRACE((
"ExprAstNegate\n")); }
1518 return -exp.
toInt();
1533 : m_operator(op), m_lhs(lhs), m_rhs(rhs)
1602 int denom = rhs.
toInt();
1609 ci->
warn(ci->
templateName(),ci->
line(),
"division by zero while evaluating expression is undefined");
1615 int denom = rhs.
toInt();
1622 ci->
warn(ci->
templateName(),ci->
line(),
"modulo zero while evaluating expression is undefined");
1663 bool hasNextToken()
const;
1665 void removeNextToken();
1669 void warn(
const char *
fileName,
int line,
const char *fmt,...)
const;
1684 : m_parser(parser), m_line(line), m_tokenStream(0)
1693 if (expr==0)
return 0;
1694 m_tokenStream = expr;
1696 return parseExpression();
1721 TRACE((
"{parseExpression(%s)\n",m_tokenStream));
1723 TRACE((
"}parseExpression(%s)\n",m_tokenStream));
1729 TRACE((
"{parseOrExpression(%s)\n",m_tokenStream));
1730 ExprAst *lhs = parseAndExpression();
1737 ExprAst *rhs = parseAndExpression();
1741 TRACE((
"}parseOrExpression(%s)\n",m_tokenStream));
1747 TRACE((
"{parseAndExpression(%s)\n",m_tokenStream));
1748 ExprAst *lhs = parseNotExpression();
1755 ExprAst *rhs = parseNotExpression();
1759 TRACE((
"}parseAndExpression(%s)\n",m_tokenStream));
1765 TRACE((
"{parseNotExpression(%s)\n",m_tokenStream));
1771 ExprAst *expr = parseCompareExpression();
1774 warn(m_parser->templateName(),m_line,
"argument missing for not operator");
1781 result = parseCompareExpression();
1783 TRACE((
"}parseNotExpression(%s)\n",m_tokenStream));
1789 TRACE((
"{parseCompareExpression(%s)\n",m_tokenStream));
1790 ExprAst *lhs = parseAdditiveExpression();
1805 ExprAst *rhs = parseNotExpression();
1809 TRACE((
"}parseCompareExpression(%s)\n",m_tokenStream));
1815 TRACE((
"{parseAdditiveExpression(%s)\n",m_tokenStream));
1816 ExprAst *lhs = parseMultiplicativeExpression();
1824 ExprAst *rhs = parseMultiplicativeExpression();
1828 TRACE((
"}parseAdditiveExpression(%s)\n",m_tokenStream));
1834 TRACE((
"{parseMultiplicativeExpression(%s)\n",m_tokenStream));
1835 ExprAst *lhs = parseUnaryExpression();
1843 ExprAst *rhs = parseUnaryExpression();
1847 TRACE((
"}parseMultiplicativeExpression(%s)\n",m_tokenStream));
1853 TRACE((
"{parseUnaryExpression(%s)\n",m_tokenStream));
1860 result = parsePrimaryExpression();
1865 ExprAst *rhs = parsePrimaryExpression();
1870 result = parsePrimaryExpression();
1875 result = parsePrimaryExpression();
1877 TRACE((
"}parseUnaryExpression(%s)\n",m_tokenStream));
1883 TRACE((
"{parsePrimary(%s)\n",m_tokenStream));
1885 switch (m_curToken.type)
1887 case ExprToken::Number:
1888 result = parseNumber();
1890 case ExprToken::Identifier:
1891 result = parseFilteredVariable();
1893 case ExprToken::Literal:
1894 result = parseLiteral();
1900 result = parseExpression();
1904 warn(m_parser->templateName(),m_line,
"missing closing parenthesis");
1913 warn(m_parser->templateName(),m_line,
"unexpected operator '%s' in expression",
1918 warn(m_parser->templateName(),m_line,
"unexpected token in expression");
1920 TRACE((
"}parsePrimary(%s)\n",m_tokenStream));
1926 TRACE((
"{parseNumber(%d)\n",m_curToken.num));
1929 TRACE((
"}parseNumber()\n"));
1935 TRACE((
"{parseIdentifier(%s)\n",m_curToken.id.data()));
1938 TRACE((
"}parseIdentifier()\n"));
1944 TRACE((
"{parseLiteral(%s)\n",m_curToken.id.data()));
1947 TRACE((
"}parseLiteral()\n"));
1953 TRACE((
"{parseIdentifierOptionalArgs(%s)\n",m_curToken.id.data()));
1954 ExprAst *expr = parseIdentifier();
1961 ExprAst *argExpr = parsePrimaryExpression();
1968 argExpr = parsePrimaryExpression();
1974 TRACE((
"}parseIdentifierOptionalArgs()\n"));
1980 TRACE((
"{parseFilteredVariable()\n"));
1981 ExprAst *expr = parseIdentifierOptionalArgs();
1993 TRACE((
"}parseFilteredVariable()\n"));
1999 TRACE((
"{parseFilter(%s)\n",m_curToken.id.data()));
2000 QCString filterName = m_curToken.id;
2007 argExpr = parsePrimaryExpression();
2010 TRACE((
"}parseFilter()\n"));
2017 const char *
p = m_tokenStream;
2020 if (p==0 || *p==
'\0')
return FALSE;
2021 while (*p==
' ') p++;
2032 if (c==
'=' && *(p+1)==
'=')
2039 if (c==
'!' && *(p+1)==
'=')
2046 if (c==
'<' && *(p+1)==
'=')
2058 if (c==
'>' && *(p+1)==
'=')
2110 if (strncmp(p,
"not ",4)==0)
2117 if (strncmp(p,
"and ",4)==0)
2124 if (strncmp(p,
"or ",3)==0)
2139 if (c>=
'0' && c<=
'9')
2141 m_curToken.type = ExprToken::Number;
2144 while (*np>=
'0' && *np<=
'9')
2147 m_curToken.num+=*np-
'0';
2152 else if (c==
'_' || (c>=
'a' && c<=
'z') || (c>=
'A' && c<=
'Z'))
2154 m_curToken.type = ExprToken::Identifier;
2159 (c==
'_' || c==
'.' ||
2160 (c>=
'a' && c<=
'z') ||
2161 (c>=
'A' && c<=
'Z') ||
2169 if (m_curToken.id==
"True")
2171 m_curToken.type = ExprToken::Number;
2174 else if (m_curToken.id==
"False")
2176 m_curToken.type = ExprToken::Number;
2180 else if (c==
'"' || c==
'\'')
2182 m_curToken.type = ExprToken::Literal;
2187 while ((c=*p) && (c!=tokenChar || (c==tokenChar && cp==
'\\')))
2190 if (c!=
'\\' || cp==
'\\')
2197 if (*p==tokenChar) p++;
2206 warn(m_parser->templateName(),m_line,
"Found unknown token '%s' (%d) while parsing %s",
s,
c,m_tokenStream);
2244 setAutoDelete(
TRUE);
2248 TRACE((
"{TemplateNodeList::render\n"));
2255 TRACE((
"}TemplateNodeList::render\n"));
2290 virtual int addRef() {
return ++m_refCount; }
2300 : m_engine(e), m_templateName(
"<unknown>"), m_line(1), m_activeEscapeIntf(0),
2327 int i=name.
find(
'.');
2342 i = propName.
find(
".");
2343 int l = i==-1 ? propName.
length() : i;
2351 objName = propName.
left(i);
2352 propName = propName.
mid(i+1);
2361 i = propName.
find(
".");
2362 int l = i==-1 ? propName.
length() : i;
2376 propName = propName.
mid(i+1);
2396 QDict<TemplateVariant> *dict;
2413 QDict<TemplateVariant> *dict =
new QDict<TemplateVariant>;
2414 dict->setAutoDelete(
TRUE);
2435 va_warn(fileName,line,fmt,args);
2442 printf(
"TemplateContextImpl::openSubIndex(%s)\n",indexName.
data());
2456 entry->
set(
"children",list);
2457 entry->
set(
"is_leaf_node",
false);
2463 printf(
"TemplateContextImpl::closeSubIndex(%s)\n",indexName.
data());
2465 if (!stack || stack->count()<3)
2473 delete stack->pop();
2474 delete stack->pop();
2478 delete stack->pop();
2482 entry->
set(
"is_leaf_node",
true);
2536 delete stack->
pop();
2542 if (stack->
count()>1)
2556 for (it=arguments.
begin();it!=arguments.
end();++it)
2558 entry->
set((*it).key,(*it).value);
2560 if (list->
count()>0)
2563 lastEntry->
set(
"last",
false);
2565 entry->
set(
"is_leaf_node",
true);
2566 entry->
set(
"first",list->
count()==0);
2568 entry->
set(
"parent",parent);
2570 entry->
set(
"last",
true);
2584 TRACE((
"TemplateNodeText('%s')\n",replace(data,
'\n',
' ').
data()));
2614 TRACE((
"TemplateNodeVariable(%s)\n",var.
data()));
2616 m_var = expParser.
parse(var);
2672 return new T(parser,parent,line,data);
2677 while (root && root->
parent())
2686 int i=fileName.
find(
'/');
2693 if (!rootDir.
mkdir(outputDir))
2695 err(
"tag OUTPUT_DIRECTORY: Output directory `%s' does not " 2696 "exist and cannot be created\n",outputDir.
data());
2706 bool ok = d.
mkdir(fileName.
mid(j,i-j));
2712 i=fileName.
find(
'/',i+1);
2728 m_ifGuardedNodes.setAutoDelete(
TRUE);
2729 TRACE((
"{TemplateNodeIf(%s)\n",data.
data()));
2745 m_ifGuardedNodes.append(guardedNodes);
2749 while (tok && tok->
data.
left(5)==
"elif ")
2756 m_ifGuardedNodes.append(guardedNodes);
2763 if (tok && tok->
data==
"else")
2767 parser->
parse(
this,line,stopAt,m_falseNodes);
2771 TRACE((
"}TemplateNodeIf(%s)\n",data.
data()));
2783 bool processed=
FALSE;
2805 m_falseNodes.render(ts,c);
2829 TRACE((
"{TemplateNodeRepeat(%s)\n",data.
data()));
2831 m_expr = expParser.
parse(data);
2833 stopAt.
append(
"endrepeat");
2834 parser->
parse(
this,line,stopAt,m_repeatNodes);
2836 TRACE((
"}TemplateNodeRepeat(%s)\n",data.
data()));
2854 s->
set(
"counter0", (
int)i);
2855 s->
set(
"counter", (
int)(i+1));
2856 s->
set(
"revcounter", (
int)(n-i));
2857 s->
set(
"revcounter0", (
int)(n-i-1));
2858 s->
set(
"first",i==0);
2859 s->
set(
"last", i==n-1);
2860 c->
set(
"repeatloop",s.
get());
2862 m_repeatNodes.render(ts,c);
2884 TRACE((
"{TemplateNodeRange(%s)\n",data.
data()));
2886 int i1 = data.
find(
" from ");
2887 int i2 = data.
find(
" to ");
2888 int i3 = data.
find(
" downto ");
2891 if (data.
right(5)==
" from")
2895 else if (data==
"from")
2904 else if (i2==-1 && i3==-1)
2906 if (data.
right(3)==
" to")
2910 else if (data.
right(7)==
" downto")
2912 parser->
warn(
m_templateName,line,
"range is missing end value after 'downto' keyword");
2922 if (m_var.isEmpty())
2929 end = data.
right(data.
length()-i2-4).stripWhiteSpace();
2934 end = data.
right(data.
length()-i3-8).stripWhiteSpace();
2939 m_startExpr = expParser.
parse(start);
2940 m_endExpr = expParser.
parse(end);
2943 stopAt.
append(
"endrange");
2944 parser->
parse(
this,line,stopAt,m_loopNodes);
2946 TRACE((
"}TemplateNodeRange(%s)\n",data.
data()));
2962 if (m_startExpr && m_endExpr)
2970 int l = m_down ? s-e+1 : e-s+1;
2977 int i = m_down ? e :
s;
2983 s->
set(
"counter0", (
int)index);
2984 s->
set(
"counter", (
int)(index+1));
2985 s->
set(
"revcounter", (
int)(l-index));
2986 s->
set(
"revcounter0", (
int)(l-index-1));
2987 s->
set(
"first",index==0);
2988 s->
set(
"last", (
int)index==l-1);
2990 c->
set(
"forloop",s.
get());
2996 m_loopNodes.render(ts,c);
3015 s,m_down?
"downto":
"to",e);
3027 else if (!m_startExpr)
3031 else if (!m_endExpr)
3054 TRACE((
"{TemplateNodeFor(%s)\n",data.
data()));
3056 int i = data.
find(
" in ");
3059 if (data.
right(3)==
" in")
3063 else if (data==
"in")
3075 if (m_vars.count()==0)
3080 int j = data.
find(
" reversed",i);
3081 m_reversed = (j!=-1);
3083 if (j==-1) j=data.
length();
3086 exprStr = data.
mid(i+4,j-i-4);
3094 m_expr = expParser.
parse(exprStr);
3099 parser->
parse(
this,line,stopAt,m_loopNodes);
3101 if (tok && tok->
data==
"empty")
3104 parser->
parse(
this,line,stopAt,m_emptyNodes);
3108 TRACE((
"}TemplateNodeFor(%s)\n",data.
data()));
3136 m_emptyNodes.render(ts,c);
3143 uint index = m_reversed ? listSize-1 : 0;
3150 s->
set(
"counter0", (
int)index);
3151 s->
set(
"counter", (
int)(index+1));
3152 s->
set(
"revcounter", (
int)(listSize-index));
3153 s->
set(
"revcounter0", (
int)(listSize-index-1));
3154 s->
set(
"first",index==0);
3155 s->
set(
"last", index==listSize-1);
3157 c->
set(
"forloop",s.
get());
3162 if (m_vars.count()==1)
3164 c->
set(m_vars[vi++],v);
3169 for (
uint i=0;i<m_vars.count();i++,vi++)
3174 for (;vi<m_vars.count();vi++)
3180 m_loopNodes.render(ts,c);
3182 if (m_reversed) index--;
else index++;
3211 TRACE((
"{TemplateNodeMsg()\n"));
3214 parser->
parse(
this,line,stopAt,m_nodes);
3216 TRACE((
"}TemplateNodeMsg()\n"));
3228 m_nodes.render(ts,c);
3247 TRACE((
"{TemplateNodeBlock(%s)\n",data.
data()));
3249 if (m_blockName.isEmpty())
3254 stopAt.
append(
"endblock");
3255 parser->
parse(
this,line,stopAt,m_nodes);
3257 TRACE((
"}TemplateNodeBlock(%s)\n",data.
data()));
3277 if (sb && sb!=nb && sb!=
this)
3283 m_nodes.render(ss,c);
3288 ci->
set(
"block",superBlock.
get());
3300 m_nodes.render(ts,c);
3325 TRACE((
"{TemplateNodeExtend(%s)\n",data.
data()));
3331 m_extendExpr = ep.
parse(data);
3333 parser->
parse(
this,line,stopAt,m_nodes);
3334 TRACE((
"}TemplateNodeExtend(%s)\n",data.
data()));
3338 delete m_extendExpr;
3346 if (m_extendExpr==0)
return;
3348 QCString extendFile = m_extendExpr->resolve(c).toString();
3383 baseTemplate->
render(ts,c);
3408 TRACE((
"TemplateNodeInclude(%s)\n",data.
data()));
3414 m_includeExpr = ep.
parse(data);
3418 delete m_includeExpr;
3427 QCString includeFile = m_includeExpr->resolve(c).toString();
3441 incTemplate->
render(ts,c);
3461 const char *src = s.
data();
3464 char *dst = s.
data();
3466 bool skipSpaces=
TRUE;
3469 if (c==
'\n') { *dst++=
c; skipSpaces=
TRUE; }
3470 else if (c==
' ' && skipSpaces) {}
3471 else { *dst++=
c; skipSpaces=
FALSE; }
3484 TRACE((
"TemplateNodeCreate(%s)\n",data.
data()));
3490 int i = data.
find(
" from ");
3493 if (data.
right(3)==
" from")
3495 parser->
warn(
m_templateName,line,
"create is missing template name after 'from' keyword");
3497 else if (data==
"from")
3515 delete m_templateExpr;
3523 if (m_templateExpr && m_fileExpr)
3525 QCString templateFile = m_templateExpr->resolve(c).toString();
3531 else if (outputFile.
isEmpty())
3544 extension=extension.
right(extension.
length()-i-1);
3551 mkpath(ci,outputFile);
3565 createTemplate->
render(os,c);
3599 : object(o), list(l), templateCtx(c) {}
3608 TRACE((
"{TemplateNodeTree(%s)\n",data.
data()));
3614 m_treeExpr = ep.
parse(data);
3616 stopAt.
append(
"endrecursetree");
3617 parser->
parse(
this,line,stopAt,m_treeNodes);
3619 TRACE((
"}TemplateNodeTree(%s)\n",data.
data()));
3644 c->
set(
"node",node);
3645 bool hasChildren=
FALSE;
3653 if (list && list->
count()>0)
3658 c->
set(
"children",children);
3659 m_treeNodes.render(ss,c);
3675 m_treeNodes.render(ss,c);
3680 return result.
data();
3693 ts << renderChildren(&ctx);
3722 TRACE((
"{TemplateNodeIndexEntry(%s)\n",data.
data()));
3723 m_args.setAutoDelete(
TRUE);
3727 if (it==args.
end() || (*it).find(
'=')!=-1)
3735 while (it!=args.
end())
3738 int j=arg.
find(
'=');
3754 TRACE((
"}TemplateNodeIndexEntry(%s)\n",data.
data()));
3760 if (!m_name.isEmpty())
3787 TRACE((
"{TemplateNodeOpenSubIndex(%s)\n",data.
data()));
3789 if (m_name.isEmpty())
3793 else if (m_name.find(
' ')!=-1)
3798 TRACE((
"}TemplateNodeOpenSubIndex(%s)\n",data.
data()));
3804 if (!m_name.isEmpty())
3823 TRACE((
"{TemplateNodeCloseSubIndex(%s)\n",data.
data()));
3825 if (m_name.isEmpty())
3829 else if (m_name.find(
' ')!=-1 || m_name.isEmpty())
3834 TRACE((
"}TemplateNodeCloseSubIndex(%s)\n",data.
data()));
3840 if (!m_name.isEmpty())
3867 TRACE((
"{TemplateNodeWith(%s)\n",data.
data()));
3868 m_args.setAutoDelete(
TRUE);
3873 while (it!=args.
end())
3876 int j=arg.
find(
'=');
3892 stopAt.
append(
"endwith");
3893 parser->
parse(
this,line,stopAt,m_nodes);
3895 TRACE((
"}TemplateNodeWith(%s)\n",data.
data()));
3913 m_nodes.render(ts,c);
3930 TRACE((
"{TemplateNodeCycle(%s)\n",data.
data()));
3931 m_args.setAutoDelete(
TRUE);
3936 while (it!=args.
end())
3941 m_args.append(expr);
3945 if (m_args.count()<2)
3947 parser->
warn(parser->
templateName(),
line,
"expected at least two arguments for cycle command, got %d",m_args.count());
3949 TRACE((
"}TemplateNodeCycle(%s)\n",data.
data()));
3955 if (m_index<m_args.count())
3971 if (++m_index==m_args.count())
3997 TRACE((
"{TemplateNodeSet(%s)\n",data.
data()));
4000 int j=data.
find(
'=');
4002 if (j>0 && (expr = expParser.
parse(data.
mid(j+1))))
4006 TRACE((
"}TemplateNodeSet(%s)\n",data.
data()));
4020 ci->
set(m_mapping->name,value);
4036 TRACE((
"{TemplateNodeSpaceless()\n"));
4038 stopAt.
append(
"endspaceless");
4039 parser->
parse(
this,line,stopAt,m_nodes);
4041 TRACE((
"}TemplateNodeSpaceless()\n"));
4050 m_nodes.render(ts,c);
4066 TRACE((
"{TemplateNodeMarkers(%s)\n",data.
data()));
4067 int i = data.
find(
" in ");
4068 int w = data.
find(
" with ");
4069 if (i==-1 || w==-1 || w<i)
4071 parser->
warn(
m_templateName,line,
"markers tag as wrong format. Expected: markers <var> in <list> with <string_with_markers>");
4076 m_var = data.
left(i);
4077 m_listExpr = expParser.
parse(data.
mid(i+4,w-i-4));
4081 stopAt.
append(
"endmarkers");
4082 parser->
parse(
this,line,stopAt,m_nodes);
4084 TRACE((
"}TemplateNodeMarkers(%s)\n",data.
data()));
4089 delete m_patternExpr;
4096 if (!m_var.isEmpty() && m_listExpr && m_patternExpr)
4109 int index=0,newIndex,matchLen;
4110 while ((newIndex=marker.
match(str,index,&matchLen))!=-1)
4112 ts << str.
mid(index,newIndex-index);
4114 uint entryIndex = str.
mid(newIndex+1,matchLen-1).
toUInt(&ok);
4118 for (it->
toFirst(); (it->
current(var)) && i<entryIndex; it->toNext(),i++) {}
4119 if (ok && i==entryIndex)
4122 s->
set(
"id",(
int)i);
4123 c->
set(
"markers",s.
get());
4127 m_nodes.render(ts,c);
4134 else if (i<entryIndex)
4138 index=newIndex+matchLen;
4171 TRACE((
"{TemplateNodeTabbing()\n"));
4173 stopAt.
append(
"endtabbing");
4174 parser->
parse(
this,line,stopAt,m_nodes);
4176 TRACE((
"}TemplateNodeTabbing()\n"));
4185 m_nodes.render(ts,c);
4201 TRACE((
"{TemplateNodeResource(%s)\n",data.
data()));
4210 else if ((i=data.
find(
" as "))!=-1)
4213 m_asExpr = ep.
parse(data.
mid(i+4));
4217 m_resExpr = ep.
parse(data);
4220 TRACE((
"}TemplateNodeResource(%s)\n",data.
data()));
4234 QCString resourceFile = m_resExpr->resolve(c).toString();
4244 QCString targetFile = m_asExpr->resolve(c).toString();
4245 mkpath(ci,targetFile);
4291 if (m_registry.find(name)==0)
return 0;
4292 return ((CreateFunc)m_registry[
name])(parser,parent,line,data);
4297 m_registry.insert(name,(
void*)func);
4346 if (list==0 || list->
count()==0)
4359 if (list==0 || list->
count()==0)
4382 QDictIterator< QList<TemplateNodeBlock> > di(ctx->
m_blocks);
4384 for (di.toFirst();(list=di.current());++di)
4421 { m_openChar=openChar; m_closeChar=closeChar; }
4424 const char *data,
int line,
int startPos,
int endPos,
4435 m_engine(engine), m_fileName(fileName), m_data(data)
4458 int state=StateText;
4462 bool emptyOutputLine=
TRUE;
4465 int markStartPos=-1;
4466 for (;(c=*
p);p++,pos++)
4473 state=StateBeginTemplate;
4475 else if (c!=
' ' && c!=
'\t' && c!=
'\n')
4477 emptyOutputLine=
FALSE;
4480 case StateBeginTemplate:
4494 state=StateMaybeVar;
4498 state=StateVariable;
4504 emptyOutputLine=
FALSE;
4525 emptyOutputLine ? startLinePos : markStartPos,
4529 lastTokenPos = pos+1;
4549 state=StateEndComment;
4552 case StateEndComment:
4558 emptyOutputLine ? startLinePos : markStartPos,
4560 lastTokenPos = pos+1;
4584 state=StateVariable;
4589 emptyOutputLine=
FALSE;
4597 state=StateEndVariable;
4600 case StateEndVariable:
4606 emptyOutputLine ? startLinePos : markStartPos,
4610 lastTokenPos = pos+1;
4619 state=StateVariable;
4629 if (markStartPos!=-1 && emptyOutputLine) lastTokenPos = startLinePos;
4633 emptyOutputLine=
TRUE;
4636 if (lastTokenPos<pos)
4646 int startPos,
int endPos,
4649 if (startPos<endPos)
4651 int len = endPos-startPos+1;
4664 m_engine(engine), m_templateName(templateName), m_tokens(tokens)
4672 TRACE((
"{TemplateParser::parse\n"));
4690 int sep = command.
find(
' ');
4693 command=command.
left(sep);
4698 TRACE((
"}TemplateParser::parse: stop\n"));
4707 create(command,
this,parent,tok->
line,arg);
4712 else if (command==
"empty" || command==
"else" ||
4713 command==
"endif" || command==
"endfor" ||
4714 command==
"endblock" || command==
"endwith" ||
4715 command==
"endrecursetree" || command==
"endspaceless" ||
4716 command==
"endmarkers" || command==
"endmsg" ||
4717 command==
"endrepeat" || command==
"elif" ||
4718 command==
"endrange" || command==
"endtabbing")
4738 if (!options.
isEmpty()) options+=
", ";
4744 TRACE((
"}TemplateParser::parse: last token\n"));
4776 va_warn(fileName,line,fmt,args);
4793 if (extension==
"tex")
4844 : m_type(type), m_fileName(fileName), m_blockName(blockName), m_line(line) {}
4848 int line()
const {
return m_line; }
4859 m_templateCache.setAutoDelete(
TRUE);
4860 m_includeStack.setAutoDelete(
TRUE);
4868 Template *templ = m_templateCache.find(fileName);
4875 m_templateCache.insert(fileName,templ);
4879 err(
"Cound not open template file %s\n",fileName.
data());
4890 m_includeStack.removeLast();
4898 m_includeStack.append(
new IncludeEntry(IncludeEntry::Block,fileName,blockName,line));
4906 m_includeStack.removeLast();
4927 warn(fileName,line,
" included by block '%s' inside template '%s' at line %d",ie->
blockName().
data(),
4935 m_extension = extension;
4973 return p->loadByName(fileName,line);
4983 p->enterBlock(fileName,blockName,line);
4993 p->printIncludeContext(fileName,line);
4998 p->setOutputExtension(extension);
5003 return p->outputExtension();
TemplateNodeBlock(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
Traverses directory structures and contents in a platform-independent way.
void render(FTextStream &ts, TemplateContext *c)
ExprAstLiteral(const char *lit)
void render(FTextStream &, TemplateContext *c)
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
virtual ~TemplateStruct()
void setAutoDelete(bool del)
QList< IncludeEntry > m_includeStack
static TemplateNodeFactory::AutoRegister< TemplateNodeFor > autoRefFor("for")
static TemplateNodeFactory::AutoRegister< TemplateNodeRange > autoRefRange("range")
void render(FTextStream &ts, TemplateContext *c)
void enableSpaceless(bool b)
void setOpenCloseCharacters(char openChar, char closeChar)
Class representing an 'tabbing' tag in a template.
Abstract interface for a template context.
static TemplateFilterFactory::AutoRegister< FilterNoWrap > fNoWrap("nowrap")
Class representing an 'create' tag in a template.
QCString outputDirectory() const
QCString getAsString(const char *name) const
Class representing a token within an expression.
void printIncludeContext(const char *fileName, int line) const
QCString stripWhiteSpace() const
static constexpr double nb
static TemplateList * alloc()
static TemplateFilterFactory::AutoRegister< FilterTexLabel > fTexLabel("texLabel")
char * qstrncpy(char *dst, const char *src, uint len)
The implementation of the "divisibleby" filter.
Class representing a 'for' tag in a template.
Abstract interface for a template.
QDict< TemplateVariant > fields
The implementation of the "flatten" filter.
virtual TemplateVariant resolve(TemplateContext *c)
static TemplateNode * createInstance(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
static QValueList< QCString > split(const QCString &str, const QCString &sep, bool allowEmptyEntries=FALSE, bool cleanup=TRUE)
virtual int count() const
static const char * toString(Type op)
Iterator append(const T &x)
bool spacelessEnabled() const
virtual void set(const char *name, const TemplateVariant &v)
The implementation of the "append" filter.
QValueList< QCString > m_vars
TemplateNodeIndexEntry(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
The implementation of the "length" filter.
The QRegExp class provides pattern matching using regular expressions or wildcards.
const QCString & literal() const
virtual ~TemplateContextImpl()
Class representing operators that can appear in template expressions.
void msg(const char *fmt,...)
virtual TemplateVariant resolve(TemplateContext *c)
Internal class representing the implementation of a template.
TemplateNodeList m_loopNodes
Internal class representing the implementation of a template context.
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &arg)
void setEscapeIntf(const QCString &ext, TemplateEscapeIntf *intf)
static TemplateFilterFactory::AutoRegister< FilterStripPath > fStripPath("stripPath")
void enterBlock(const QCString &fileName, const QCString &blockName, int line)
virtual bool current(TemplateVariant &v) const =0
void append(const type *d)
void render(FTextStream &ts, TemplateContext *c)
virtual void setPath(const QString &path)
TemplateBlockContext * blockContext()
The implementation of the "relative" filter.
TemplateNodeCreate(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
TemplateNode(TemplateNode *parent)
TemplateLexer(const TemplateEngine *engine, const QCString &fileName, const QCString &data)
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &)
Operator::Type m_operator
TemplateEngine * m_engine
static TemplateNodeFactory::AutoRegister< TemplateNodeCloseSubIndex > autoRefCloseSubIndex("closesubindex")
void render(FTextStream &ts, TemplateContext *c)
void enterBlock(const QCString &fileName, const QCString &blockName, int line)
Class representing an 'indexentry' tag in a template.
virtual TemplateVariant resolve(TemplateContext *c)
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &)
virtual TemplateVariant get(const char *name) const =0
TemplateToken * takeNextToken()
static TemplateNodeFactory::AutoRegister< TemplateNodeSet > autoRefSet("set")
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &)
QDict< QList< TemplateNodeBlock > > m_blocks
virtual QCString escape(const QCString &input)=0
ExpressionParser(const TemplateParser *parser, int line)
The implementation of the "default" filter.
void render(FTextStream &, TemplateContext *c)
int compareValues(const ListElem *item1, const ListElem *item2) const
ExprAst * parseCompareExpression()
TemplateListIntf * toList() const
Coord add(Coord c1, Coord c2)
ExprAstFilter(const char *name, ExprAst *arg)
Class representing a 'for' tag in a template.
TemplateNodeRepeat(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
ExprAst * parseFilteredVariable()
TemplateListIntf * m_list
ListElem(const QCString &k, const TemplateVariant &v)
void tokenize(QList< TemplateToken > &tokens)
The implementation of the "default" filter.
bool copyResource(const char *name, const char *targetDir) const
static TemplateNodeFactory::AutoRegister< TemplateNodeSpaceless > autoRefSpaceless("spaceless")
ExprAstUnary(Operator::Type op, ExprAst *exp)
static ResourceMgr & instance()
Class representing a string literal in the AST.
TemplateNodeMsg(TemplateParser *parser, TemplateNode *parent, int line, const QCString &)
static TemplateFilterFactory::AutoRegister< FilterListSort > fListSort("listsort")
Class representing an 'set' tag in a template.
QCString latexEscapeIndexChars(const char *s, bool insideTabbing)
static TemplateNodeFactory::AutoRegister< TemplateNodeCycle > autoRefCycle("cycle")
const std::string instance
TemplateNodeList m_emptyNodes
Default implementation of a context value of type list.
void render(FTextStream &, TemplateContext *c)
ExprAstFilterAppl(ExprAst *expr, ExprAstFilter *filter)
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &)
QCString blockName() const
QCString typeAsString() const
static TemplateNodeFactory::AutoRegister< TemplateNodeIndexEntry > autoRefIndexEntry("indexentry")
TemplateVariant call(const QValueList< TemplateVariant > &args)
static TemplateNodeFactory::AutoRegister< TemplateNodeExtend > autoRefExtend("extend")
static TemplateFilterFactory::AutoRegister< FilterTexIndex > fTexIndex("texIndex")
TemplateNodeBlock * get(const QCString &name) const
const TemplateToken * currentToken() const
QCString left(uint len) const
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
virtual const TemplateVariant * getRef(const QCString &name) const =0
QDict< TemplateEscapeIntf * > m_escapeIntfDict
static TemplateNodeFactory::AutoRegister< TemplateNodeMsg > autoRefMsg("msg")
void setOutputDirectory(const QCString &dir)
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &)
void render(FTextStream &ts, TemplateContext *c)
Class representing an 'tree' tag in a template.
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &)
QTextStream & hex(QTextStream &s)
Simplified and optimized version of QTextStream.
Abstract interface for a context value of type struct.
ExprAst * parseNotExpression()
int find(char c, int index=0, bool cs=TRUE) const
void render(FTextStream &, TemplateContext *c)
static TemplateFilterFactory::AutoRegister< FilterPrepend > fPrepend("prepend")
static TemplateVariant getPathFunc(const void *ctx, const QValueList< TemplateVariant > &)
void closeSubIndex(const QCString &indexName)
static Delegate fromFunction(const void *obj, StubType func)
Helper class for creating template AST tag nodes and returning the template for a given node...
TemplateNodeTree(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
static TemplateFilterFactory::AutoRegister< FilterGet > fGet("get")
Private data of the template engine.
TemplateParser(const TemplateEngine *engine, const QCString &templateName, QList< TemplateToken > &tokens)
Class representing a 'block' tag in a template.
The implementation of the "paginate" filter.
TemplateVariant & operator=(const TemplateVariant &v)
Class representing an 'with' tag in a template.
void render(FTextStream &ts, TemplateContext *c)
Class representing a lexical token in a template.
static TemplateFilterFactory::AutoRegister< FilterAdd > fAdd("add")
static void getPathListFunc(TemplateStructIntf *entry, TemplateList *list)
void warn(const char *fileName, int line, const char *fmt,...) const
The QChar class provides a light-weight Unicode character.
virtual void append(const TemplateVariant &v)
ExprAstFilter * parseFilter()
static TemplateFilterFactory::AutoRegister< FilterPaginate > fPaginate("paginate")
static TemplateFilterFactory::AutoRegister< FilterDivisibleBy > fDivisibleBy("divisibleby")
TemplateNodeOpenSubIndex(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
Class representing an 'include' tag in a template.
int findRev(char c, int index=-1, bool cs=TRUE) const
TemplateNodeCloseSubIndex(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
Class representing a 'extend' tag in a template.
void render(FTextStream &ts, TemplateContext *c)
void registerTemplateNode(const QCString &name, CreateFunc func)
Class representing a variable in a template.
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &arg)
TemplateNodeInclude(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
static TemplateFilterFactory * instance()
void printIncludeContext(const char *fileName, int line) const
ExprAst * parse(const char *expr)
TemplateNodeIf(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
TemplateContextImpl(const TemplateEngine *e)
Private data of a template list object.
static uint determineSortKey(TemplateStructIntf *s, const QCString &attribName)
TemplateAutoRef< TemplateStruct > m_indices
static TemplateNodeFactory * instance()
The implementation of the "prepend" filter.
static QCString removeSpacesAroundEquals(const char *s)
The implementation of the "get" filter.
TemplateImpl(TemplateEngine *e, const QCString &name, const QCString &data, const QCString &extension)
Factory class for creating tag AST nodes found in a template.
TemplateContext * createContext() const
uint contains(const type *d) const
static TemplateNodeFactory::AutoRegister< TemplateNodeRepeat > autoRefRepeat("repeat")
TemplateSpacelessIntf * spacelessIntf() const
Class representing a list of AST nodes in a template.
static TemplateNodeFactory::AutoRegister< TemplateNodeCreate > autoRefCreate("create")
virtual TemplateVariant resolve(TemplateContext *)
void setOutputExtension(const char *extension)
TemplateBlockContext m_blockContext
static TemplateNodeFactory::AutoRegister< TemplateNodeMarkers > autoRefMarkers("markers")
TemplateNodeWith(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
ListElem(const QCString &k, const TemplateVariant &v)
TemplateNodeVariable(TemplateParser *parser, TemplateNode *parent, int line, const QCString &var)
void setActiveEscapeIntf(TemplateEscapeIntf *intf)
uint getUtf8CodeToUpper(const QCString &s, int idx)
Returns one unicode character as ian unsigned interger from utf-8 string, making the character upper ...
static TemplateFilterFactory::AutoRegister< FilterAlphaIndex > fAlphaIndex("alphaIndex")
ExprAst * parseOrExpression()
TemplateEscapeIntf * escapeIntf() const
virtual bool mkdir(const QString &dirName, bool acceptAbsPath=TRUE) const
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &args)
QTextStream & reset(QTextStream &s)
ExprAstNegate(ExprAst *expr)
virtual void set(const char *name, const TemplateVariant &v)=0
QCString toString() const
static TemplateFilterFactory::AutoRegister< FilterGroupBy > fGroupBy("groupBy")
Class representing a number in the AST.
QValueList< TemplateVariant > elems
TemplateNodeList m_treeNodes
ExprAst * parseIdentifier()
Mapping(const QCString &n, ExprAst *e)
TemplateStructIntf * m_strukt
void set(const char *name, const TemplateVariant &v)
ExprAst * parseExpression()
virtual TemplateVariant at(int index) const
Class representing a filter applied to an expression in the AST.
const TemplateParser * m_parser
TemplateNodeBlock * pop(const QCString &name) const
Class representing a binary operator in the AST.
TemplateNodeText(TemplateParser *, TemplateNode *parent, int, const QCString &data)
The implementation of the "raw" filter.
Class representing an 'markers' tag in a template.
void render(FTextStream &ts, TemplateContext *c)
Base class for all nodes in the abstract syntax tree of an expression.
virtual TemplateVariant resolve(TemplateContext *)
QCString right(uint len) const
const TemplateVariant * getRef(const QCString &name) const
TemplateNodeSet(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
The implementation of the "texlabel" filter.
The implementation of the "add" filter.
int compareValues(const ListElem *item1, const ListElem *item2) const
static QCString keyToLabel(uint startLetter)
int toInt(bool *ok=0) const
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &)
Mapping(const QCString &n, ExprAst *e)
static QCString keyToLetter(uint startLetter)
virtual TemplateVariant resolve(TemplateContext *c)
static QString currentDirPath()
Class representing an 'markers' tag in a template.
TemplateNodeList m_repeatNodes
virtual ~ExpressionParser()
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &n)
TemplateNodeList m_falseNodes
static void flatten(TemplateListIntf *tree, TemplateList *list)
QCString templateName() const
The implementation of the "list" filter.
QValueList< TemplateVariant >::ConstIterator m_it
QDict< Template > m_templateCache
static TemplateVariant renderChildrenStub(const void *ctx, const QValueList< TemplateVariant > &)
TemplateEngine * m_engine
Operator::Type m_operator
const TemplateEngine * m_engine
Class representing an 'cycle' tag in a template.
ListElem(uint k, const TemplateVariant &v)
void registerFilter(const QCString &name, FilterFunction *func)
virtual int count() const =0
QCString fileName() const
QCString & prepend(const char *s)
ExprAstFunctionVariable(ExprAst *var, const QList< ExprAst > &args)
static TemplateFilterFactory::AutoRegister< FilterRaw > fRaw("raw")
Abstract interface for a iterator of a list.
QList< GuardedNodes > m_ifGuardedNodes
void render(FTextStream &ts, TemplateContext *c)
QCString latexEscapeLabelName(const char *s, bool insideTabbing)
void append(const type *d)
Class representing a negation (not) operator in the AST.
TemplateNode * create(const QCString &name, TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
A bunch of utility functions.
static TemplateNodeFactory::AutoRegister< TemplateNodeOpenSubIndex > autoRefOpenSubIndex("opensubindex")
Interface used to escape characters in a string.
const char * data() const
virtual bool current(TemplateVariant &v) const
TemplateBlockContext m_blockContext
virtual TemplateListIntf::ConstIterator * createIterator() const
TemplateBlockContext * blockContext()
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &args)
QCString renderChildren(const TreeContext *ctx)
static TemplateFilterFactory::AutoRegister< FilterRelative > fRelative("relative")
int compareValues(const ListElem *item1, const ListElem *item2) const
TemplateNodeSpaceless(TemplateParser *parser, TemplateNode *parent, int line, const QCString &)
static TemplateNodeFactory::AutoRegister< TemplateNodeBlock > autoRefBlock("block")
virtual TemplateListIntf::ConstIterator * createIterator() const =0
int getPrefixIndex(const QCString &name)
Class holding stacks of blocks available in the context.
TemplateNodeMarkers(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
void render(FTextStream &, TemplateContext *c)
TemplateEngine * engine() const
void warn(const char *file, int line, const char *fmt,...)
Class representing an 'spaceless' tag in a template.
virtual TemplateVariant resolve(TemplateContext *c)
void render(FTextStream &, TemplateContext *c)
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &)
void err(const char *fmt,...)
TemplateVariant apply(const TemplateVariant &v, TemplateContext *c)
void add(TemplateNodeBlock *block)
const TemplateEngine * m_engine
virtual QCString remove(const QCString &input)=0
static TemplateFilterFactory::AutoRegister< FilterAppend > fAppend("append")
const TemplateListIntf * list
static TemplateNodeFactory::AutoRegister< TemplateNodeIf > autoRefIf("if")
Class representing an 'closesubindex' tag in a template.
Variant type which can hold one value of a fixed set of types.
static TemplateNodeFactory::AutoRegister< TemplateNodeInclude > autoRefInclude("include")
QCString outputExtension() const
QCString mid(uint index, uint len=0xffffffff) const
void destroyContext(TemplateContext *ctx)
ExprAstBinary(Operator::Type op, ExprAst *lhs, ExprAst *rhs)
static int variantIntValue(const TemplateVariant &v, bool &isInt)
TemplateImpl * getTemplate()
TemplateVariant apply(const QCString &name, const TemplateVariant &v, const TemplateVariant &arg, bool &ok)
TemplateVariant get(const QCString &name) const
int match(const QCString &str, int index=0, int *len=0, bool indexIsStart=TRUE) const
Private data of a template struct object.
The QFile class is an I/O device that operates on files.
Template * loadByName(const QCString &fileName, int fromLine)
static void stripLeadingWhiteSpace(QGString &s)
void mkpath(TemplateContextImpl *ci, const QCString &fileName)
virtual ~TemplateListConstIterator()
Engine to create templates and template contexts.
ExprAst * parseAndExpression()
ExprAst * parseAdditiveExpression()
const QCString & name() const
void render(FTextStream &ts, TemplateContext *c)
void openSubIndex(const QCString &indexName)
virtual void render(FTextStream &ts, TemplateContext *c)=0
Class representing a filter in the AST.
TemplateNodeFor(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
TemplateListConstIterator(const TemplateList &l)
Class representing a 'range' tag in a template.
QList< TemplateToken > & m_tokens
A container to store a key-value pair.
TemplateStructIntf * m_ref
std::vector< size_t > Mapping(std::vector< geo::AuxDetGeo * > &adgeo)
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &arg)
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &arg)
virtual TemplateVariant get(const QCString &name) const =0
ExprAst * parseMultiplicativeExpression()
void warn(const char *fileName, int line, const char *fmt,...) const
ExprAst * parseUnaryExpression()
The implementation of the "listsort" filter.
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &arg)
TemplateContext * templateCtx
void push(TemplateNodeBlock *block)
uint toUInt(bool *ok=0) const
static TemplateFilterFactory::AutoRegister< FilterFlatten > fFlatten("flatten")
static TemplateNodeFactory::AutoRegister< TemplateNodeWith > autoRefWith("with")
void render(FTextStream &ts, TemplateContext *c)
void line(double t, double *p, double &x, double &y, double &z)
Mapping(const QCString &n, ExprAst *e)
TreeContext(TemplateNodeTree *o, const TemplateListIntf *l, TemplateContext *c)
ExprAstVariable(const char *name)
void setSpacelessIntf(TemplateSpacelessIntf *intf)
Class representing a piece of plain text in a template.
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &args)
void addIndexEntry(const QCString &indexName, const QValueList< TemplateKeyValue > &arguments)
void prependToken(const TemplateToken *token)
Class representing an 'if' tag in a template.
virtual TemplateVariant at(int index) const =0
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &args)
bool copyResourceAs(const char *name, const char *targetDir, const char *targetName) const
TemplateVariant getPrimary(const QCString &name) const
static TemplateFilterFactory::AutoRegister< FilterDefault > fDefault("default")
static TemplateNodeFactory::AutoRegister< TemplateNodeTree > autoRefTree("recursetree")
Class representing a variable in the AST.
void render(FTextStream &ts, TemplateContext *c)
static TemplateNodeFactory::AutoRegister< TemplateNodeTabbing > autoRefTabbing("tabbing")
void render(FTextStream &ts, TemplateContext *c)
static TemplateVariant apply(const TemplateVariant &v, const TemplateVariant &)
TemplateNodeTabbing(TemplateParser *parser, TemplateNode *parent, int line, const QCString &)
vector< vector< double > > clear
TemplateNodeList m_loopNodes
const char * m_tokenStream
Lexer class for turning a template into a list of tokens.
static unsigned filter(unsigned char *out, const unsigned char *in, unsigned w, unsigned h, const LodePNG_InfoColor *info)
TemplateStructIntf * toStruct() const
TemplateNodeCreator(TemplateParser *parser, TemplateNode *parent, int line)
const TemplateList & m_list
ExprAst * parsePrimaryExpression()
void prepend(const type *d)
void addToken(QList< TemplateToken > &tokens, const char *data, int line, int startPos, int endPos, TemplateToken::Type type)
Base class of all nodes in a template's AST.
Class representing an 'markers' tag in a template.
TemplateToken(Type t, const char *d, int l)
void render(FTextStream &ts, TemplateContext *c)
void setLocation(const QCString &templateName, int line)
virtual TemplateVariant get(const char *name) const
void enableTabbing(bool b)
virtual TemplateVariant resolve(TemplateContext *)
void render(FTextStream &ts, TemplateContext *c)
bool tabbingEnabled() const
TemplateNodeCycle(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
Abstract read-only interface for a context value of type list.
Q_EXPORT int qstrcmp(const char *str1, const char *str2)
const TemplateEngine * m_engine
Helper class for registering a filter function.
The implementation of the "texindex" filter.
QCString outputExtension() const
void render(FTextStream &ts, TemplateContext *c)
QList< QDict< TemplateVariant > > m_contextStack
Private(TemplateEngine *engine)
Template * loadByName(const QCString &fileName, int line)
The implementation of the "groupBy" filter.
TemplateSpacelessIntf * m_spacelessIntf
Default implementation of a context value of type struct.
void render(FTextStream &, TemplateContext *c)
Recursive decent parser for Django style template expressions.
TemplateKeyValue(const QCString &k, const TemplateVariant &v)
TemplateNodeRange(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
void parse(TemplateNode *parent, int line, const QStrList &stopAt, QList< TemplateNode > &nodes)
void va_warn(const char *file, int line, const char *fmt, va_list args)
TemplateNodeList trueNodes
void setAutoDelete(bool enable)
Class representing an 'opensubindex' tag in a template.
void selectEscapeIntf(const QCString &ext)
QCString templateName() const
The implementation of the "default" filter.
const QCString & name() const
static QCString determineSortKey(TemplateStructIntf *s, const QCString &attribName)
void render(FTextStream &ts, TemplateContext *c)
Weak reference wrapper for TemplateStructIntf that provides access to the wrapped struct without hold...
TemplateNodeResource(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
The implementation of the "alphaIndex" filter.
Interface used to remove redundant spaces inside a spaceless block.
virtual bool exists() const
def parent(G, child, parent_type)
static TemplateNodeFactory::AutoRegister< TemplateNodeResource > autoRefResource("resource")
QDict< QStack< TemplateVariant > > m_indexStacks
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Factory singleton for registering and creating filters.
QTextStream & endl(QTextStream &s)
TemplateEscapeIntf * m_activeEscapeIntf
virtual TemplateVariant resolve(TemplateContext *c)
void setOutputExtension(const char *extension)
static TemplateStruct * alloc()
TemplateStructWeakRef(TemplateStructIntf *ref)
ExprAst * parseIdentifierOptionalArgs()
TemplateNodeTree * object
~ExprAstFunctionVariable()
static TemplateFilterFactory::AutoRegister< FilterList > fList("list")
TemplateNodeExtend(TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
bool hasNextToken() const
Helper class for registering a template AST node.
static TemplateFilterFactory::AutoRegister< FilterLength > fLength("length")
static QCString determineSortKey(TemplateStructIntf *s, const QCString &arg)
IncludeEntry(Type type, const QCString &fileName, const QCString &blockName, int line)