PFileWatcher.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 #include <PString.h>
18 
19 PAPILLON_BEGIN_NAMESPACE
20 
24 typedef void (*PCallback_FileChanged)(const PString&);
25 
32 class PAPILLON_API_CORE PFileWatcher : public PObject
33 {
34 public:
39  PFileWatcher(const PString& filename = PString::Empty(), papillon::int32 watchTimeMs = 1000);
40 
44  PFileWatcher(const PFileWatcher& other);
45 
49  virtual ~PFileWatcher();
50 
54  PFileWatcher& operator=(const PFileWatcher& other);
55 
59  bool operator==(const PFileWatcher& other) const;
60 
64  void SetPeriodMs(papillon::int32 watchTimeMs);
65 
69  void SetFilename(PString& filename);
70 
75  void AddListener(PCallback_FileChanged callback);
76 
80  void RemoveListener(PCallback_FileChanged callback);
81 };
82 
83 PAPILLON_END_NAMESPACE
The PString class provides an Unicode character strings.
Definition: PString.h:37
PAPILLON_BEGIN_NAMESPACE typedef void(* PCallback_FileChanged)(const PString &)
Callback to be notified when a change occurs on a file.
Definition: PFileWatcher.h:24
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
Class PString: an unicode character strings (use copy-on-write idiom).
static const PString & Empty()
Returns the constant holding the empty string "".
Definition: PString.h:64
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45
The PFileWatcher class allows monitoring files for changes (listeners are notified each time the spec...
Definition: PFileWatcher.h:32