summaryrefslogtreecommitdiff
path: root/indra/llcommon/lllivefile.h
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2007-01-02 08:33:20 +0000
committerJames Cook <james@lindenlab.com>2007-01-02 08:33:20 +0000
commit420b91db29485df39fd6e724e782c449158811cb (patch)
treeb471a94563af914d3ed3edd3e856d21cb1b69945 /indra/llcommon/lllivefile.h
Print done when done.
Diffstat (limited to 'indra/llcommon/lllivefile.h')
-rw-r--r--indra/llcommon/lllivefile.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/llcommon/lllivefile.h b/indra/llcommon/lllivefile.h
new file mode 100644
index 0000000000..97c88a5c5c
--- /dev/null
+++ b/indra/llcommon/lllivefile.h
@@ -0,0 +1,34 @@
+/**
+ * @file lllivefile.h
+ * @brief Automatically reloads a file whenever it changes or is removed.
+ *
+ * Copyright (c) 2006-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+#ifndef LL_LLLIVEFILE_H
+#define LL_LLLIVEFILE_H
+
+#include "llframetimer.h"
+
+class LLLiveFile
+{
+public:
+ LLLiveFile(const std::string &filename, const F32 refresh_period = 5.f);
+ virtual ~LLLiveFile();
+
+ bool checkAndReload(); // Returns true if the file changed in any way
+
+protected:
+ virtual void loadFile() = 0; // Implement this to load your file if it changed
+
+ bool mForceCheck;
+ F32 mRefreshPeriod;
+ LLFrameTimer mRefreshTimer;
+
+ std::string mFilename;
+ time_t mLastModTime;
+ bool mLastExists;
+};
+
+#endif //LL_LLLIVEFILE_H