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


C++ ModItem::getModClassName方法代码示例

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


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

示例1: readFromOMCWThread

/**
  * Finding function : returns all ModItem whom classname equals argument className.
  */
QList<ModItem*> ModItemsTree::findInDescendantsByClass(QString className,ModItem* parent)
{
    if(parent==NULL)
        parent = _rootElement;

    ModItem* curClass;
    QList<ModItem*> curClasses;
    int iChild;

    int curDepth = parent->depth();



    // then check children are readen
    if(!parent->childrenReaden())
    {
        // if not, check in its direction
        readFromOMCWThread(parent,curDepth+1,QString(),curDepth);
    }

    // looking if one child corresponds
    for(iChild=0; iChild<parent->childCount(); iChild++)
    {
        curClass = parent->child(iChild);
        if(curClass->getModClassName()==className)
            curClasses.push_back(curClass);

        //look deeper in children
        curClasses <<  findInDescendantsByClass(className,curClass);
    }

    return curClasses;

}
开发者ID:world2005,项目名称:OpenModelica,代码行数:37,代码来源:ModItemsTree.cpp

示例2: readFromOMCWThread

/**
  * Finding function : returns all ModItem whom class equals or inherits className.
  */
QList<ModItem*> ModItemsTree::findInDescendantsByInheritedClass(QString className,ModItem* parent)
{
    if(parent==NULL)
        parent = _rootElement;

    ModItem* curChild;
    QString curChildClass;
    QList<ModItem*> result;
    int iChild;

    int curDepth = parent->depth();

    // then check children are readen
    if(!parent->childrenReaden())
    {
        // if not, check in its direction
        readFromOMCWThread(parent,curDepth+1,QString(),curDepth);
    }

    // looking if one child corresponds
    for(iChild=0;iChild<parent->childCount();iChild++)
    {
        curChild = parent->child(iChild);
        curChildClass = curChild->getModClassName();
        if((curChildClass==className)||_moomc->inherits(curChildClass,className))
            result.push_back(curChild);

        //look deeper in children
        result <<  findInDescendantsByInheritedClass(className,curChild);
    }

    return result;
}
开发者ID:cephdon,项目名称:OMOptim,代码行数:36,代码来源:ModItemsTree.cpp

示例3: hasChildren

bool ModItemsTree::hasChildren ( const QModelIndex & parent ) const
{
    bool hasChildren;
    bool triedToFind;

    if(!_enabled)
        return false;

    ModItem *parentElement;

    if (parent.column() > 0)
        return false;

    if (!parent.isValid())
        parentElement = rootElement();
    else
        parentElement = static_cast<ModItem*>(parent.internalPointer());

    if(parentElement->childrenReaden())
    {
        if(_showComponents)
            return (parentElement->childCount()>0);
        else
            return (parentElement->childCount()-parentElement->compChildCount()>0);
    }
    else
    {
        triedToFind = true;
        hasChildren = false;

        QStringList children = _moomc->getClassNames(parentElement->name());
        children.removeAll(QString());
        if(!children.isEmpty())
            hasChildren = true;
        else if(parentElement->getClassRestr()==Modelica::MODEL)
        {
            if(!_showComponents)
            {
                hasChildren = false;
                triedToFind = false;
            }
            else
            {
                // look if has component children
                QStringList compNames;
                QStringList compClasses;
                _moomc->getContainedComponents(parentElement->getModClassName(),compNames,compClasses,true);
                hasChildren = (!compNames.isEmpty());
            }
        }
        if(triedToFind && !hasChildren)
            parentElement->setChildrenReaden(true); // avoid re-reading

        return hasChildren;
    }
}
开发者ID:world2005,项目名称:OpenModelica,代码行数:56,代码来源:ModItemsTree.cpp

示例4: findCompOfInheritingClassesInDescendants

/**
  * Finding function : returns all components whom classname inherits argument className.
  * In a multimap since there are different classNames here.
  * @param classFilter : stop seeking in parent class does not go through this filter
  */
void  ModItemsTree::findCompOfInheritingClassesInDescendants(QStringList classNames,ModItem* parent,QMultiMap<QString,ModItem*> &result,QRegExp classFilter)
{
    if(parent==NULL)
        return;

    ModItem* curComponent;

    int iChild;
    QString curCompClass;

    QString parentClass = parent->getModClassName();
    if(classFilter.isValid() && !parentClass.contains(classFilter))
        return ;// no need to carry on

    int curDepth = parent->depth();
    // then check children are readen
    if(!parent->childrenReaden())
    {
        // if not, check in its direction
        readFromOMCWThread(parent,curDepth+1,QString(),curDepth);
    }

    int nbCompChild = parent->compChildCount();
    int nbModelChild = parent->modelChildCount();
    int nbPackageChild = parent->packageChildCount();

    // looking if one child corresponds
    for(iChild=0;iChild<nbCompChild;iChild++)
    {
        curComponent = parent->compChild(iChild);
        curCompClass = curComponent->getModClassName();

        foreach(QString  className, classNames)
        {
            if((curCompClass==className)||_moomc->inherits(curCompClass,className))
                result.insert(className,curComponent);
        }
    }

    //look deeper in components children
    iChild=0;
    while(iChild<nbCompChild)
    {
        findCompOfInheritingClassesInDescendants(classNames,parent->compChild(iChild),result);
        iChild++;
    }

    //look deeper in models children
    iChild=0;
    while(iChild<nbModelChild)
    {
        findCompOfInheritingClassesInDescendants(classNames,parent->modelChild(iChild),result);
        iChild++;
    }

    //look deeper in packages children
    iChild=0;
    while(iChild<nbPackageChild)
    {
        findCompOfInheritingClassesInDescendants(classNames,parent->packageChild(iChild),result);
        iChild++;
    }
}
开发者ID:cephdon,项目名称:OMOptim,代码行数:68,代码来源:ModItemsTree.cpp


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