You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb none #lockdown Nick.Penwarden #ROBOMERGE-OWNER: ryan.gerleve #ROBOMERGE-AUTHOR: ben.marsh #ROBOMERGE-SOURCE: CL 4662404 in //UE4/Main/... #ROBOMERGE-BOT: ENGINE (Main -> Dev-Networking) [CL 4662413 by ben marsh in Dev-Networking branch]
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GenericPlatform/GenericPlatformFile.h"
|
|
|
|
|
|
/**
|
|
* Helper class for MakeDirectoryVisitor
|
|
*/
|
|
template <class FunctorType>
|
|
class FunctorDirectoryVisitor : public IPlatformFile::FDirectoryVisitor
|
|
{
|
|
public:
|
|
/**
|
|
* Pass a directory or filename on to the user-provided functor
|
|
* @param FilenameOrDirectory Full path to a file or directory
|
|
* @param bIsDirectory Whether the path refers to a file or directory
|
|
* @return Whether to carry on iterating
|
|
*/
|
|
virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory) override
|
|
{
|
|
return Functor(FilenameOrDirectory, bIsDirectory);
|
|
}
|
|
|
|
/**
|
|
* Move the provided functor into this object
|
|
*/
|
|
FunctorDirectoryVisitor(FunctorType&& FunctorInstance)
|
|
: Functor(MoveTemp(FunctorInstance))
|
|
{
|
|
}
|
|
|
|
private:
|
|
/** User-provided functor */
|
|
FunctorType Functor;
|
|
};
|
|
|
|
/**
|
|
* Convert a C++ functor into a IPlatformFile visitor object
|
|
* @param FunctorInstance Function object to call for each directory item
|
|
* @return Visitor object to be passed to platform directory visiting functions
|
|
*/
|
|
template <class Functor>
|
|
FunctorDirectoryVisitor<Functor> MakeDirectoryVisitor(Functor&& FunctorInstance)
|
|
{
|
|
return FunctorDirectoryVisitor<Functor>(MoveTemp(FunctorInstance));
|
|
}
|