fswatch  1.14.0
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  public:
53  windows_monitor(std::vector<std::string> paths,
55  void *context = nullptr);
56 
60  virtual ~windows_monitor();
61 
62  protected:
70  void run();
71 
72  private:
73  windows_monitor(const windows_monitor& orig) = delete;
74  windows_monitor& operator=(const windows_monitor& that) = delete;
75 
76  void configure_monitor();
77  void initialize_windows_path_list();
78  void initialize_events();
79  bool init_search_for_path(const std::wstring path);
80  void stop_search_for_path(const std::wstring path);
81  void process_path(const std::wstring& path);
82  bool is_path_watched(std::wstring path);
83 
84  // initial load
85  windows_monitor_load *load;
86  };
87 }
88 
89 #endif /* FSW_WINDOWS_MONITOR_H */
void * context
Pointer to context data that will be passed to the monitor::callback.
Definition: monitor.hpp:542
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.
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:522
Windows monitor.
Definition: windows_monitor.hpp:47
FSW_EVENT_CALLBACK * callback
Callback to which change events should be notified.
Definition: monitor.hpp:537
void FSW_EVENT_CALLBACK(const std::vector< event > &, void *)
Function definition of an event callback.
Definition: monitor.hpp:60