summaryrefslogtreecommitdiff
path: root/tools.h
diff options
context:
space:
mode:
authorSascha Volkenandt <sascha (at) akv-soft (dot) de>2007-01-05 19:38:54 +0000
committerSascha Volkenandt <sascha (at) akv-soft (dot) de>2007-01-05 19:38:54 +0000
commit45fe6c4b0efcd807dd67bb1bcdc5e104583332ae (patch)
tree3cc0e5741faf0c75497ca216d07def2924c4b13d /tools.h
parent14bb52978b82dcb82904cf42d7f33b6a7543f618 (diff)
downloadvdr-plugin-live-45fe6c4b0efcd807dd67bb1bcdc5e104583332ae.tar.gz
vdr-plugin-live-45fe6c4b0efcd807dd67bb1bcdc5e104583332ae.tar.bz2
- moved pagelib back to plugin
- incorporated all code into one shared object
Diffstat (limited to 'tools.h')
-rw-r--r--tools.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools.h b/tools.h
new file mode 100644
index 0000000..c39075b
--- /dev/null
+++ b/tools.h
@@ -0,0 +1,31 @@
+#ifndef VDR_LIVE_TOOLS_H
+#define VDR_LIVE_TOOLS_H
+
+#include <ctime>
+#include <string>
+#include <vdr/thread.h>
+
+namespace vdrlive {
+
+std::string FormatDateTime( char const* format, time_t time );
+std::string StringReplace( std::string const& text, std::string const& substring, std::string const& replacement );
+
+class ReadLock
+{
+public:
+ ReadLock( cRwLock& lock, int timeout = 100 ): m_lock( lock ), m_locked( false ) { if ( m_lock.Lock( false, timeout ) ) m_locked = true; }
+ ~ReadLock() { if ( m_locked ) m_lock.Unlock(); }
+
+ operator bool() { return m_locked; }
+ bool operator!() { return !m_locked; }
+
+private:
+ ReadLock( ReadLock const& );
+
+ cRwLock& m_lock;
+ bool m_locked;
+};
+
+} // namespace vdrlive
+
+#endif // VDR_LIVE_TOOLS_H