Beispiel #1
0
//==============================================================================
// CatalogSet::addFile
//
//==============================================================================
void CatalogSet::addFile(const URL& catalogFile, const CatalogFile* pFrom)
{
	//
	// Test if the file already exists in our set.  If so, it 
	// cannot be allowed in because it would imply one of
	// a) A duplicate nextCatalog element
	// b) A circular nextCatalog reference
	//

	CatalogFiles::const_iterator i=m_catalogFiles.begin();
	for(; i!=m_catalogFiles.end(); ++i)
	{
		const AutoPtr<CatalogFile>& rpCatalogFile = *i;
		if(rpCatalogFile->getURL().sameFile(catalogFile))
		{
			// Error! duplicate
			CatalogEventHandler* pHandler = getResolver().getEventHandler();
			if(pHandler)
			{
				String errMsg = QC_T("the catalog entry file: ");
				errMsg += catalogFile.toExternalForm();
				errMsg += QC_T(" is already contained in the set of catalog files");
				String fileName;
				if(pFrom)
				{
					fileName = pFrom->getURL().getFile();
				}
				pHandler->onCatalogError(CatalogEventHandler::Error, 0, errMsg, fileName, 0, 0);
			}
			return;
		}
	}

	AutoPtr<CatalogFile> rpNewFile(new CatalogFile(catalogFile, *this));
	m_catalogFiles.push_back(rpNewFile);
}
void PlatformDomainNameAddressQuery::run() {
	getResolver()->addQueryToQueue(shared_from_this());
}