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


C++ Updater类代码示例

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


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

示例1: read_update_progress_thread

// поток чтения пайпа 
DWORD Updater::read_update_progress_thread(LPVOID param)
{
	Updater* updater = static_cast<Updater*>(param);
	updater->AddProgressInfo(prog_info::PROGRESS_START);
	for (;;) 
	{ 
		std::string output;
		const int	BUFSIZE = 1024;
		char		chBuf[BUFSIZE];
		DWORD		dwRead;
		DWORD		ec = 0; //exit code
		
    DWORD bytesAvailable = 0;
    while (PeekNamedPipe(updater->_hReadPipe, NULL, 0, NULL, &bytesAvailable, NULL) && bytesAvailable > 0)
  		if (ReadFile(updater->_hReadPipe, chBuf, BUFSIZE - 1, &dwRead,	NULL) && dwRead)
	  	{
		  	chBuf[dwRead] = '\0';
			  output += chBuf;
			  LOG_DEBUG << output;
			  updater->parse(output);
		  }

    if (!GetExitCodeThread(updater->_pi.hThread, &ec) || ec != STILL_ACTIVE)
      break;

	} 
	updater->AddProgressInfo(prog_info::PROGRESS_END);
	updater->DestroyHandle();
	return 0;
}
开发者ID:txe,项目名称:ieml,代码行数:31,代码来源:Updater.cpp

示例2: MockUpdateServer

void UpdaterTest::testRun()
{
	vector<string> versionStrings;
	versionStrings.push_back("800");
	versionStrings.push_back("900");
	versionStrings.push_back("1000");
	versionStrings.push_back("Error, no connection");
	versionStrings.push_back("1100");
	versionStrings.push_back("1200");

	MockUpdateServer *mus = new MockUpdateServer(versionStrings);
	Updater *u = new Updater((UpdateServer*)mus, 1100, ".", 0, 0, 0);

	u->run();

	vector<bool> wasDownloadAttempted = mus->_recordedDownloadAttemptsAfterUpdateChecks;
	CPPUNIT_ASSERT_EQUAL((size_t)6, wasDownloadAttempted.size());
	CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[0]);
	CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[1]);
	CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[2]);
	CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[3]);
	CPPUNIT_ASSERT_EQUAL(false, (bool)wasDownloadAttempted[4]);
	CPPUNIT_ASSERT_EQUAL(true, (bool)wasDownloadAttempted[5]);

	delete mus;
	delete u;

}
开发者ID:DX94,项目名称:BumpTop,代码行数:28,代码来源:BT_UpdaterTest.cpp

示例3: main

int     main(int argc, char** argv)
{
  QApplication  app(argc, argv);
  Updater       updater;

  if (argc != 3) return 1;
  updater.show();
  return app.exec();
}
开发者ID:8102,项目名称:QNetSoul,代码行数:9,代码来源:main.cpp

示例4: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MapMaker w;
    Updater *u = new Updater();
    w.getTerrainPainter()->setUpdater(u);
    u->connect(u,SIGNAL(update()),w.getTerrainPainter(),SLOT(paintMap()));
    w.show();
    u->start();

    return a.exec();
}
开发者ID:Programmer-CE,项目名称:Midgard-Map-Maker,代码行数:12,代码来源:main.cpp

示例5: read_check_update_thread

// поток, проверка наличия обновления 
DWORD Updater::read_check_update_thread(LPVOID param)
{
	Updater*	updater = static_cast<Updater*>(param);
	std::string output;
	for (;;) 
	{ 
		const int	BUFSIZE = 1024;
		char		chBuf[BUFSIZE];
		DWORD		dwRead;
		DWORD		ec = 0; //exit code

    DWORD bytesAvailable = 0;
    while (PeekNamedPipe(updater->_hReadPipe, NULL, 0, NULL, &bytesAvailable, NULL) && bytesAvailable > 0)
      if (ReadFile(updater->_hReadPipe, chBuf, BUFSIZE - 1, &dwRead,	NULL) && dwRead)
      {
        chBuf[dwRead] = '\0';
        output += chBuf;

      }
    if (!GetExitCodeThread(updater->_pi.hThread, &ec) || ec != STILL_ACTIVE)
			break;
	} 
	
	LOG_DEBUG << output;
	int	count_line = 0;
	for (std::string::iterator it = output.begin(); it != output.end(); ++it)
	{
		if (*it != '\n')
			continue;
		std::string line = output.substr(0, std::distance(output.begin(), it));
		++it;
		output.erase(output.begin(), it);
		it = output.begin();
		if (0 != line.find("sending") &&
			(line.size()-1) != line.find("/") &&
			0 != line.find("deleting") &&
			1 != line.find("sent") &&
			0 != line.find("total size") &&
			0 != line.size())
				++count_line;			
		if (it == output.end())
			break;
	}

	bool exist_update = count_line > 0;

	updater->_status_check.get_content(); // удаляем предыдущую информацию
	updater->_status_check.push_back(exist_update);

	updater->DestroyHandle();
	return 0;
}
开发者ID:txe,项目名称:ieml,代码行数:53,代码来源:Updater.cpp

示例6: Updater

bool Filemanager::update(std::string file_path) {
    Updater *updater = new Updater();
    std::pair<std::map<int, int>, std::vector<std::pair<long, long> > > updater_result = updater->get_similar(file_path);
    std::map<int, int> similar_chunk = updater_result.first;
    std::vector<std::pair<long, long> > diff = updater_result.second;
    // std::cout << "similar:" << std::endl;
    // updater->show_similar(similar_chunk);
    // std::cout << "diff bytes:" << std::endl;
    updater->show_diff(diff);
    this->mworker = new Metaworker();
    this->mworker->load(file_path);
    std::vector<int> chunk_to_del;

    this->mworker->show();
    
    for(int i = 0; i < mworker->mdata_size(); i++) {
        if(similar_chunk.find(i) == similar_chunk.end()) {
            // std::cout << i << " ";
            chunk_to_del.push_back(i);

        } else {
            mworker->mdata[i].start += ( *(similar_chunk.find(i))).second - 1;
            mworker->mdata[i].finish += ( *(similar_chunk.find(i))).second - 1;
        }
    }

    // std::cout << std::endl << "old mdata: " << std::endl;;

   
    for(int i = chunk_to_del.size() - 1;i >= 0; i--) {
        // std::cout << "num: " << i << " chunk:" << chunk_to_del[i] << std::endl;
        this->rm_file(this->mworker->get(chunk_to_del[i]).cipher_hash);
        this->mworker->remove(chunk_to_del[i]);
    }

    for(int i = 0; i < diff.size(); i++) {
        this->segmentate(file_path, diff[i].first, diff[i].second);
    }

std::cout << std::endl << "new mdata: " << std::endl;
this->mworker->sort();
    this->mworker->save();



    // this->mworker->save();
    return true;

}
开发者ID:Sild,项目名称:sebs,代码行数:49,代码来源:filemanager.cpp

示例7: main

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);

    QTranslator translator;
    translator.load(":/translation/qt_fr");

    app.installTranslator(&translator);

    Updater up;

    up.show();

    return app.exec();
}
开发者ID:keke222,项目名称:Multifacile,代码行数:15,代码来源:main.cpp

示例8: testTaskNumDiff

void testTaskNumDiff(const std::vector<rbd::MultiBody>& mbs,
	const std::vector<rbd::MultiBodyConfig>& mbcs,
	Task& task, Updater updater, Tester tester,
	int nrIter=100, double diffStep=1e-6, double tol=1e-4)
{
	using namespace Eigen;
	using namespace sva;
	using namespace rbd;

	std::vector<MultiBodyConfig> mbcsPost(mbcs), mbcsCur(mbcs);

	std::vector<Eigen::VectorXd> q(mbs.size());
	std::vector<Eigen::VectorXd> alpha(mbs.size());
	std::vector<Eigen::VectorXd> alphaD(mbs.size());

	for(int i = 0; i < nrIter; ++i)
	{
		for(std::size_t r = 0; r < mbs.size(); ++r)
		{
			const rbd::MultiBody& mb = mbs[r];
			const rbd::MultiBodyConfig& mbc = mbcs[r];
			rbd::MultiBodyConfig& mbcPost = mbcsPost[r];
			rbd::MultiBodyConfig& mbcCur = mbcsCur[r];

			q[r].setRandom(mb.nrParams());
			alpha[r].setRandom(mb.nrDof());
			alphaD[r].setRandom(mb.nrDof());

			mbcCur = mbc;
			vectorToParam(q[r], mbcCur.q);
			vectorToParam(alpha[r], mbcCur.alpha);
			vectorToParam(alphaD[r], mbcCur.alphaD);

			mbcPost = mbcCur;

			eulerIntegration(mb, mbcPost, diffStep);

			forwardKinematics(mb, mbcCur);
			forwardKinematics(mb, mbcPost);
			forwardVelocity(mb, mbcCur);
			forwardVelocity(mb, mbcPost);
		}

		updater(task, mbs, mbcsCur);
		VectorXd evalCur = task.eval();
		VectorXd speedCur = -task.speed();
		VectorXd accCur = -task.normalAcc();
		accCur -= updater.tanAcc(task, alphaD);

		updater(task, mbs, mbcsPost);
		VectorXd evalPost = task.eval();
		VectorXd speedPost = -task.speed();

		VectorXd speedDiff = (evalPost - evalCur)/diffStep;
		VectorXd accDiff = (speedPost - speedCur)/diffStep;

		tester(speedCur, accCur, speedDiff, accDiff, tol);
	}
}
开发者ID:jorisv,项目名称:Tasks,代码行数:59,代码来源:TasksTest.cpp

示例9: updaterCopy

void TestUpdater::updaterCopy()
{
    Updater u;
    u.setLocalRepository(dataCopy + "/local_repo");
    u.copy(testOutputCopy);
    QSignalSpy spy(&u, SIGNAL(copyFinished(bool)));
    QVERIFY(spy.wait());

    try {
        (TestUtils::assertFileEquals(dataCopy + "/local_repo/patch_same.txt", testOutputCopy + "/patch_same.txt"));
        (TestUtils::assertFileEquals(dataCopy + "/local_repo/path_diff.txt", testOutputCopy + "/path_diff.txt"));
        (TestUtils::assertFileEquals(dataCopy + "/local_repo/path_diff2.txt", testOutputCopy + "/path_diff2.txt"));
        (TestUtils::assertFileEquals(dataCopy + "/local_repo/rmfile.txt", testOutputCopy + "/rmfile.txt"));
    } catch(QString &msg) {
        QFAIL(msg.toLatin1());
    }
    QVERIFY(!QFile::exists(testOutputCopy + "/add.txt"));
}
开发者ID:Speedy37,项目名称:QtUpdateSystem,代码行数:18,代码来源:tst_updater.cpp

示例10: updaterIsManaged

void TestUpdater::updaterIsManaged()
{
    Updater u;
    u.setLocalRepository(testOutputIsManaged);
    QVERIFY(u.isManaged(testOutputIsManaged + "/status.json"));
    QVERIFY(u.isManaged(testOutputIsManaged + "/path_diff.txt"));
    QVERIFY(u.isManaged(testOutputIsManaged + "/dirs/empty_dir2/"));
    QVERIFY(u.isManaged(testOutputIsManaged + "/dirs/"));
    QVERIFY(!u.isManaged(testOutputIsManaged + "/dirs/empty_dir1/"));
    QVERIFY(!u.isManaged(testOutputIsManaged + "/unmanaged.json"));
}
开发者ID:Speedy37,项目名称:QtUpdateSystem,代码行数:11,代码来源:tst_updater.cpp

示例11: getUpdater

/**
 * Returns the \c Updater instance registered with the given \a url.
 *
 * If an \c Updater instance registered with teh given \a url does not exist,
 * this function will create it and configure it automatically.
 */
Updater* QSimpleUpdater::getUpdater (const QString& url) const
{
    if (!URLS.contains (url)) {
        Updater* updater = new Updater;
        updater->setUrl (url);

        URLS.append (url);
        UPDATERS.append (updater);

        connect (updater, SIGNAL (checkingFinished  (QString)),
                 this,    SIGNAL (checkingFinished  (QString)));
        connect (updater, SIGNAL (downloadFinished  (QString, QString)),
                 this,    SIGNAL (downloadFinished  (QString, QString)));
        connect (updater, SIGNAL (appcastDownloaded (QString, QByteArray)),
                 this,    SIGNAL (appcastDownloaded (QString, QByteArray)));
    }

    return UPDATERS.at (URLS.indexOf (url));
}
开发者ID:FRC-Utilities,项目名称:QDriverStation,代码行数:25,代码来源:QSimpleUpdater.cpp

示例12: updaterRemoveOtherFiles

void TestUpdater::updaterRemoveOtherFiles()
{
    Updater u;
    u.setLocalRepository(testOutputIsManaged);
    QVERIFY(QFile::exists(testOutputIsManaged + "/status.json"));
    QVERIFY(QFile::exists(testOutputIsManaged + "/unmanaged.json"));
    QVERIFY(QDir(testOutputIsManaged + "/dirs/empty_dir1").exists());

    u.removeOtherFiles([](QFileInfo file) {
        return file.fileName() != "unmanaged.json";
    });
    QVERIFY(QFile::exists(testOutputIsManaged + "/status.json"));
    QVERIFY(QFile::exists(testOutputIsManaged + "/unmanaged.json"));
    QVERIFY(!QDir(testOutputIsManaged + "/dirs/empty_dir1").exists());

    u.removeOtherFiles();
    QVERIFY(QFile::exists(testOutputIsManaged + "/status.json"));
    QVERIFY(!QFile::exists(testOutputIsManaged + "/unmanaged.json"));
    QVERIFY(!QDir(testOutputIsManaged + "/dirs/empty_dir1").exists());
}
开发者ID:Speedy37,项目名称:QtUpdateSystem,代码行数:20,代码来源:tst_updater.cpp

示例13: remove

void UpdaterTest::testIsUpdateDownloaded()
{
	if (exists("a_temporary_test_data_directory"))
	{
		remove("a_temporary_test_data_directory\\BumpTopInstaller.msi");
		remove("a_temporary_test_data_directory\\version.txt");
		remove("a_temporary_test_data_directory\\desc.txt");
	}

	vector<string> versionStrings;
	versionStrings.push_back("800");
	MockUpdateServer *mus = new MockUpdateServer(versionStrings);
	Updater *u = new Updater(mus, 99, "a_temporary_test_data_directory", 0, 0, 0);

	create_directory("a_temporary_test_data_directory");

	ofstream installer("a_temporary_test_data_directory//BumpTopInstaller.msi");
	installer << "!!!!!";
	installer.close();

	CPPUNIT_ASSERT_EQUAL(false, u->isUpdateDownloaded());

	ofstream versionFile("a_temporary_test_data_directory//version.txt");
	versionFile << "2000";
	versionFile.close();

	CPPUNIT_ASSERT_EQUAL(false, u->isUpdateDownloaded());

	ofstream descFile("a_temporary_test_data_directory//desc.txt");
	descFile << "best version ever";
	descFile.close();

	CPPUNIT_ASSERT_EQUAL(true, u->isUpdateDownloaded());

	remove("a_temporary_test_data_directory\\BumpTopInstaller.msi");
	remove("a_temporary_test_data_directory\\version.txt");
	remove("a_temporary_test_data_directory\\desc.txt");
	remove("a_temporary_test_data_directory");


}
开发者ID:DX94,项目名称:BumpTop,代码行数:41,代码来源:BT_UpdaterTest.cpp

示例14: main

int main(int argc, char *argv[])
{
    Application a(argc, argv);
    a.setAttribute(Qt::AA_DontShowIconsInMenus, true);
    a.setApplicationName("psnewmodel");
    a.setOrganizationName("LB Productions");
    a.setOrganizationDomain("lbproductions.github.com");
    a.setApplicationVersion(APP_VERSION);

#ifdef Q_OS_MAC
    CocoaInitializer cocoaInitializer;
    Q_UNUSED(cocoaInitializer);

    CrashReporter::init();
#endif

    Updater *updater = Updater::instanceForPlatform();
    if(updater)
        updater->checkForUpdatesInBackground();

    if(a.arguments().contains("-C")) {
        QSettings s;
        s.clear();
    }

    ChooseLibraryWidget *mainWindow = new ChooseLibraryWidget;
    if(a.fileToOpen().isEmpty()) {
        mainWindow->showOrOpenLibrary();
    }
    else {
        mainWindow->openLibrary(a.fileToOpen()+"/database/database.sqlite");
    }

    int ret = a.exec();

    Library::instance()->close();
    delete updater;

    return ret;
}
开发者ID:lbproductions,项目名称:psnewmodel,代码行数:40,代码来源:main.cpp

示例15: LogError

void SpawnerMgr::unload()
{
	LogError(LN, "Unloading the spawner conf");
	_lock.lock();
	std::list<Spawner*>::iterator ptr = _spawners.begin();
	Updater* updater = WorldMgr::get_singleton().get_updater();
	MapMgr* map_mgr = MapMgr::get_instance();
	for (; ptr != _spawners.end(); ++ptr)
	{
		Map* map = (*ptr)->get_map();//map_mgr->get_map((*ptr)->get_spawn_info()._map);
		if (map)
		{
			map->remove_unit(*ptr);
		}
		updater->remove(*ptr);
		delete (*ptr);
	}
	_spawners.clear();
	_smf_nodes.clear();
	_inited = false;
	_lock.unlock();
}
开发者ID:srdgame,项目名称:srdgame,代码行数:22,代码来源:spawnermgr.cpp


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