Source

NPAPI-chrome-file-api / X11 / FileWatcherTaskX11.h

Full commit
/*
 * FileWatcherTaskX11.h
 *
 *  Created on: 22/05/2012
 *      Author: ryan
 */

#ifndef FILEWATCHERTASKX11_H_
#define FILEWATCHERTASKX11_H_
#define BOOST_FILESYSTEM_VERSION 3

#include "JSObject.h"
#include <boost/filesystem.hpp>

class FileWatcherTaskX11 {
public:
	FileWatcherTaskX11(){stop = 0;};
	~FileWatcherTaskX11(){};
	void Watch(boost::filesystem::path path, FB::JSObjectPtr callback);
	void StopWatching();

private:
	void ListenForFileEvents(boost::filesystem::path path, FB::JSObjectPtr callback);
	void AddWatchToDir(int fd, boost::filesystem::path path, std::map<int, boost::filesystem::path*> &watchDescriptors);
	bool _ShouldStop();
	int stop;
};

#endif /* FILEWATCHERTASKX11_H_ */