当前位置: 首页>>代码示例>>C++>>正文


C++ Ptr::generateEvents方法代码示例

本文整理汇总了C++中item::Ptr::generateEvents方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::generateEvents方法的具体用法?C++ Ptr::generateEvents怎么用?C++ Ptr::generateEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在item::Ptr的用法示例。


在下文中一共展示了Ptr::generateEvents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: generateEventsImpl

EventGenerator::Ptr XQCopy::generateEventsImpl(const Item::Ptr &toBeCopied, EventHandler *events, DynamicContext *context,
                                               bool preserveNS, bool preserveType) const
{
  if(!toBeCopied->isNode()) {
    toBeCopied->generateEvents(events, context, preserveNS, preserveType);
    return 0;
  }

  Node *node = (Node*)toBeCopied.get();

  if(node->dmNodeKind() == Node::element_string) {
    NoInheritFilter niFilter(events, context->getMemoryManager());
    if(!inheritNamespaces_) events = &niFilter;

    AnyAtomicType::Ptr itemName = node->dmNodeName(context);
    const ATQNameOrDerived *pQName = (const ATQNameOrDerived*)itemName.get();
    const XMLCh *prefix = emptyToNull(pQName->getPrefix());
    const XMLCh *uri = emptyToNull(pQName->getURI());
    const XMLCh *localname = pQName->getName();

    events->startElementEvent(prefix, uri, localname);

    ElemConstructFilter elemFilter(events, this, context->getMemoryManager());

    if(copyNamespaces_) {
      Result nsnodes = node->dmNamespaceNodes(context, this);
      Item::Ptr ns;
      while((ns = nsnodes->next(context)).notNull()) {
        ns->generateEvents(&elemFilter, context, preserveNS, preserveType);
      }
    }

    for(VectorOfASTNodes::const_iterator itCont = children_.begin(); itCont != children_.end (); ++itCont) {
      (*itCont)->generateAndTailCall(&elemFilter, context, preserveNS, preserveType);
    }

    // TBD validation and type - jpcs
    const XMLCh *typeURI = SchemaSymbols::fgURI_SCHEMAFORSCHEMA;
    const XMLCh *typeName = DocumentCache::g_szUntyped;

    events->endElementEvent(prefix, uri, localname, typeURI, typeName);
  }
  else if(node->dmNodeKind() == Node::document_string) {
    events->startDocumentEvent(0, 0);

    DocConstructFilter filter(events, this);

    for(VectorOfASTNodes::const_iterator itCont = children_.begin(); itCont != children_.end (); ++itCont) {
      (*itCont)->generateAndTailCall(&filter, context, preserveNS, preserveType);
    }

    events->endDocumentEvent();
  }
  else {
    node->generateEvents(events, context, preserveNS, preserveType);
  }

  return 0;
}
开发者ID:kanbang,项目名称:Colt,代码行数:59,代码来源:XQCopy.cpp


注:本文中的item::Ptr::generateEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。