Static Public Member Functions | Static Private Member Functions | List of all members
FilterFlatten Class Reference

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

Static Public Member Functions

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

Static Private Member Functions

static void flatten (TemplateListIntf *tree, TemplateList *list)
 

Detailed Description

The implementation of the "flatten" filter.

Definition at line 815 of file template.cpp.

Member Function Documentation

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

Definition at line 818 of file template.cpp.

819  {
820  if (!v.isValid() || v.type()!=TemplateVariant::List)
821  {
822  return v;
823  }
824  else
825  {
827  flatten(v.toList(),list);
828  return TemplateVariant(list);
829  }
830  }
static TemplateList * alloc()
Definition: template.cpp:420
TemplateListIntf * toList() const
Definition: template.h:256
Default implementation of a context value of type list.
Definition: template.h:376
static void flatten(TemplateListIntf *tree, TemplateList *list)
Definition: template.cpp:833
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
static void FilterFlatten::flatten ( TemplateListIntf tree,
TemplateList list 
)
inlinestaticprivate

Definition at line 833 of file template.cpp.

834  {
836  TemplateVariant item;
837  for (it->toFirst();(it->current(item));it->toNext())
838  {
839  TemplateStructIntf *s = item.toStruct();
840  if (s)
841  {
842  list->append(item);
843  // if s has "children" then recurse into the children
844  TemplateVariant children = s->get("children");
845  if (children.isValid() && children.type()==TemplateVariant::List)
846  {
847  flatten(children.toList(),list);
848  }
849  }
850  else
851  {
852  list->append(item);
853  }
854  }
855  delete it;
856  }
virtual bool current(TemplateVariant &v) const =0
virtual TemplateVariant get(const char *name) const =0
TemplateListIntf * toList() const
Definition: template.h:256
Abstract interface for a context value of type struct.
Definition: template.h:406
virtual void append(const TemplateVariant &v)
Definition: template.cpp:343
static void flatten(TemplateListIntf *tree, TemplateList *list)
Definition: template.cpp:833
Abstract interface for a iterator of a list.
Definition: template.h:333
bool isValid() const
Definition: template.h:161
virtual TemplateListIntf::ConstIterator * createIterator() const =0
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
TemplateStructIntf * toStruct() const
Definition: template.h:264
Type type() const
Definition: template.h:142
static QCString * s
Definition: config.cpp:1042

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