fswatch 1.17.1
event.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014-2015 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_EVENT_H
27# define FSW_EVENT_H
28
29# include <string>
30# include <ctime>
31# include <vector>
32# include <iostream>
33# include "../c/cevent.h"
34
35namespace fsw
36{
47 class event
48 {
49 public:
57 event(std::string path, time_t evt_time, std::vector<fsw_event_flag> flags);
58
64 virtual ~event();
65
71 std::string get_path() const;
72
78 time_t get_time() const;
79
85 std::vector<fsw_event_flag> get_flags() const;
86
94 static fsw_event_flag get_event_flag_by_name(const std::string& name);
95
103 static std::string get_event_flag_name(const fsw_event_flag& flag);
104
105 private:
106 std::string path;
107 time_t evt_time;
108 std::vector<fsw_event_flag> evt_flags;
109 };
110
118 std::ostream& operator<<(std::ostream& out, const fsw_event_flag flag);
119}
120
121#endif /* FSW_EVENT_H */
fsw_event_flag
Backend-agnostic change flags.
Definition: cevent.h:64
Type representing a file change event.
Definition: event.hpp:48
time_t get_time() const
Returns the time of the event.
Definition: event.cpp:37
event(std::string path, time_t evt_time, std::vector< fsw_event_flag > flags)
Constructs an event.
Definition: event.cpp:25
static std::string get_event_flag_name(const fsw_event_flag &flag)
Get the name of an event flag.
Definition: event.cpp:77
std::string get_path() const
Returns the path of the event.
Definition: event.cpp:32
std::vector< fsw_event_flag > get_flags() const
Returns the flags of the event.
Definition: event.cpp:42
virtual ~event()
Destructs an event.
static fsw_event_flag get_event_flag_by_name(const std::string &name)
Get event flag by name.
Definition: event.cpp:47
Main namespace of libfswatch.
Definition: event.cpp:24