Static Public Member Functions | List of all members
FilterLength Class Reference

The implementation of the "length" filter. More...

Static Public Member Functions

static TemplateVariant apply (const TemplateVariant &v, const TemplateVariant &)
 

Detailed Description

The implementation of the "length" filter.

Definition at line 765 of file template.cpp.

Member Function Documentation

static TemplateVariant FilterLength::apply ( const TemplateVariant v,
const TemplateVariant  
)
inlinestatic

Definition at line 768 of file template.cpp.

769  {
770  if (!v.isValid())
771  {
772  return TemplateVariant();
773  }
774  if (v.type()==TemplateVariant::List)
775  {
776  return TemplateVariant(v.toList()->count());
777  }
778  else if (v.type()==TemplateVariant::String)
779  {
780  return TemplateVariant((int)v.toString().length());
781  }
782  else
783  {
784  return TemplateVariant();
785  }
786  }
uint length() const
Definition: qcstring.h:195
TemplateListIntf * toList() const
Definition: template.h:256
QCString toString() const
Definition: template.h:232
virtual int count() const =0
bool isValid() const
Definition: template.h:161
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
Type type() const
Definition: template.h:142

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