Doxygen
FilterFlatten类 参考

The implementation of the "flatten" filter 更多...

静态 Public 成员函数

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

静态 Private 成员函数

static void flatten (const TemplateListIntfPtr tree, TemplateListPtr list)
 

详细描述

The implementation of the "flatten" filter

在文件 template.cpp1015 行定义.

成员函数说明

◆ apply()

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

在文件 template.cpp1018 行定义.

1019  {
1020  if (!v.isValid() || !v.isList())
1021  {
1022  return v;
1023  }
1024  else
1025  {
1027  TemplateListIntfPtr tree = v.toList();
1028  flatten(tree,list);
1029  return TemplateVariant(std::static_pointer_cast<TemplateListIntf>(list));
1030  }
1031  }

引用了 TemplateList::alloc(), flatten(), TemplateVariant::isList(), TemplateVariant::isValid() , 以及 TemplateVariant::toList().

◆ flatten()

static void FilterFlatten::flatten ( const TemplateListIntfPtr  tree,
TemplateListPtr  list 
)
inlinestaticprivate

在文件 template.cpp1034 行定义.

1035  {
1036  if (tree)
1037  {
1038  TemplateListIntf::ConstIteratorPtr it = tree->createIterator();
1039  TemplateVariant item;
1040  for (it->toFirst();(it->current(item));it->toNext())
1041  {
1042  TemplateStructIntfPtr s = item.toStruct();
1043  if (s)
1044  {
1045  list->append(item);
1046  // if s has "children" then recurse into the children
1047  TemplateVariant children = s->get("children");
1048  if (children.isValid() && children.isList())
1049  {
1050  flatten(children.toList(),list);
1051  }
1052  }
1053  else
1054  {
1055  list->append(item);
1056  }
1057  }
1058  }
1059  }

引用了 TemplateVariant::isList(), TemplateVariant::isValid(), TemplateVariant::toList() , 以及 TemplateVariant::toStruct().

被这些函数引用 apply().


该类的文档由以下文件生成:
TemplateVariant::toStruct
TemplateStructIntfPtr toStruct()
Returns the pointer to struct referenced by this variant or 0 if this variant does not have struct ty...
Definition: template.cpp:441
TemplateVariant::isList
constexpr bool isList() const
Returns TRUE if the variant holds a list value
Definition: template.h:213
TemplateListPtr
std::shared_ptr< TemplateList > TemplateListPtr
Definition: template.cpp:224
TemplateStructIntfPtr
std::shared_ptr< TemplateStructIntf > TemplateStructIntfPtr
Definition: template.h:33
TemplateListIntf::ConstIteratorPtr
std::unique_ptr< ConstIterator > ConstIteratorPtr
Definition: template.h:292
TemplateVariant
Variant type which can hold one value of a fixed set of types.
Definition: template.h:98
TemplateList::alloc
static TemplateListPtr alloc()
Creates an instance and returns a shared pointer to it
Definition: template.cpp:291
TemplateListIntfPtr
std::shared_ptr< TemplateListIntf > TemplateListIntfPtr
Definition: template.h:32
TemplateVariant::isValid
constexpr bool isValid() const
Returns TRUE if the variant holds a valid value, or FALSE otherwise
Definition: template.h:203
FilterFlatten::flatten
static void flatten(const TemplateListIntfPtr tree, TemplateListPtr list)
Definition: template.cpp:1034
TemplateVariant::toList
TemplateListIntfPtr toList()
Returns the pointer to list referenced by this variant or 0 if this variant does not have list type.
Definition: template.cpp:432