Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Classes | Public Types | Public Member Functions | List of all members
jop::DirectoryWatcher Class Reference

#include <DirectoryWatcher.hpp>

Classes

struct  Info
 

Public Types

typedef std::function< void(Info)> EventCallback
 

Public Member Functions

 DirectoryWatcher ()
 Constructor. More...
 
 DirectoryWatcher (const std::string &dir, EventCallback callback)
 Overloaded constructor. More...
 
 ~DirectoryWatcher ()
 Destructor. More...
 
bool start (const std::string &dir, EventCallback callback)
 Start watching a directory. More...
 
void stop ()
 Stop watching a directory. More...
 
void setActive (const bool active)
 Set this watcher active/inactive. More...
 
bool isActive () const
 Check if this watcher is active. More...
 
bool hasError () const
 Check if this watcher is in an error condition. More...
 

Detailed Description

Definition at line 41 of file DirectoryWatcher.hpp.

Member Typedef Documentation

typedef std::function<void(Info)> jop::DirectoryWatcher::EventCallback

File change event callback

Definition at line 67 of file DirectoryWatcher.hpp.

Constructor & Destructor Documentation

jop::DirectoryWatcher::DirectoryWatcher ( )

Constructor.

Won't start observing any directory.

jop::DirectoryWatcher::DirectoryWatcher ( const std::string &  dir,
EventCallback  callback 
)

Overloaded constructor.

Calls start() with the given arguments.

Parameters
dirThe directory to start watching
callbackThe event callback
jop::DirectoryWatcher::~DirectoryWatcher ( )

Destructor.

Member Function Documentation

bool jop::DirectoryWatcher::hasError ( ) const

Check if this watcher is in an error condition.

Returns
True if this watcher has an error
bool jop::DirectoryWatcher::isActive ( ) const

Check if this watcher is active.

Returns
True if active
void jop::DirectoryWatcher::setActive ( const bool  active)

Set this watcher active/inactive.

Parameters
activeTrue to set active
bool jop::DirectoryWatcher::start ( const std::string &  dir,
EventCallback  callback 
)

Start watching a directory.

Calls stop() before opening the new directory.

Parameters
dirThe directory to start watching
callbackThe event callback
Returns
True if the directory was opened successfully
void jop::DirectoryWatcher::stop ( )

Stop watching a directory.


The documentation for this class was generated from the following file: