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


C++ TreeNode::append方法代码示例

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


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

示例1: converter

Monitor::TreeNode*
Monitor::MonitorDataStorage::createParticipantNode(
  const ProcessKey&            pid,
  const OpenDDS::DCPS::GUID_t& id,
  bool&                        create
)
{
  if( id == OpenDDS::DCPS::GUID_UNKNOWN) {
    return 0;
  }

  // Find the parent node, if any.  It is ok to not have a parent node
  // for cases of out-of-order udpates.  We handle that as the updates
  // are actually processed.
  TreeNode* parent = this->getProcessNode( pid, create);

  // DomainParticipant data.
  OpenDDS::DCPS::GuidConverter converter( id);
  QList<QVariant> list;
  list << QString("DomainParticipant")
       << QString( QObject::tr( std::string( converter).c_str()));
  TreeNode* node = new TreeNode( list, parent);
  if( parent) {
    parent->append( node);
  }

  // Install the new node.
  this->guidToTreeMap_[ id] = std::make_pair( node->row(), node);

  return node;
}
开发者ID:Fantasticer,项目名称:OpenDDS,代码行数:31,代码来源:MonitorDataStorage.cpp

示例2: pid

Monitor::TreeNode*
Monitor::MonitorDataStorage::getTransportNode(
  const TransportKey& key,
  bool&               create
)
{
  TreeNode* node = 0;
  TransportToTreeMap::iterator location
    = this->transportToTreeMap_.find( key);
  if( location == this->transportToTreeMap_.end()) {
    // We are done if not creating a new node.
    if( !create) return 0;

    // This transport needs to be installed.

    // Find the parent node, if any.  It is ok to not have a parent node
    // for cases of out-of-order updates.  We handle that as the updates
    // are actually processed.
    ProcessKey pid( key.host, key.pid);
    TreeNode* parent = this->getProcessNode( pid, create);

    QList<QVariant> list;
    QString value = QString("0x%1")
                    .arg( key.transport, 8, 16, QLatin1Char('0'));
    list << QString( QObject::tr( "Transport")) << value;
    node = new TreeNode( list, parent);
    if( parent) {
      parent->append( node);
    }

    // Install the new node.
    this->transportToTreeMap_[ key] = std::make_pair( node->row(), node);

  } else {
    node = location->second.second;
    create = false;
  }

  // If there have been some out-of-order reports, we may have been
  // created without a parent node.  We can fill in that information now
  // if we can.  If we created the node, we already know it has a
  // parent so this will be bypassed.
  if( !node->parent()) {
    create = true;
    ProcessKey pid( key.host, key.pid);
    node->parent() = this->getProcessNode( pid, create);
  }

//node->setColor(1,QColor("#ffbfbf"));
  return node;
}
开发者ID:Fantasticer,项目名称:OpenDDS,代码行数:51,代码来源:MonitorDataStorage.cpp

示例3: QString

Monitor::TreeNode*
Monitor::MonitorDataStorage::getProcessNode(
  const ProcessKey& key,
  bool& create
)
{
  // HOST

  TreeNode* hostNode = 0;
  HostToTreeMap::iterator hostLocation
    = this->hostToTreeMap_.find( key.host);
  if( hostLocation == this->hostToTreeMap_.end()) {
    // We are done if not creating a new node.
    if( !create) return 0;

    // We need to add a new host.  Host nodes are children of the
    // root node.
    TreeNode* root = this->model_->modelRoot();

    // Host first.
    QList<QVariant> list;
    list << QString("Host") << QString( QObject::tr( key.host.c_str()));
    hostNode = new TreeNode( list, root);
    root->append( hostNode);

    // Install the new node.
    this->hostToTreeMap_[ key.host]
      = std::make_pair( hostNode->row(), hostNode);

  } else {
    // Retain the current host node.
    hostNode = hostLocation->second.second;
  }

  // PROCESS

  TreeNode* pidNode = 0;
  ProcessToTreeMap::iterator pidLocation
    = this->processToTreeMap_.find( key);
  if( pidLocation == this->processToTreeMap_.end()) {
    // We are done if not creating a new node.
    if( !create) return 0;

    // We need to add a new PID.  PID nodes are children of the host
    // nodes.  We just found the relevant host node.

    // PID data.
    QList<QVariant> list;
    list << QString("Process") << QString::number( key.pid);
    pidNode = new TreeNode( list, hostNode);
    hostNode->append( pidNode);

    // Install the new node.
    this->processToTreeMap_[ key]
      = std::make_pair( pidNode->row(), pidNode);

  } else {
    pidNode = pidLocation->second.second;
    create = false;
  }

  return pidNode;
}
开发者ID:Fantasticer,项目名称:OpenDDS,代码行数:63,代码来源:MonitorDataStorage.cpp


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