summaryrefslogtreecommitdiff
path: root/src/FbTk/AutoReloadHelper.hh
diff options
context:
space:
mode:
authorHenrik Kinnunen <fluxgen@fluxbox.org>2008-05-13 15:07:30 (GMT)
committerHenrik Kinnunen <fluxgen@fluxbox.org>2008-05-13 15:07:30 (GMT)
commit7f45bae4629f345906e96c1fcb3a3d1e49c36382 (patch)
treeb09708632d29ac4471c57446eb726e5401c8570f /src/FbTk/AutoReloadHelper.hh
parent5ecebae4770cbe7e4feea46d2c074a818f1c9662 (diff)
parentd7aa526d9275f7c94f0b1ce27464eaf3dae0d78d (diff)
downloadfluxbox_lack-7f45bae4629f345906e96c1fcb3a3d1e49c36382.zip
fluxbox_lack-7f45bae4629f345906e96c1fcb3a3d1e49c36382.tar.bz2
Merge branch 'master' of fluxbox@git.fluxbox.org:fluxbox
Diffstat (limited to 'src/FbTk/AutoReloadHelper.hh')
-rw-r--r--src/FbTk/AutoReloadHelper.hh54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/FbTk/AutoReloadHelper.hh b/src/FbTk/AutoReloadHelper.hh
new file mode 100644
index 0000000..36be8f1
--- /dev/null
+++ b/src/FbTk/AutoReloadHelper.hh
@@ -0,0 +1,54 @@
1// AutoReloadHelper.hh
2// Copyright (c) 2008 Fluxbox Team (fluxgen at fluxbox dot org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#ifndef AUTORELOADHELPER_HH
23#define AUTORELOADHELPER_HH
24
25#include <map>
26#include <string>
27#include <sys/types.h>
28
29#include "Command.hh"
30#include "RefCount.hh"
31
32namespace FbTk {
33
34class AutoReloadHelper {
35public:
36
37 void setMainFile(std::string filename);
38 void addFile(std::string filename);
39 void setReloadCmd(RefCount<Command<void> > cmd) { m_reload_cmd = cmd; }
40
41 void checkReload();
42 void reload();
43
44private:
45 RefCount<Command<void> > m_reload_cmd;
46 std::string m_main_file;
47
48 typedef std::map<std::string, time_t> TimestampMap;
49 TimestampMap m_timestamps;
50};
51
52} // end namespace FbTk
53
54#endif // AUTORELOADHELPER_HH