libfswatch  1.9.3
windows_monitor.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2016 Enrico M. Crisostomo
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 3, or (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program. If not, see <http://www.gnu.org/licenses/>.
15  */
26 #ifndef FSW_WINDOWS_MONITOR_H
27 # define FSW_WINDOWS_MONITOR_H
28 
29 # include "monitor.hpp"
30 # include <string>
31 # include <vector>
32 
33 namespace fsw
34 {
39  struct windows_monitor_load;
40 
47  class windows_monitor : public monitor
48  {
49  REGISTER_MONITOR(windows_monitor, windows_monitor_type);
50 
51  public:
55  windows_monitor(std::vector<std::string> paths,
57  void *context = nullptr);
58 
62  virtual ~windows_monitor();
63 
64  protected:
72  void run();
73 
74  private:
75  windows_monitor(const windows_monitor& orig) = delete;
76  windows_monitor& operator=(const windows_monitor& that) = delete;
77 
78  void configure_monitor();
79  void initialize_windows_path_list();
80  void initialize_events();
81  bool init_search_for_path(const std::wstring path);
82  void stop_search_for_path(const std::wstring path);
83  void process_path(const std::wstring& path);
84  bool is_path_watched(std::wstring path);
85 
86  // initial load
87  windows_monitor_load *load;
88  };
89 }
90 
91 #endif /* FSW_WINDOWS_MONITOR_H */
void * context
Pointer to context data that will be passed to the monitor::callback.
Definition: monitor.hpp:553
Base class of all monitors.
Definition: monitor.hpp:146
Main namespace of libfswatch.
Definition: event.cpp:23
virtual ~windows_monitor()
Destroys an instance of this class.
Definition: cmonitor.h:49
void run()
Executes the monitor loop.
windows_monitor(std::vector< std::string > paths, FSW_EVENT_CALLBACK *callback, void *context=nullptr)
Constructs an instance of this class.
Header of the fsw::monitor class.
std::vector< std::string > paths
List of paths to watch.
Definition: monitor.hpp:533
Windows monitor.
Definition: windows_monitor.hpp:47
FSW_EVENT_CALLBACK * callback
Callback to which change events should be notified.
Definition: monitor.hpp:548
void FSW_EVENT_CALLBACK(const std::vector< event > &, void *)
Function definition of an event callback.
Definition: monitor.hpp:60