You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* Multicast delegate Add* calls now return FDelegateHandles, and Remove* calls are now all deprecated, except for a new Remove function which takes a FDelegateHandle. * New FConsoleManager::RegisterConsoleVariableSink_Handle and UnregisterConsoleVariableSink_Handle functions which work in terms of FConsoleVariableSinkHandle. * Timer calls which don't take FTimerHandles are deprecated. * FTicker::AddTicker now returns an FDelegateHandle and is removed by an overloaded Remove function. * DEFINE_ONLINE_DELEGATE* macros now define _Handle variants of the Add/Remove functions which return/take handles. * Various other handle-based registration changes. * Some unity build fixes. * Some simplification of delegate code. * Fixes for lots of existing code to use handle-based registration and unregistration. #codereview robert.manuszewski [CL 2400883 by Steve Robb in Main branch]
56 lines
1.8 KiB
C++
56 lines
1.8 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include <errno.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/types.h>
|
|
#include <sys/inotify.h>
|
|
|
|
#define EVENT_SIZE ( sizeof (struct inotify_event) )
|
|
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
|
|
|
|
class FDirectoryWatchRequestLinux
|
|
{
|
|
public:
|
|
FDirectoryWatchRequestLinux();
|
|
virtual ~FDirectoryWatchRequestLinux();
|
|
|
|
/** Sets up the directory handle and request information */
|
|
bool Init(const FString& InDirectory);
|
|
|
|
/** Adds a delegate to get fired when the directory changes */
|
|
FDelegateHandle AddDelegate( const IDirectoryWatcher::FDirectoryChanged& InDelegate );
|
|
/** Removes a delegate to get fired when the directory changes */
|
|
DELEGATE_DEPRECATED("This overload of RemoveDelegate is deprecated, instead pass the result of AddDelegate.")
|
|
bool RemoveDelegate( const IDirectoryWatcher::FDirectoryChanged& InDelegate );
|
|
/** Same as above, but for use within other deprecated calls to prevent multiple deprecation warnings */
|
|
bool DEPRECATED_RemoveDelegate( const IDirectoryWatcher::FDirectoryChanged& InDelegate );
|
|
/** Removes a delegate to get fired when the directory changes */
|
|
bool RemoveDelegate( FDelegateHandle InHandle );
|
|
/** Returns true if this request has any delegates listening to directory changes */
|
|
bool HasDelegates() const;
|
|
/** Prepares the request for deletion */
|
|
void EndWatchRequest();
|
|
/** Triggers all pending file change notifications */
|
|
void ProcessPendingNotifications();
|
|
|
|
private:
|
|
|
|
FString Directory;
|
|
|
|
bool bRunning;
|
|
bool bEndWatchRequestInvoked;
|
|
|
|
int FileDescriptor;
|
|
int * WatchDescriptor;
|
|
int NotifyFilter;
|
|
|
|
TArray<FString> AllFiles;
|
|
TArray<IDirectoryWatcher::FDirectoryChanged> Delegates;
|
|
TArray<FFileChangeData> FileChanges;
|
|
|
|
void Shutdown();
|
|
void ProcessChanges();
|
|
};
|