예제 #1
0
void Exec()
{
    if(strcmp(CmdBuf[CmdNum-1].args[0],"bg")==0)
         bg();
    else if(strcmp(CmdBuf[CmdNum-1].args[0],"fg")==0)
         fg();
    else if(strcmp(CmdBuf[CmdNum-1].args[0],"cd")==0)
    {
        if(chdir(CmdBuf[CmdNum-1].args[1])<0)
             printf("目录不正确!!\n");
    }
    else if(strcmp(CmdBuf[CmdNum-1].args[0],"history")==0)
         ListHis();
    else if(strcmp(CmdBuf[CmdNum-1].args[0],"jobs")==0)
         ListJob();
    else if(strcmp(CmdBuf[CmdNum-1].args[0],"exit")==0)
    {
        DelHis();
        freeJob();
        exit(0);
    }
    else if(strcmp(CmdBuf[CmdNum-1].args[0],"rm")==0)
        beforeRemove(CmdBuf[CmdNum-1].args[1]);
    else
         ExecOut();
}
예제 #2
0
AbstractProperty * PropertyGroup::takeProperty(const std::string & name)
{
    // Check if property exists in this group
    if (!this->propertyExists(name))
    {
        return nullptr;
    }

    // Get property and property index
    AbstractProperty * property = m_propertiesMap.at(name);
    auto it = std::find(m_properties.begin(), m_properties.end(), property);
    size_t index = indexOf( (*it) );

    // Invoke callback
    beforeRemove(index);

    // Remove property from group
    m_properties.erase(it);
    m_propertiesMap.erase(name);

    // Invoke callback
    afterRemove(index);

    // Return property
    return property;
}
예제 #3
0
void PropertyGroup::clear()
{
    // Remove all properties
    auto it = m_properties.begin();
    while (it != m_properties.end())
    {
        // Get property index
        size_t index = std::distance(m_properties.begin(), it);

        // Invoke callback
        beforeRemove(index);

        // Delete property
        if (m_ownsProperties)
        {
            AbstractProperty * property = *it;
            delete property;
        }

        // Remove property
        m_propertiesMap.erase((*it)->name());
        it = m_properties.erase(it);

        // Invoke callback
        afterRemove(index);
    }

    // Make sure that property list is empty
    assert(m_properties.empty());
    assert(m_propertiesMap.empty());
}
예제 #4
0
void NotifyListNotifier::notifyBeforeRemove(const int firstIndex, const int lastIndex)
{
	emit beforeRemove(firstIndex, lastIndex);
}