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

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

Static Public Member Functions

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

Detailed Description

The implementation of the "divisibleby" filter.

Definition at line 1260 of file template.cpp.

Member Function Documentation

static TemplateVariant FilterDivisibleBy::apply ( const TemplateVariant v,
const TemplateVariant n 
)
inlinestatic

Definition at line 1263 of file template.cpp.

1264  {
1265  if (!v.isValid() || !n.isValid())
1266  {
1267  return TemplateVariant();
1268  }
1270  {
1271  int ni = n.toInt();
1272  if (ni>0)
1273  {
1274  return TemplateVariant((v.toInt()%ni)==0);
1275  }
1276  else
1277  {
1278  return TemplateVariant(FALSE);
1279  }
1280  }
1281  else
1282  {
1283  return TemplateVariant();
1284  }
1285  }
const bool FALSE
Definition: qglobal.h:370
int toInt() const
Definition: template.cpp:222
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: