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

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

Inheritance diagram for TemplateNodeWith:
TemplateNodeCreator< TemplateNodeWith > TemplateNode

Classes

struct  Mapping
 

Public Member Functions

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

Private Attributes

TemplateNodeList m_nodes
 
QList< Mappingm_args
 

Additional Inherited Members

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

Detailed Description

Class representing an 'with' tag in a template.

Definition at line 3854 of file template.cpp.

Constructor & Destructor Documentation

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

Definition at line 3864 of file template.cpp.

3866  {
3867  TRACE(("{TemplateNodeWith(%s)\n",data.data()));
3868  m_args.setAutoDelete(TRUE);
3869  ExpressionParser expParser(parser,line);
3870  QCString filteredData = removeSpacesAroundEquals(data);
3871  QValueList<QCString> args = split(filteredData," ");
3872  QValueListIterator<QCString> it = args.begin();
3873  while (it!=args.end())
3874  {
3875  QCString arg = *it;
3876  int j=arg.find('=');
3877  if (j>0)
3878  {
3879  ExprAst *expr = expParser.parse(arg.mid(j+1));
3880  if (expr)
3881  {
3882  m_args.append(new Mapping(arg.left(j),expr));
3883  }
3884  }
3885  else
3886  {
3887  parser->warn(parser->templateName(),line,"invalid argument '%s' for 'with' tag",arg.data());
3888  }
3889  ++it;
3890  }
3891  QStrList stopAt;
3892  stopAt.append("endwith");
3893  parser->parse(this,line,stopAt,m_nodes);
3894  parser->removeNextToken(); // skip over endwith
3895  TRACE(("}TemplateNodeWith(%s)\n",data.data()));
3896  }
static QValueList< QCString > split(const QCString &str, const QCString &sep, bool allowEmptyEntries=FALSE, bool cleanup=TRUE)
Definition: template.cpp:50
Iterator end()
Definition: qvaluelist.h:363
QCString left(uint len) const
Definition: qcstring.cpp:213
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
static QCString args
Definition: declinfo.cpp:674
static QCString removeSpacesAroundEquals(const char *s)
Definition: template.cpp:104
TemplateNode * parent()
Definition: template.cpp:1647
QList< Mapping > m_args
Definition: template.cpp:3918
Base class for all nodes in the abstract syntax tree of an expression.
Definition: template.cpp:1364
void append(const type *d)
Definition: qinternallist.h:61
const char * data() const
Definition: qcstring.h:207
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
std::vector< size_t > Mapping(std::vector< geo::AuxDetGeo * > &adgeo)
TemplateNodeList m_nodes
Definition: template.cpp:3917
void line(double t, double *p, double &x, double &y, double &z)
Iterator begin()
Definition: qvaluelist.h:361
Recursive decent parser for Django style template expressions.
Definition: template.cpp:1680
#define TRACE(x)
Definition: template.cpp:43
const bool TRUE
Definition: qglobal.h:371
TemplateNodeWith::~TemplateNodeWith ( )
inline

Definition at line 3897 of file template.cpp.

3898  {
3899  }

Member Function Documentation

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

Implements TemplateNode.

Definition at line 3900 of file template.cpp.

3901  {
3902  TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c);
3903  if (ci==0) return; // should not happen
3905  c->push();
3907  Mapping *mapping;
3908  for (it.toFirst();(mapping=it.current());++it)
3909  {
3910  TemplateVariant value = mapping->value->resolve(c);
3911  ci->set(mapping->name,value);
3912  }
3913  m_nodes.render(ts,c);
3914  c->pop();
3915  }
void render(FTextStream &ts, TemplateContext *c)
Definition: template.cpp:2246
virtual void pop()=0
virtual void push()=0
Internal class representing the implementation of a template context.
Definition: template.cpp:511
void set(const char *name, const TemplateVariant &v)
Definition: template.cpp:2315
QList< Mapping > m_args
Definition: template.cpp:3918
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
std::vector< size_t > Mapping(std::vector< geo::AuxDetGeo * > &adgeo)
TemplateNodeList m_nodes
Definition: template.cpp:3917
void setLocation(const QCString &templateName, int line)
Definition: template.cpp:540

Member Data Documentation

QList<Mapping> TemplateNodeWith::m_args
private

Definition at line 3918 of file template.cpp.

TemplateNodeList TemplateNodeWith::m_nodes
private

Definition at line 3917 of file template.cpp.


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