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


C++ Computer::getName方法代码示例

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


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

示例1: Search

void Search( vector<Computer> & list, Computer p ) {        // Search for members in list based on template person p
    vector<Computer> SearchList;                      // Create search result vector

    for( unsigned int x = 0; x < list.size(); x++) {    // Search each entry of list
        bool add = true;                                    // We say the entry should be added by default then exclude it based on the template person
        if( p.getName() != "" )
            if( !list[x].getName().contains( p.getName(), Qt::CaseInsensitive ) )
                add = false;

        if( p.getType() != "" )
            if( !list[x].getType().contains( p.getType() , Qt::CaseInsensitive ) )
                add = false;

        if( p.getWasBuilt() != 2 )
            if( !(list[x].getWasBuilt() == p.getWasBuilt() ) )
                add = false;

        if( p.getYear() != "" )
            if( !(list[x].getYear() == p.getYear() ) )
                add = false;

        if(add)
            SearchList.push_back( list[x] );
    }
    displayComputer( SearchList );              // Display search results
}
开发者ID:Njallzzz,项目名称:Skilaverkefni,代码行数:26,代码来源:menu.cpp

示例2: updateResource

bool Manager::updateResource(GenericResource* resource)
{
    YarpBroker broker;
    broker.init();

    Computer* comp = dynamic_cast<Computer*>(resource);
    if(!comp || !strlen(comp->getName()))
        return false;

    if(compareString(comp->getName(), "localhost"))
        return false;

    yarp::os::SystemInfoSerializer info;
    string strServer = comp->getName();
    if(strServer[0] != '/')
        strServer = string("/") + strServer;
    if(!broker.getSystemInfo(strServer.c_str(), info))
    {
        logger->addError(broker.error());
        comp->setAvailability(false);
    }
    else
    {
        comp->setAvailability(true);

        comp->getMemory().setTotalSpace(info.memory.totalSpace*1024);
        comp->getMemory().setFreeSpace(info.memory.freeSpace*1024);

        comp->getStorage().setTotalSpace(info.storage.totalSpace*1024);
        comp->getStorage().setFreeSpace(info.storage.freeSpace*1024);

        //comp->getNetwork().setIP4(info.network.ip4.c_str());
        //comp->getNetwork().setIP6(info.network.ip6.c_str());
        //comp->getNetwork().setMAC(info.network.mac.c_str());


        comp->getProcessor().setArchitecture(info.processor.architecture.c_str());
        comp->getProcessor().setCores(info.processor.cores);
        comp->getProcessor().setSiblings(info.processor.siblings);
        comp->getProcessor().setFrequency(info.processor.frequency);
        comp->getProcessor().setModel(info.processor.model.c_str());
        LoadAvg load;
        load.loadAverageInstant = (double)info.load.cpuLoadInstant;
        load.loadAverage1 = info.load.cpuLoad1;
        load.loadAverage5 = info.load.cpuLoad5;
        load.loadAverage15 = info.load.cpuLoad15;
        comp->getProcessor().setCPULoad(load);

        comp->getPlatform().setName(info.platform.name.c_str());
        comp->getPlatform().setDistribution(info.platform.distribution.c_str());
        comp->getPlatform().setRelease(info.platform.release.c_str());
    }
    return true;
}
开发者ID:lessc0de,项目名称:yarp,代码行数:54,代码来源:manager.cpp

示例3: displayComp

void AddLink::displayComp(vector<Computer>& computer)
{
    ui->table_linking->setSortingEnabled(false);

    ui->table_linking->clearContents();
    ui->table_linking->setColumnCount(5);
    ui->table_linking->setRowCount(computer.size());

    ui->table_linking->setHorizontalHeaderItem(0,new QTableWidgetItem(QString("id")));
    ui->table_linking->setHorizontalHeaderItem(1,new QTableWidgetItem(QString("Name")));
    ui->table_linking->setHorizontalHeaderItem(2,new QTableWidgetItem(QString("Year")));
    ui->table_linking->setHorizontalHeaderItem(3,new QTableWidgetItem(QString("Type")));
    ui->table_linking->setHorizontalHeaderItem(4,new QTableWidgetItem(QString("Built")));

    for(size_t i = 0; i < computer.size(); i++)
    {
        Computer temp = computer[i];

        QTableWidgetItem* id = new QTableWidgetItem;
        id->setData(Qt::DisplayRole,temp.getID());

        ui->table_linking->setItem(i,0, id);
        ui->table_linking->setItem(i,1, new QTableWidgetItem(QString::fromStdString(temp.getName())));
        ui->table_linking->setItem(i,2, new QTableWidgetItem(QString::number(temp.getYear())));
        ui->table_linking->setItem(i,3, new QTableWidgetItem(QString::fromStdString(temp.getType())));
        ui->table_linking->setItem(i,4, new QTableWidgetItem(QString::number(temp.getBuilt())));
    }

    ui->table_linking->setSortingEnabled(true);
}
开发者ID:SenpaiPlz,项目名称:0011Week,代码行数:30,代码来源:addlink.cpp

示例4: displayComputersForScientistConnections

void MainWindow::displayComputersForScientistConnections(vector<Computer> computers) {
    ui->computer_list_scientist_connections->clear();
    for (unsigned int i = 0; i < computers.size(); i++) {
        Computer currentComputer = computers.at(i);
        QString name = QString::fromStdString(currentComputer.getName());
        ui->computer_list_scientist_connections->addItem(name);
    }
}
开发者ID:axelboga,项目名称:hopur32,代码行数:8,代码来源:mainwindow.cpp

示例5: addToDatabase

void ComputerRepository::addToDatabase(Computer computer) {
    QSqlQuery query(datab);
    query.prepare("INSERT INTO Computers(Name, Type, WasBuilt, YearBuilt) VALUES (:Name, :Type, :WasBuilt, :YearBuilt)");
    query.bindValue(":Name", QString::fromStdString(computer.getName()));
    query.bindValue(":Type", QString::fromStdString(computer.getType()));
    query.bindValue(":WasBuilt", QString::fromStdString(computer.getWasBuilt()));
    query.bindValue(":YearBuilt", QString::fromStdString(computer.getYear()));
    query.exec();
}
开发者ID:axelboga,项目名称:hopur32,代码行数:9,代码来源:computerrepository.cpp

示例6: setComputers

void Scientist::setComputers(std::vector<Computer> newComputers)
{
    destroyComputers();

    for (unsigned int i = 0; i < newComputers.size(); i++)
    {
        Computer currentComputer = newComputers.at(i);
        this->computers.push_back(new Computer(currentComputer.getId(), currentComputer.getName(), currentComputer.getType(), currentComputer.getYearBuilt()));
    }
}
开发者ID:Danielos15,项目名称:Skil-1-Verklegt-n-mskei-1,代码行数:10,代码来源:scientist.cpp

示例7: add

void ComputerRepository::add(Computer &comp) {
    auto query = SQLConnection::getInstance()->getQuery();
    query->prepare("INSERT INTO computers (name, type, build_year, built) VALUES (?,?,?,?)");
    query->addBindValue(QString::fromStdString(comp.getName()));
    query->addBindValue(QString::fromStdString(comp.getType()));
    query->addBindValue(comp.getBuildYear());
    query->addBindValue(comp.getBuilt());
    if(!query->exec())
        throw std::runtime_error(query->lastError().text().toStdString());
}
开发者ID:VLN-H7,项目名称:Skil2,代码行数:10,代码来源:computerrepository.cpp

示例8: addComputer

void Database::addComputer(Computer computer)
{
    QSqlQuery query(connectDatabase());

    query.prepare("INSERT INTO Computers (ComputersName, YearBuilt, Type, WasItBuilt) VALUES (:name, :year, :type, :built)");
    query.bindValue(":name",         QString::fromStdString(computer.getName()));
    query.bindValue(":year",         QString::number(computer.getYear()));
    query.bindValue(":type",         QString::fromStdString(computer.getType()));
    query.bindValue(":built",        QString::number(computer.getwasItBuilt()));
    query.exec();
}
开发者ID:Dagnyb,项目名称:VLN-1,代码行数:11,代码来源:database.cpp

示例9: update

void ComputerRepository::update(Computer &comp, Computer &replace) {
    auto query = SQLConnection::getInstance()->getQuery();
    query->prepare("UPDATE computers SET name = ?, type = ?, build_year = ?, built = ? WHERE id = ?");
    query->addBindValue(QString::fromStdString(replace.getName()));
    query->addBindValue(QString::fromStdString(replace.getType()));
    query->addBindValue(replace.getBuildYear());
    query->addBindValue(replace.getBuilt());
    query->addBindValue(comp.getID());
    if(!query->exec())
        throw std::runtime_error(query->lastError().text().toStdString());
}
开发者ID:VLN-H7,项目名称:Skil2,代码行数:11,代码来源:computerrepository.cpp

示例10: addEntry

int SQLITEHandler::addEntry( Computer c ) {         // Add Computer to database
    if( !status )                                   // If not connected, fail
        return 1;
    q.prepare( "INSERT INTO computers (name, creation, type, constructed) VALUES (:name, :creation, :type, :constructed)" );
    q.bindValue( ":name", c.getName() );
    q.bindValue( ":creation", c.getYear() );
    q.bindValue( ":type", c.getType() );
    q.bindValue( ":constructed", c.getWasBuilt() );
    if( !q.exec() )                                 // Attempt to execute query
        return 1;
    return 0;                   // Return Success
}
开发者ID:Njallzzz,项目名称:Skilaverkefni,代码行数:12,代码来源:sqlitehandler.cpp

示例11: modifyEntry

int SQLITEHandler::modifyEntry( Computer c ) {      // Modify computer in database
    if( !status )                                   // If not connected, fail
        return 1;
    q.prepare( "UPDATE computers SET name = (:name), creation = (:creation), type = (:type), constructed = (:constructed) WHERE id = (:id)" );
    q.bindValue( ":id", c.getId() );
    q.bindValue( ":name", c.getName() );
    q.bindValue( ":creation", c.getYear() );
    q.bindValue( ":type", c.getType() );
    q.bindValue( ":constructed", c.getWasBuilt() );
    if( !q.exec() )                                 // Attempt to execute query
        return 2;
    return 0;                   // Return Success
}
开发者ID:Njallzzz,项目名称:Skilaverkefni,代码行数:13,代码来源:sqlitehandler.cpp

示例12: addComputer

void Interface::addComputer()
{
    clearConsole();
    printLines();
    printMenuHead("ADD COMPUTER");
    Computer temp;
    char ch;
    cin >> temp;

    cout << "Are you sure you want to add " << temp.getName().toStdString() << "?(y/n): ";
    cin >> ch;
    if(ch == 'y' || ch == 'Y')
    {
        if(request.addComputer(temp))
        {
            setStatus("\"" + temp.getName().toStdString() + "\" added to computers!");
        }
        else
        {
            setStatus("\"" + temp.getName().toStdString() + "\" could not be added to computers!");
        }
    }
}
开发者ID:hrafnkelli14,项目名称:Verklegt-verkefni-2,代码行数:23,代码来源:interface.cpp

示例13: add

bool ComputerRepository::add(Computer c) {
    db.open();
    QSqlQuery query;
    query.prepare("INSERT INTO Computers(Name, BuildYear, Type, Built)"
                  "VALUES (:name, :buildyear, :type, :built)");
    query.bindValue(":name", QString::fromStdString(c.getName()));
    query.bindValue(":buildyear", QString::fromStdString(c.getBuildYear()));
    query.bindValue(":type", QString::fromStdString(c.getType()));
    query.bindValue(":built", QString::number(c.getBuilt()));
    query.exec();
    db.close();
    return true;

}
开发者ID:moderndaymoron,项目名称:PersonCSciVer3,代码行数:14,代码来源:computerrepository.cpp

示例14: addToDatabase

bool Computerrepository::addToDatabase(Computer newComp) {
    QSqlQuery query;

    QString name       = QString::fromStdString((newComp.getName()));
    int     builtY     = newComp.getBuildYear();
    QString type       = QString::fromStdString((newComp.getType()));
    bool    builtOrNot = newComp.getBuild();

    query.prepare("INSERT INTO Computers (Name, YearBuilt, Type, BuiltOrNot) "
                  "VALUES (:Name, :YearBuilt, :Type, :BuiltOrNot)");
    query.bindValue(":Name",       name);
    query.bindValue(":YearBuilt",  builtY);
    query.bindValue(":Type",       type);
    query.bindValue(":BuiltOrNot", builtOrNot);

    return query.exec();
}
开发者ID:orriaxels,项目名称:Hopur42,代码行数:17,代码来源:computerrepository.cpp

示例15: displayComputer

void MainWindow::displayComputer(vector<Computer> computers) {
    ui->table_computers->clearContents();
    ui->table_computers->setRowCount(computers.size());

    for (unsigned int i = 0; i < computers.size(); i++) {
        Computer currentComputer = computers.at(i);
        QString Name = QString::fromStdString(currentComputer.getName());
        QString Type = QString::fromStdString(currentComputer.getType());
        QString WasBuilt = QString::fromStdString(currentComputer.getWasBuilt());
        QString Year = QString::fromStdString(currentComputer.getYear());

        ui->table_computers->setItem(i, 0, new QTableWidgetItem(Name));
        ui->table_computers->setItem(i, 1, new QTableWidgetItem(Type));
        ui->table_computers->setItem(i, 2, new QTableWidgetItem(WasBuilt));
        ui->table_computers->setItem(i, 3, new QTableWidgetItem(Year));
    }
    currentlyDisplayedComputers = computers;
}
开发者ID:axelboga,项目名称:hopur32,代码行数:18,代码来源:mainwindow.cpp


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