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


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

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: updateComputer

bool Computerrepository::updateComputer(Computer computerUpdate) {
    QSqlQuery query;

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

    query.prepare("UPDATE Computers SET Name=:Name, YearBuilt=:YearBuilt,"
                        " Type=:Type, BuiltOrNot=:BuiltOrNot WHERE id=:id");
    query.bindValue(":id",         id);
    query.bindValue(":Name",       name);
    query.bindValue(":YearBuilt",  builtY);
    query.bindValue(":Type",       type);
    query.bindValue(":BuiltOrNot", builtOrNot);

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

示例6: displayComputers

void addComToSci::displayComputers()
{
    ui->table_computers->clearContents();

    ui->table_computers->setRowCount(computers.size());

    for(unsigned int i = 0; i < computers.size(); i++){
        Computer current = computers[i];

        QString name = QString::fromStdString(current.getName());
        QString buildYear = QString::number(current.getBuildYear());
        QString type = QString::fromStdString(current.getType());
        QString made = QString::fromStdString(current.getMade());
        QString Id = QString::number(current.getID());

        ui->table_computers->setItem(i, 0, new QTableWidgetItem(name));
        ui->table_computers->setItem(i, 1, new QTableWidgetItem(buildYear));
        ui->table_computers->setItem(i, 2, new QTableWidgetItem(type));
        ui->table_computers->setItem(i, 3, new QTableWidgetItem(made));
        ui->table_computers->setItem(i, 4, new QTableWidgetItem(Id));
        ui->table_computers->setColumnHidden(4, true);
    }
}
开发者ID:alexi15,项目名称:verk1,代码行数:23,代码来源:addcomtosci.cpp


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