Public Member Functions | Private Attributes | List of all members
TemplateNodeCycle Class Reference

Class representing an 'cycle' tag in a template. More...

Inheritance diagram for TemplateNodeCycle:
TemplateNodeCreator< TemplateNodeCycle > TemplateNode

Public Member Functions

 TemplateNodeCycle (TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
 
void render (FTextStream &ts, TemplateContext *c)
 
- Public Member Functions inherited from TemplateNodeCreator< TemplateNodeCycle >
 TemplateNodeCreator (TemplateParser *parser, TemplateNode *parent, int line)
 
TemplateImplgetTemplate ()
 
- Public Member Functions inherited from TemplateNode
 TemplateNode (TemplateNode *parent)
 
virtual ~TemplateNode ()
 
TemplateNodeparent ()
 

Private Attributes

uint m_index
 
QList< ExprAstm_args
 

Additional Inherited Members

- Static Public Member Functions inherited from TemplateNodeCreator< TemplateNodeCycle >
static TemplateNodecreateInstance (TemplateParser *parser, TemplateNode *parent, int line, const QCString &data)
 
- Protected Member Functions inherited from TemplateNodeCreator< TemplateNodeCycle >
void mkpath (TemplateContextImpl *ci, const QCString &fileName)
 
- Protected Attributes inherited from TemplateNodeCreator< TemplateNodeCycle >
QCString m_templateName
 
int m_line
 

Detailed Description

Class representing an 'cycle' tag in a template.

Definition at line 3924 of file template.cpp.

Constructor & Destructor Documentation

TemplateNodeCycle::TemplateNodeCycle ( TemplateParser parser,
TemplateNode parent,
int  line,
const QCString data 
)
inline

Definition at line 3927 of file template.cpp.

3929  {
3930  TRACE(("{TemplateNodeCycle(%s)\n",data.data()));
3932  m_index=0;
3933  ExpressionParser expParser(parser,line);
3934  QValueList<QCString> args = split(data," ");
3935  QValueListIterator<QCString> it = args.begin();
3936  while (it!=args.end())
3937  {
3938  ExprAst *expr = expParser.parse(*it);
3939  if (expr)
3940  {
3941  m_args.append(expr);
3942  }
3943  ++it;
3944  }
3945  if (m_args.count()<2)
3946  {
3947  parser->warn(parser->templateName(),line,"expected at least two arguments for cycle command, got %d",m_args.count());
3948  }
3949  TRACE(("}TemplateNodeCycle(%s)\n",data.data()));
3950  }
static QValueList< QCString > split(const QCString &str, const QCString &sep, bool allowEmptyEntries=FALSE, bool cleanup=TRUE)
Definition: template.cpp:50
void append(const type *d)
Definition: qlist.h:73
Iterator end()
Definition: qvaluelist.h:363
static QCString args
Definition: declinfo.cpp:674
uint count() const
Definition: qlist.h:66
TemplateNode * parent()
Definition: template.cpp:1647
Base class for all nodes in the abstract syntax tree of an expression.
Definition: template.cpp:1364
const char * data() const
Definition: qcstring.h:207
void line(double t, double *p, double &x, double &y, double &z)
Iterator begin()
Definition: qvaluelist.h:361
QList< ExprAst > m_args
Definition: template.cpp:3978
Recursive decent parser for Django style template expressions.
Definition: template.cpp:1680
#define TRACE(x)
Definition: template.cpp:43
void setAutoDelete(bool enable)
Definition: qlist.h:99
const bool TRUE
Definition: qglobal.h:371

Member Function Documentation

void TemplateNodeCycle::render ( FTextStream ts,
TemplateContext c 
)
inlinevirtual

Implements TemplateNode.

Definition at line 3951 of file template.cpp.

3952  {
3953  TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c);
3955  if (m_index<m_args.count())
3956  {
3959  {
3961  }
3962  if (ci->escapeIntf() && !v.raw())
3963  {
3964  ts << ci->escapeIntf()->escape(v.toString());
3965  }
3966  else
3967  {
3968  ts << v.toString();
3969  }
3970  }
3971  if (++m_index==m_args.count()) // wrap around
3972  {
3973  m_index=0;
3974  }
3975  }
Internal class representing the implementation of a template context.
Definition: template.cpp:511
virtual QCString escape(const QCString &input)=0
type * at(uint i) const
Definition: qlist.h:94
TemplateVariant call(const QValueList< TemplateVariant > &args)
Definition: template.h:272
uint count() const
Definition: qlist.h:66
TemplateEscapeIntf * escapeIntf() const
Definition: template.cpp:545
QCString toString() const
Definition: template.h:232
virtual TemplateVariant resolve(TemplateContext *)
Definition: template.cpp:1368
bool raw() const
Definition: template.h:287
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
QList< ExprAst > m_args
Definition: template.cpp:3978
Type type() const
Definition: template.h:142
void setLocation(const QCString &templateName, int line)
Definition: template.cpp:540

Member Data Documentation

QList<ExprAst> TemplateNodeCycle::m_args
private

Definition at line 3978 of file template.cpp.

uint TemplateNodeCycle::m_index
private

Definition at line 3977 of file template.cpp.


The documentation for this class was generated from the following file: