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


C++ CSession::getMinNextlistRevision方法代码示例

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


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

示例1: restoreSession

void CDataBaseTest::restoreSession() {
	saveSession();

	bool ok = true;
	CSession* restoredSession;
	m_stateDB->open();
	try {
		restoredSession = new CSession();
		m_stateDB->restoreSession(restoredSession);
	}
	catch(...) {
		ok = false;
	}

	int reMinColRev = restoredSession->getMinCollectionRevision();
	int minColRev = m_session->getMinCollectionRevision();
	if(reMinColRev != minColRev) {
		ok = false;
		cout << "restored min Collection Revision does not match original one." << endl;
	}

	int reMaxColRev = restoredSession->getCollectionRevision();
	int maxColRev = m_session->getCollectionRevision();
	if(reMaxColRev != maxColRev) {
		ok = false;
		cout << "restored max Collection Revision does not match original one." << endl;
	}

	int reMinPlRev = restoredSession->getMinPlaylistRevision();
	int minPlRev = m_session->getMinPlaylistRevision();
	if(reMinPlRev != minPlRev) {
		ok = false;
		cout << "restored min Playlist Revision does not match original one." << endl;
	}

	int reMaxPlRev = restoredSession->getPlaylistRevision();
	int maxPlRev = m_session->getPlaylistRevision();
	if(reMaxPlRev != maxPlRev) {
		ok = false;
		cout << "restored max Playlist Revision does not match original one." << endl;
	}

	int reMinNlRev = restoredSession->getMinNextlistRevision();
	int minNlRev = m_session->getMinNextlistRevision();
	if(reMinNlRev != minNlRev) {
		ok = false;
		cout << "restored min Nextlist Revision does not match original one." << endl;
	}

	int reMaxNlRev = restoredSession->getNextlistRevision();
	int maxNlRev = m_session->getNextlistRevision();
	if(reMaxNlRev != maxNlRev) {
		ok = false;
		cout << "restored max Nextlist Revision does not match original one." << endl;
	}

	for(int colRev = minColRev; colRev <= maxColRev; colRev++ ) {
		CCollection<CCollectionItem>* col = m_session->getCollection(colRev);
		CCollection<CCollectionItem>* reCol = restoredSession->getCollection(colRev);

		CPPUNIT_ASSERT( reCol != 0 );

		if(col->size() != reCol->size() ) ok = false;

		// CPPUNIT_ASSERT( reCol->size() > 0 );

		for(int i=0; i < col->size(); i++) {
			CCollectionItem* item = col->getItem(i);
			CCollectionItem* reItem = reCol->getItem(i);
			if(item->getAlbum().compare(reItem->getAlbum()) != 0 ) {
				ok = false;
				cout << "restored collection[" << i << "] Album does not match original one." << endl;
			}
			if(item->getArtist().compare(reItem->getArtist()) != 0 ) {
				ok = false;
				cout << "restored collection[" << i << "] Artist does not match original one." << endl;
			}
			if(item->getTitle().compare(reItem->getTitle()) != 0 ) {
				ok = false;
				cout << "restored collection[" << i << "] Title does not match original one." << endl;
			}
			if(item->getFilename().compare(reItem->getFilename()) != 0 ) {
				ok = false;
				cout << "restored collection[" << i << "] filename does not match original one." << endl;
			}
			if(item->getDuration() != reItem->getDuration() ) {
				ok = false;
				cout << "restored collection[" << i << "] Duration does not match original one." << endl;
			}
			if(item->getYear() != reItem->getYear() ) {
				ok = false;
				cout << "restored collection[" << i << "] Year does not match original one." << endl;
			}
		}
	}

	for(int plRev = minPlRev; plRev < maxPlRev; plRev++ ) {
		CCollection<CPlaylistItem>* pl = m_session->getPlaylist(plRev);
		CCollection<CPlaylistItem>* rePl = restoredSession->getPlaylist(plRev);

//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:muroa-svn,代码行数:101,代码来源:CDataBaseTest.cpp


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