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


C++ parent函数代码示例

本文整理汇总了C++中parent函数的典型用法代码示例。如果您正苦于以下问题:C++ parent函数的具体用法?C++ parent怎么用?C++ parent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: database

Database* DataType::database() const {
    return dynamic_cast<Database*>(parent());
}
开发者ID:gitcommit,项目名称:simpleorm,代码行数:3,代码来源:datatype.cpp

示例2: lastInternal

	//最后一个内部节点(即末节点的父亲)
	Rank lastInternal(Rank n)
	{
		return parent(n-1);
	}
开发者ID:ty14,项目名称:opencourse,代码行数:5,代码来源:schedule.cpp

示例3: return

bool WEXPORT WBoolSwitch::checked() {
/***********************************/

    return( GUIIsChecked( parent()->handle(), controlId() ) != 0 );
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:5,代码来源:wboolsw.cpp

示例4: LOG

int ElementFinder::FindElementsUsingSizzle(const IECommandExecutor& executor,
                                           const ElementHandle parent_wrapper,
                                           const std::wstring& criteria,
                                           Json::Value* found_elements) {
  LOG(TRACE) << "Entering ElementFinder::FindElementsUsingSizzle";

  int result;

  BrowserHandle browser;
  result = executor.GetCurrentBrowser(&browser);
  if (result != WD_SUCCESS) {
    LOG(WARN) << "Unable to get browser";
    return result;
  }

  std::wstring script_source(L"(function() { return function(){ if (!window.Sizzle) {");
  script_source += atoms::asString(atoms::SIZZLE);
  script_source += L"}\n";
  script_source += L"var root = arguments[1] ? arguments[1] : document.documentElement;";
  script_source += L"if (root['querySelectorAll']) { return root.querySelectorAll(arguments[0]); } ";
  script_source += L"var results = []; Sizzle(arguments[0], root, results);";
  script_source += L"return results;";
  script_source += L"};})();";

  CComPtr<IHTMLDocument2> doc;
  browser->GetDocument(&doc);

  Script script_wrapper(doc, script_source, 2);
  script_wrapper.AddArgument(criteria);
  if (parent_wrapper) {
    // Use a copy for the parent element?
    CComPtr<IHTMLElement> parent(parent_wrapper->element());
    script_wrapper.AddArgument(parent);
  }

  result = script_wrapper.Execute();
  if (result == WD_SUCCESS) {

    CComVariant snapshot = script_wrapper.result();

    std::wstring get_element_count_script = L"(function(){return function() {return arguments[0].length;}})();";
    Script get_element_count_script_wrapper(doc, get_element_count_script, 1);
    get_element_count_script_wrapper.AddArgument(snapshot);
    result = get_element_count_script_wrapper.Execute();
    if (result == WD_SUCCESS) {
      if (!get_element_count_script_wrapper.ResultIsInteger()) {
        LOG(WARN) << "Found elements count is not integer";
        result = EUNEXPECTEDJSERROR;
      } else {
        long length = get_element_count_script_wrapper.result().lVal;
        std::wstring get_next_element_script = L"(function(){return function() {return arguments[0][arguments[1]];}})();";
        for (long i = 0; i < length; ++i) {
          Script get_element_script_wrapper(doc, get_next_element_script, 2);
          get_element_script_wrapper.AddArgument(snapshot);
          get_element_script_wrapper.AddArgument(i);
          result = get_element_script_wrapper.Execute();
          if (result == WD_SUCCESS) {
            Json::Value json_element;
            get_element_script_wrapper.ConvertResultToJsonValue(executor,
                                                            &json_element);
            found_elements->append(json_element);
          } else {
            LOG(WARN) << "Unable to get " << i << " found element";
          }
        }
      }
    } else {
      LOG(WARN) << "Unable to get count of found elements";
      result = EUNEXPECTEDJSERROR;
    }

  } else {
    LOG(WARN) << "Execution returned error";
  }

  return result;
}
开发者ID:Cpaniyadi,项目名称:selenium,代码行数:77,代码来源:ElementFinder.cpp

示例5: detachFrom

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Comment::detach() {
	if ( parent() == NULL )
		return false;

	return detachFrom(parent());
}
开发者ID:ovsm-dev,项目名称:seiscomp3,代码行数:7,代码来源:comment.cpp

示例6: list_row

 void qt_dbtreemodel_impl::_update_list_row( list_row* it, const string& sql )
 {
     if ( _db && _db->valid() && _root && _parent && it )
     {
       //QModelIndex parent;
       list_row* _add = new list_row(_db, it->rowkeyfield(), it->level(), it->parent());
       _add->exec(sql.c_str());
       list_row::iterator i = it->begin();
       while (i!=it->end()) {
         list_row::iterator p = find_if(_add->begin(), _add->end(), prow_eq(*i));
         if (p == _add->end()) { // элемент не найден, лишний удалить
           row* r = *i;
           _parent->beginRemoveRows(parent(r), i-it->begin(), i-it->begin());
           i = it->erase(i);
           delete r;
           _parent->endRemoveRows();
           continue;
         }
         ++i;
       }
       size_t j = 0;
       i = _add->begin();
       map<size_t, row*> to_ins;
       map<size_t, row*> to_upd;
       map<size_t, row*>::iterator tmp;
       while(i!=_add->end()) {
         list_row::iterator p = find_if(it->begin(), it->end(), prow_eq(*i));
         if (p != it->end()) {
           // update
           while (1) {
             tmp = to_upd.find((p-(it->begin())));
             if (tmp == to_upd.end()) {
               to_upd[(p-(it->begin()))] = *i;
               break;
             }
             p = find_if(p+1, it->end(), prow_eq(*i));
             if (p == it->end())
               break;
           }
         } else {
           // insert
           to_ins[j] = *i;
           i = _add->erase(i);
           ++j;
           continue;
         } 
         ++j;
         ++i;
       }
       
       tmp = to_upd.begin();
       while(tmp != to_upd.end()) {
         j = tmp->first;
         row* r = (*it)[j];
         r->swap(*tmp->second);
         QModelIndex iparent = parent(r);
         _parent->dataChanged(index(j, 0, iparent), index(j, _cc, iparent));
         ++tmp;
         list_row* children = r->children();
         if (children) _update_list_row(children, children->sql());
       }
       tmp = to_ins.begin();
       while(tmp != to_ins.end()) {
         j = tmp->first;
         row* r = tmp->second;
         if (j >= it->size()) {
           _parent->beginInsertRows(parent(r), it->size(), it->size());
             it->insert(it->end(), r);
           _parent->endInsertRows();
         } else {
           _parent->beginInsertRows(parent(r), j, j);
             it->insert(it->begin() + j, r);
           _parent->endInsertRows();
         }
         ++tmp;
       }
       delete _add;
     }
 }
开发者ID:sblab,项目名称:libeast,代码行数:79,代码来源:qt_dbtreemodel_impl.cpp

示例7: detachFrom

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool ConfigModule::detach() {
	if ( parent() == NULL )
		return false;

	return detachFrom(parent());
}
开发者ID:salichon,项目名称:seiscomp3,代码行数:7,代码来源:configmodule.cpp

示例8: staff

void Clef::layout()
      {
      // determine current number of lines and line distance
      int   lines       = 5;              // assume resonable defaults
      qreal lineDist    = 1.0;

      Staff*      stf         = staff();
      StaffType*  staffType   = nullptr;
      Segment*    clefSeg     = static_cast<Segment*>(parent());
      // check clef visibility and type compatibility
      if (clefSeg && stf && stf->staffType()) {
            bool        bHide;
            // check staff type allows clef display
            staffType = staff()->staffType();
#if 0 // <<<<<<< HEAD
            if (!staffType->genClef()) {        // if no clef, set empty bbox and do nothing
                  qDeleteAll(elements);
                  elements.clear();
                  setbbox(QRectF());
                  return;
                  }

            // tablatures:
            if (staffType->group() == StaffGroup::TAB) {
                  // if current clef type not compatible with tablature,
                  // set tab clef according to score style
                  if (ClefInfo::staffGroup(clefType()) != StaffGroup::TAB)
                        setClefType( ClefType(score()->styleI(StyleIdx::tabClef)) );
#else
            bHide = !staffType->genClef();

            // check clef is compatible with staff type group
            int tick = clefSeg->tick();
            if (ClefInfo::staffGroup(clefType()) != staffType->group()) {
                  if (tick > 0 && !generated()) // if clef is not generated, hide it
                        bHide = true;
                  else                          // if generated, replace with initial clef type
                        // TODO : instead of initial staff clef (which is assumed to be compatible)
                        // use the last compatible clef previously found in staff
                        _clefTypes = stf->clefTypeList(0);
#endif      // >>>>>>> 38c666fa91f5bdaaa6d9ca0645c437c799be8c79
                  }

            //
            // courtesy clef
            //
            bool showClef = true;
#if 0 // <<<<<<< HEAD
            Segment* clefSeg = static_cast<Segment*>(parent());
            if (clefSeg) {
                  int tick = clefSeg->tick();
                  // only if there is a clef change
                  if (stf->clef(tick) != stf->clef(tick-1)) {
                        // locate clef at the begining of next measure, if any
                        Clef*       clefNext    = nullptr;
                        Segment*    clefSegNext = nullptr;
                        Measure*    meas        = static_cast<Measure*>(clefSeg->parent());
                        Measure*    measNext    = meas->nextMeasure();
                        if (measNext) {
                              clefSegNext = measNext->findSegment(SegmentType::Clef, tick);
                              if (clefSegNext)
                                    clefNext = static_cast<Clef*>(clefSegNext->element(track()));
                              }
                        // show this clef if: it is not a courtesy clef (no next clef or not at the end of the measure)
                        showClef = !clefNext || (clefSeg->tick() != meas->tick() + meas->ticks())
                              // if courtesy clef: show if score has courtesy clefs on
                              || ( score()->styleB(StyleIdx::genCourtesyClef)
                              // AND measure is not at the end of a repeat or of a section
                              && !( (meas->repeatFlags() & Repeat::END) || meas->sectionBreak() )
                              // AND this clef has courtesy clef turned on
                              && showCourtesy() );
                        if (!showClef)    {     // if no clef, set empty bbox and do nothing
                              qDeleteAll(elements);
                              elements.clear();
                              setbbox(QRectF());
                              return;
                              }
#else
            // only if there is a clef change
            if (!bHide && tick > 0 && stf->clef(tick) != stf->clef(tick-1)) {
                  // locate clef at the begining of next measure, if any
                  Clef*       clefNext    = nullptr;
                  Segment*    clefSegNext = nullptr;
                  Measure*    meas        = static_cast<Measure*>(clefSeg->parent());
                  Measure*    measNext    = meas->nextMeasure();
                  if (measNext) {
                        clefSegNext = measNext->findSegment(SegmentType::Clef, tick);
                        if (clefSegNext)
                              clefNext = static_cast<Clef*>(clefSegNext->element(track()));
#endif      // >>>>>>> 38c666fa91f5bdaaa6d9ca0645c437c799be8c79
                        }
                  // show this clef if: it is not a courtesy clef (no next clef or not at the end of the measure)
                  showClef = !clefNext || (clefSeg->tick() != meas->tick() + meas->ticks())
                        // if courtesy clef: show if score has courtesy clefs on
                        || ( score()->styleB(StyleIdx::genCourtesyClef)
                        // AND measure is not at the end of a repeat or of a section
                        && !( (meas->repeatFlags() & Repeat::END) || meas->sectionBreak() )
                        // AND this clef has courtesy clef turned on
                        && showCourtesy() );
                  bHide |= !showClef;
//.........这里部分代码省略.........
开发者ID:WeiChou,项目名称:MuseScore,代码行数:101,代码来源:clef.cpp

示例9: modify

void Configuration::modify()
{
    static_cast<KConfigDialog*>(parent())->enableButtonApply(true);
}
开发者ID:Emdek,项目名称:plasmoid-mini-player,代码行数:4,代码来源:Configuration.cpp

示例10: save

void Configuration::save()
{
    KConfigGroup configuration = m_applet->config();
    QStringList controls;

    if (m_controlsUi.openCheckBox->isChecked())
    {
        controls.append("open");
    }

    if (m_controlsUi.playPauseCheckBox->isChecked())
    {
        controls.append("playPause");
    }

    if (m_controlsUi.stopCheckBox->isChecked())
    {
        controls.append("stop");
    }

    if (m_controlsUi.playPreviousCheckBox->isChecked())
    {
        controls.append("playPrevious");
    }

    if (m_controlsUi.playNextCheckBox->isChecked())
    {
        controls.append("playNext");
    }

    if (m_controlsUi.positionCheckBox->isChecked())
    {
        controls.append("position");
    }

    if (m_controlsUi.volumeCheckBox->isChecked())
    {
        controls.append("volume");
    }

    if (m_controlsUi.muteCheckBox->isChecked())
    {
        controls.append("mute");
    }

    if (m_controlsUi.playlistCheckBox->isChecked())
    {
        controls.append("playlist");
    }

    if (m_controlsUi.fullScreenCheckBox->isChecked())
    {
        controls.append("fullScreen");
    }

    configuration.writeEntry("controls", controls);
    configuration.writeEntry("playOnStartup", m_generalUi.startPlaybackCheckBox->isChecked());
    configuration.writeEntry("enableDBus", m_generalUi.dbusCheckBox->isChecked());
    configuration.writeEntry("inhibitNotifications", m_generalUi.inhibitNotificationsCheckBox->isChecked());
    configuration.writeEntry("showToolTipOnTrackChange", m_generalUi.showTooltipOnTrackChange->value());

    static_cast<KConfigDialog*>(parent())->enableButtonApply(false);

    emit accepted();
}
开发者ID:Emdek,项目名称:plasmoid-mini-player,代码行数:65,代码来源:Configuration.cpp

示例11: Q_D

CuteReport::BaseItemInterface * DummyBand::clone()
{
    Q_D(DummyBand);
    return new DummyBand(*d, parent());
}
开发者ID:navrocky,项目名称:CuteReport,代码行数:5,代码来源:dummyband.cpp

示例12: write

void UmlComponent::write(FileOut & out)
{
    const char * k = (parent()->kind() == anUseCase)
                     ? "ownedUseCase"
                     : ((_uml_20) ? "ownedMember" : "packagedElement");

    out.indent();
    out << "<" << k << " xmi:type=\"uml:Component\"";
    out.id(this);
    out << " name=\"";
    out.quote((const char *)name()); //[jasa] ambiguous call
    out << "\">\n";
    out.indent(+1);
    write_description_properties(out);

    const QVector<UmlItem*> ch = children();
    unsigned n = ch.size();
    unsigned index;

    for (index = 0; index != n; index += 1)
        ch[index]->write(out);

    // provided

    const QVector< UmlClass* > & prov = providedClasses();

    n = prov.size();

    for (index = 0; index != n; index += 1) {
        UmlClass * cl = prov[index];

        out.indent();
        out << "<interfaceRealization xmi:type=\"uml:InterfaceRealization\"";
        out.id_prefix(this, "PROV_", index);
        out.ref(cl, "supplier");
        out.ref(this, "client");
        out.ref(cl, "contract");
        out << "/>\n";
    }

    // realizing

    const QVector< UmlClass* > & rea = realizingClasses();

    n = rea.size();

    for (index = 0; index != n; index += 1) {
        UmlClass * cl = rea[index];

        out.indent();
        out << "<realization xmi:type=\"uml:ComponentRealization\"";
        out.id_prefix(this, "REA_", index);
        out.ref(cl, "supplier");
        out.ref(this, "client");
        out.ref(cl, "realizingClassifier");
        out << "/>\n";
    }

    out.indent(-1);
    out.indent();
    out << "</" << k << ">\n";

    // required

    const QVector< UmlClass* > & req = requiredClasses();

    n = req.size();

    for (index = 0; index != n; index += 1) {
        UmlClass * cl = req[index];

        out.indent();
        out << "<" << k << " xmi:type=\"uml:Usage\"";
        out.id_prefix(this, "REQ_", index);
        out.ref(cl, "supplier");
        out.ref(this, "client");
        out << "/>\n";
    }

    unload();

}
开发者ID:DoUML,项目名称:douml,代码行数:82,代码来源:UmlComponent.cpp

示例13: Q_ASSERT_X

QAction *ShortcutHandler::shortcutConfigAction()
{
    Q_ASSERT_X(!m_shortcutConfigWidget, "ShortcutHandler", "a shortcut configuration dialog and a shortcut configuration widget cannot exist at the same time in one application");
    if (!m_shortcutConfigAction)
    {
        m_shortcutConfigAction = new QAction(tr("Configure S&hortcuts..."), qobject_cast<QWidget*>(parent()));
        QObject::connect(m_shortcutConfigAction, SIGNAL(triggered()), this, SLOT(openShortcutConfigDialog()));
    }
    return m_shortcutConfigAction;
}
开发者ID:damoguyan,项目名称:pdfviewer,代码行数:10,代码来源:shortcuthandler.cpp

示例14: parent

KisNodeSP KisNode::nextSibling() const
{
    if (!parent()) return 0;

    return parent()->at(parent()->index(const_cast<KisNode*>(this)) + 1);
}
开发者ID:KDE,项目名称:calligra-history,代码行数:6,代码来源:kis_node.cpp

示例15: Draw

/*!
	This function is designed to be run by a different thread 
	than Draw(), so we lock a mutex before changing the
	current images displayed.
*/
void ImageView::UpdateImage(BaseImgPtr imgPtr, ImageType type,
							const std::string& imageInfo,
							vpl::DisplaySpecs& specs)
{
	m_mutex.Lock();

	// We update either curImage or curRGBImage
	m_curByteImage.clear();
	m_curRGBImage.clear(); 
	m_curImgInfo = imageInfo;
	m_dispSpecs = specs;

	if (type == RGB_IMAGE)
	{
		m_curRGBImage.deep_copy(imgPtr);
	}
	else if (type == BYTE_IMAGE)
	{
		// We could more efficient and only copy the
		// image if its memory is borrowed (same for RGB). However,
		// it could happen that we need to redraw while the data is being changed
		// but before UpdateImage is called, and that may lead to strange outputs
		m_curByteImage.deep_copy(imgPtr);
	}
	else if (type == FLOAT_IMAGE)
	{
		FloatImg floatImg;

		floatImg.deep_copy(imgPtr);

		/*float min_b,max_b;
		
		vil_math_value_range(floatImg, min_b, max_b);

		DBG_PRINT2(min_b, max_b)*/

		vil_convert_stretch_range(floatImg, m_curByteImage);
	}
	else if (type == INT_IMAGE)
	{
		IntImg intImg;

		intImg.deep_copy(imgPtr);

		vil_convert_stretch_range(intImg, m_curByteImage);
	}
	else if (type == VOID_IMAGE)
	{
		//ShowError("The component has no image output");
	}
	else
	{
		ASSERT(false);
	}

	m_mutex.Release();

	parent()->label(m_curImgInfo.c_str());

	redraw();
}
开发者ID:ChrisWhiten,项目名称:VideoParser,代码行数:66,代码来源:ImageView.cpp


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