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


C++ System::Relinquish方法代码示例

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


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

示例1: CastOffSystems

int Measure::CastOffSystems( ArrayPtrVoid *params )
{
    // param 0: a pointer to the system we are taking the content from
    // param 1: a pointer the page we are adding system to
    // param 2: a pointer to the current system
    // param 3: the cummulated shift (m_drawingXRel of the first measure of the current system)
    // param 4: the system width
    // param 5: the current scoreDef width
    System *contentSystem = static_cast<System*>((*params).at(0));
    Page *page = static_cast<Page*>((*params).at(1));
    System **currentSystem = static_cast<System**>((*params).at(2));
    int *shift = static_cast<int*>((*params).at(3));
    int *systemWidth = static_cast<int*>((*params).at(4));
    int *currentScoreDefWidth = static_cast<int*>((*params).at(5));
    
    if ( ( (*currentSystem)->GetChildCount() > 0 ) && ( this->m_drawingXRel + this->GetWidth() + (*currentScoreDefWidth) - (*shift) > (*systemWidth) ) ) {
        (*currentSystem) = new System();
        page->AddSystem( *currentSystem );
        (*shift) = this->m_drawingXRel;;
    }
    
    // Special case where we use the Relinquish method.
    // We want to move the measure to the currentSystem. However, we cannot use DetachChild
    // from the content System because this screws up the iterator. Relinquish gives up
    // the ownership of the Measure - the contentSystem will be deleted afterwards.
    Measure *measure = dynamic_cast<Measure*>( contentSystem->Relinquish( this->GetIdx()) );
    assert( measure );
    (*currentSystem)->AddMeasure( measure );
    
    return FUNCTOR_SIBLINGS;
}
开发者ID:maximumspatium,项目名称:verovio,代码行数:31,代码来源:measure.cpp

示例2: CastOffSystems

int ScoreDef::CastOffSystems( ArrayPtrVoid params )
{
    // param 0: a pointer to the system we are taking the content from
    // param 1: a pointer the page we are adding system to (unused)
    // param 2: a pointer to the current system
    // param 3: the cummulated shift (m_drawingXRel of the first measure of the current system) (unused)
    // param 4: the system width (unused)
    System *contentSystem = static_cast<System*>(params[0]);
    System **currentSystem = static_cast<System**>(params[2]);
    
    // Since the functor returns FUNCTOR_SIBLINGS we should never go lower than the system children
    assert( dynamic_cast<System*>(this->m_parent));
    
    // Special case where we use the Relinquish method.
    // We want to move the measure to the currentSystem. However, we cannot use DetachChild
    // from the content System because this screws up the iterator. Relinquish gives up
    // the ownership of the Measure - the contentSystem will be deleted afterwards.
    ScoreDef *scoreDef = dynamic_cast<ScoreDef*>( contentSystem->Relinquish( this->GetIdx()) );
    (*currentSystem)->AddScoreDef( scoreDef );
    
    return FUNCTOR_SIBLINGS;
}
开发者ID:jamespark04,项目名称:verovio,代码行数:22,代码来源:scoredef.cpp


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