// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Core/Delegate.h" #include "Engine/Core/NonCopyable.h" #include "Engine/Core/Types/String.h" /// /// Action types that file system watcher can listen for. /// enum class FileSystemAction { Unknown, Create, Delete, Modify, }; /// /// Base class for file system watcher objects. /// class FLAXENGINE_API FileSystemWatcherBase : public NonCopyable { protected: bool _isEnabled; bool _withSubDirs; String _directory; public: FileSystemWatcherBase(const String& directory, bool withSubDirs) : _isEnabled(true) , _withSubDirs(withSubDirs) , _directory(directory) { } /// /// Action fired when directory or file gets changed. Can be invoked from main or other thread depending on the platform. /// Delegate OnEvent; public: /// /// Gets the watcher directory string. /// /// The target directory path. const String& GetDirectory() const { return _directory; } /// /// Gets the value whenever watcher is tracking changes in subdirectories. /// /// True if watcher is tracking changes in subdirectories, otherwise false. bool WithSubDirs() const { return _withSubDirs; } /// /// Gets the current watcher enable state. /// /// True if watcher is enabled, otherwise false. bool GetEnabled() const { return _isEnabled; } /// /// Sets the current enable state. /// /// A state to assign. void SetEnabled(bool value) { _isEnabled = value; } };