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


C++ FileHandler::removeFile方法代码示例

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


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

示例1: dbCreateInstance

/*
 * Create our database using the appropriate schema.
 */
bool DBHandler::dbCreateInstance()
{
    QMutexLocker locker(&dbMutex);

    int error = 0; // Number of SQL queries

    QSqlQuery query(db);

    if (db.isOpen())
    {
        qDebug() << "Creating Tables";

        QString address_book_create = "CREATE TABLE address_book (id INTEGER PRIMARY KEY, nym_id TEXT, nym_display_name TEXT)";
        // --------------------------------------------
        QString default_nym_create = "CREATE TABLE default_nym (default_id INTEGER PRIMARY KEY, nym TEXT)";
        QString default_server_create = "CREATE TABLE default_server (default_id INTEGER PRIMARY KEY, server TEXT)";
        QString default_asset_create = "CREATE TABLE default_asset (default_id INTEGER PRIMARY KEY, asset TEXT)";
        QString default_account_create = "CREATE TABLE default_account (default_id INTEGER PRIMARY KEY, account TEXT)";
        QString settings = "CREATE TABLE settings (setting TEXT PRIMARY KEY, parameter1 TEXT)";
        // --------------------------------------------
        QString create_contact = "CREATE TABLE contact(contact_id INTEGER PRIMARY KEY, contact_display_name TEXT)";
        QString create_nym     = "CREATE TABLE nym(nym_id TEXT PRIMARY KEY, contact_id INTEGER, nym_display_name)";
        QString create_server  = "CREATE TABLE nym_server(nym_id TEXT, server_id TEXT, PRIMARY KEY(nym_id, server_id))";
        QString create_account = "CREATE TABLE nym_account(account_id TEXT PRIMARY KEY, server_id TEXT, nym_id TEXT, asset_id TEXT, account_display_name TEXT)";
        // --------------------------------------------
        error += query.exec(address_book_create);
        error += query.exec(default_nym_create);
        error += query.exec(default_server_create);
        error += query.exec(default_asset_create);
        error += query.exec(default_account_create);
        error += query.exec(settings);
        // --------------------------------------------
        error += query.exec(create_contact);
        error += query.exec(create_nym);
        error += query.exec(create_server);
        error += query.exec(create_account);
        // ------------------------------------------
        if(error != 10)  //every querie passed?
        {
            qDebug() << "dbCreateInstance Error: " << dbConnectErrorStr + " " + dbCreationStr;
            FileHandler rm;
            db.close();

            rm.removeFile(QString(OTPaths::AppDataFolder().Get()) + dbFileNameStr);
//          rm.removeFile(QCoreApplication::applicationDirPath() + dbFileNameStr);
        }
        else
            qDebug() << "Database " + dbFileNameStr + " created.";
    }
    return error;
}
开发者ID:kyonetca,项目名称:Moneychanger,代码行数:54,代码来源:DBHandler.cpp

示例2: QVERIFY

void
TFileHandler::removeFile () {
  FileHandler fh;
  QVERIFY (fh.removeFile(tFilename) == true);
}
开发者ID:TheolZacharopoulos,项目名称:tl2hotel,代码行数:5,代码来源:tfilehandler.cpp

示例3: dbCreateInstance

/*
 * Create our database using the appropriate schema.
 */
bool DBHandler::dbCreateInstance()
{
    QMutexLocker locker(&dbMutex);

    int error = 0; // Number of SQL queries

    QSqlQuery query(db);

    if (db.isOpen())
    {
        qDebug() << "Creating Tables";

        QString address_book_create = "CREATE TABLE address_book (id INTEGER PRIMARY KEY, nym_id TEXT, nym_display_name TEXT)";
        // --------------------------------------------
        QString default_nym_create = "CREATE TABLE default_nym (default_id INTEGER PRIMARY KEY, nym TEXT)";
        QString default_server_create = "CREATE TABLE default_server (default_id INTEGER PRIMARY KEY, server TEXT)";
        QString default_asset_create = "CREATE TABLE default_asset (default_id INTEGER PRIMARY KEY, asset TEXT)";
        QString default_account_create = "CREATE TABLE default_account (default_id INTEGER PRIMARY KEY, account TEXT)";
        QString settings = "CREATE TABLE settings (setting TEXT PRIMARY KEY, parameter1 TEXT)";
        // --------------------------------------------
        QString create_contact = "CREATE TABLE contact(contact_id INTEGER PRIMARY KEY, contact_display_name TEXT)";
        QString create_nym     = "CREATE TABLE nym(nym_id TEXT PRIMARY KEY, contact_id INTEGER, nym_display_name TEXT)";
        QString create_server  = "CREATE TABLE nym_server(nym_id TEXT, server_id TEXT, PRIMARY KEY(nym_id, server_id))";
        QString create_account = "CREATE TABLE nym_account(account_id TEXT PRIMARY KEY, server_id TEXT, nym_id TEXT, asset_id TEXT, account_display_name TEXT)";
        // --------------------------------------------
        QString create_msg_method = "CREATE TABLE msg_method"
                " (method_id INTEGER PRIMARY KEY,"   // 1, 2, etc.
                "  method_display_name TEXT,"        // "Localhost"
                "  method_type TEXT,"                // "bitmessage"
                "  method_type_display TEXT,"        // "Bitmessage"
                "  method_connect TEXT)";            // "http://username:[email protected]://127.0.0.1:8332/"
        // --------------------------------------------
        // Messaging methods set for various nyms or contacts.
        //
        QString create_nym_method      = "CREATE TABLE nym_method(nym_id TEXT, method_id INTEGER, address TEXT, PRIMARY KEY(nym_id, method_id, address))";
        QString create_contact_method  = "CREATE TABLE contact_method(contact_id INTEGER, method_type TEXT, address TEXT, PRIMARY KEY(contact_id, method_type, address))";
        // --------------------------------------------
        /* Keep track of Namecoin names registered for the purpose of
           OTX.  They are always related to a Nym and credential
           hash, so those are kept here, too, so we can easily find
           corresponding names (although the name itself depends on the
           credential hash).  'active' is true if the name registration
           process has been finished; if not, 'regData' contains the
           JSON string describing the nmcrpc::NameRegistration object
           of the ongoing registration.  'updateTx' contains the
           transaction ID of the last name_update that has been issued,
           mainly to keep track of still unconfirmed update transactions
           (after the first confirmation, we can find it via the name).  */
        QString create_nmc = "CREATE TABLE nmc_names"
                             "  (name     TEXT PRIMARY KEY,"
                             "   nym      TEXT,"
                             "   cred     TEXT,"
                             "   active   BOOLEAN,"
                             "   regData  TEXT,"
                             "   updateTx TEXT)";
        // --------------------------------------------
        error += query.exec(address_book_create);
        error += query.exec(default_nym_create);
        error += query.exec(default_server_create);
        error += query.exec(default_asset_create);
        error += query.exec(default_account_create);
        error += query.exec(settings);
        // --------------------------------------------
        error += query.exec(create_contact);
        error += query.exec(create_nym);
        error += query.exec(create_server);
        error += query.exec(create_account);
        // ------------------------------------------
        error += query.exec(create_msg_method);
        error += query.exec(create_nym_method);
        error += query.exec(create_contact_method);
        // ------------------------------------------
        error += query.exec(create_nmc);
        // ------------------------------------------
        if(error != 14)  //every query passed?
        {
            qDebug() << "dbCreateInstance Error: " << dbConnectErrorStr + " " + dbCreationStr;
            FileHandler rm;
            db.close();

            rm.removeFile(QString(OTPaths::AppDataFolder().Get()) + dbFileNameStr);
//          rm.removeFile(QCoreApplication::applicationDirPath() + dbFileNameStr);
        }
        else
            qDebug() << "Database " + dbFileNameStr + " created.";
    }
    return error;
}
开发者ID:plato-cambrian,项目名称:Cambrian-src,代码行数:91,代码来源:DBHandler.cpp


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