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


C++ QXmlQuery::namePool方法代码示例

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


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

示例1: isPreviousAtomic

QXmlSerializerPrivate::QXmlSerializerPrivate(const QXmlQuery &query,
                                             QIODevice *outputDevice)
    : isPreviousAtomic(false),
      state(QXmlSerializer::BeforeDocumentElement),
      np(query.namePool().d),
      device(outputDevice),
      codec(QTextCodec::codecForMib(106)), /* UTF-8 */
      query(query)
{
    hasClosedElement.reserve(EstimatedTreeDepth);
    namespaces.reserve(EstimatedTreeDepth);
    nameCache.reserve(EstimatedNameCount);

    hasClosedElement.push(qMakePair(QXmlName(), true));

    /*
      We push the empty namespace such that first of all
      namespaceBinding() won't assert on an empty QStack,
      and such that the empty namespace is in-scope and
      that the code doesn't attempt to declare it.

      We push the XML namespace. Although we won't receive
      declarations for it, we may output attributes by that
      name.
    */
    QVector<QXmlName> defNss;
    defNss.resize(2);
    defNss[0] = QXmlName(StandardNamespaces::empty,
                         StandardLocalNames::empty,
                         StandardPrefixes::empty);
    defNss[1] = QXmlName(StandardNamespaces::xml,
                         StandardLocalNames::empty,
                         StandardPrefixes::xml);

    namespaces.push(defNss);

    /* If we don't set this flag, QTextCodec will generate a BOM. */
    converterState.flags = QTextCodec::IgnoreHeader;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:39,代码来源:qxmlserializer.cpp

示例2: model

std::vector<SimXmlElement> SimXmlDoc::findElementsWithChildValue(const std::string& elementName, const std::string& childName, const std::string& childValue) const
{
  std::vector<SimXmlElement> result;

  if (isNull()){
    return result;
  }

  QString queryString = simQuery("/SimModel/" + elementName + "[" + childName + "='" + childValue + "']");

  QXmlQuery query;
  QDomNodeModel model(query.namePool(), *(impl()));
  query.setFocus(QXmlItem(model.fromDomNode(impl()->documentElement())));
  query.setQuery(queryString, QUrl(QString::fromStdString(this->path())));

  if (query.isValid()) {

    QXmlResultItems items;

    query.evaluateTo(&items);

    QXmlItem item(items.next());

    while (!item.isNull()) {

      QDomElement elem = model.toDomNode(item.toNodeModelIndex()).toElement();

      QSharedPointer<QDomElement> impl(new QDomElement(elem));

      result.push_back(SimXmlElement(impl, *this));

      // get next item
      item = items.next();
    }
  }

  return result;
}
开发者ID:bobzabcik,项目名称:OpenStudio,代码行数:38,代码来源:SimXmlDoc.cpp


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