Esempio n. 1
0
void CopyFolder(const KString&	SrcFolderName,
				const KString&	DstFolderName,
				TFileFilter*	pFilter,
				void*			pFilterParam,
				bool			bExceptionOnFail)
{
	// Getting complete folder names
	const KString SrcName = SlashedFolderName(SrcFolderName);
	const KString DstName = SlashedFolderName(DstFolderName);
	
	// Creating destination folder
	TEST_BLOCK_BEGIN
	{
		CreateFolder(DstName);
	}
	TEST_BLOCK_EXCEPTION_HANDLER
	{
		if(bExceptionOnFail)
			throw 1;

		return;
	}
	TEST_BLOCK_END

	// Copying
	KStrings::TConstIterator Iter;
	
	// Copying folders
	KStrings Folders;
	EnlistFolders(SrcName + TEXT("*.*"), Folders, false);	

	for(Iter = Folders.GetFirst() ; Iter.IsValid() ; ++Iter)
	{
		if(pFilter == NULL || pFilter(SrcName + *Iter, false, pFilterParam))
		{
			TEST_BLOCK_BEGIN
			{
				CopyFolder(	SrcName + *Iter,
							DstName + *Iter,
							pFilter,
							pFilterParam,
							bExceptionOnFail);
			}
			TEST_BLOCK_EXCEPTION_HANDLER
			{
				if(bExceptionOnFail)
					throw 1;
			}
			TEST_BLOCK_END
		}
	}
Esempio n. 2
0
intrusive_ptr<DocumentSource> DocumentSourceFilter::createFromBson(
    BSONElement *pBsonElement,
    const intrusive_ptr<ExpressionContext> &pCtx) {
    uassert(15946, "a document filter expression must be an object",
            pBsonElement->type() == Object);

    Expression::ObjectCtx oCtx(0);
    intrusive_ptr<Expression> pExpression(
        Expression::parseObject(pBsonElement, &oCtx));
    intrusive_ptr<DocumentSourceFilter> pFilter(
        DocumentSourceFilter::create(pExpression, pCtx));

    return pFilter;
}