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


C++ People::biography方法代码示例

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


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

示例1:

bool People::operator== (const People &other)
{
    if ( this->id() == other.id() &&
         this->name() == other.name() &&
         this->birthday() == other.birthday() &&
         this->biography() == other.biography() &&
         this->type() == other.type() )
    {
        return true;
    }

    return false;
}
开发者ID:KDE,项目名称:macaw-movies,代码行数:13,代码来源:People.cpp

示例2: insertNewPeople

/**
 * @brief Adds a person to the database.
 * Should not be called directly.
 *
 * @param People
 * @return bool
 */
bool DatabaseManager::insertNewPeople(People &people)
{
    QSqlQuery l_query(m_db);
    // If a people with the same name exist, we update it
    // else we insert
    if(existPeople(people.name())) {
        Macaw::DEBUG("[DatabaseManager.insertNewPeople] Name already known");
        People l_peopleToUpdate = getOnePeopleByName(people.name());
        people.setId(l_peopleToUpdate.id());
        if(!updatePeople(people)) {

            return false;
        }
    } else {
        l_query.prepare("INSERT INTO people ("
                                                "name, "
                                                "birthday, "
                                                "biography, "
                                                "imported, "
                                                "id_tmdb "
                                            ") VALUES ("
                                                ":name, "
                                                ":birthday, "
                                                ":biography, "
                                                ":imported, "
                                                ":id_tmdb "
                                            ")"
                        );
        l_query.bindValue(":name", people.name());
        l_query.bindValue(":birthday", people.birthday().toString(DATE_FORMAT));
        l_query.bindValue(":biography", people.biography());
        l_query.bindValue(":imported", people.isImported());
        l_query.bindValue(":id_tmdb", people.tmdbId());

        if (!l_query.exec()) {
            Macaw::DEBUG("In insertNewPeople():");
            Macaw::DEBUG(l_query.lastError().text());

            return false;
        }
        people.setId(l_query.lastInsertId().toInt());
    }

    return true;
}
开发者ID:KDE,项目名称:macaw-movies,代码行数:52,代码来源:DatabaseManager_insert.cpp


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