diff --git a/dlls/nvault/hash.cpp b/dlls/nvault/hash.cpp
index 92879c89..d58176ae 100755
--- a/dlls/nvault/hash.cpp
+++ b/dlls/nvault/hash.cpp
@@ -104,6 +104,11 @@ void HashTable::Clear()
}
}
+bool HashTable::KeyExists(const char *key)
+{
+ return _FindNode(key, false);
+}
+
////////////////////
// Iterator stuff //
////////////////////
@@ -209,7 +214,7 @@ void HashTable::_Unlink(HashTable::htNodeSet *set, HashTable::htNode *node)
}
//Finds a node by key
-HashTable::htNode *HashTable::_FindNode(const char *key)
+HashTable::htNode *HashTable::_FindNode(const char *key, bool autoMake)
{
HashTable::htNodeSet *set;
HashTable::htNode *node;
@@ -224,7 +229,10 @@ HashTable::htNode *HashTable::_FindNode(const char *key)
node = node->next;
}
- return _InsertIntoNodeSet(set, key, true);
+ if (autoMake)
+ return _InsertIntoNodeSet(set, key, true);
+
+ return NULL;
}
//Inserts a new set of data into a bucket
diff --git a/dlls/nvault/hash.h b/dlls/nvault/hash.h
index 5d9d2b0f..2f1548db 100755
--- a/dlls/nvault/hash.h
+++ b/dlls/nvault/hash.h
@@ -42,6 +42,7 @@ public: //PUBLIC FUNCTIONS
iterator Enumerate();
size_t Prune(time_t begin, time_t end, bool all=false);
void Clear();
+ bool KeyExists(const char *key);
public: //PUBLIC CLASSES
class iterator
{
@@ -62,7 +63,7 @@ public: //PUBLIC CLASSES
};
private: //PRIVATE API
void _Insert(const char *key, const char *val, time_t stamp);
- htNode *_FindNode(const char *key);
+ htNode *_FindNode(const char *key, bool autoMake=true);
htNodeSet *_FindNodeSet(const char *key);
htNode *_InsertIntoNodeSet(htNodeSet *set, const char *key, bool skip=false);
void _Unlink(htNodeSet *set, htNode *node);
diff --git a/dlls/nvault/nvault.cpp b/dlls/nvault/nvault.cpp
new file mode 100755
index 00000000..97966a05
--- /dev/null
+++ b/dlls/nvault/nvault.cpp
@@ -0,0 +1,2 @@
+#include "nvault.h"
+
diff --git a/dlls/nvault/nvault.h b/dlls/nvault/nvault.h
new file mode 100755
index 00000000..67199adf
--- /dev/null
+++ b/dlls/nvault/nvault.h
@@ -0,0 +1,53 @@
+#ifndef _INCLUDE_NVAULT_H
+#define _INCLUDE_NVAULT_H
+
+#include "sdk/CString.h"
+#include "hash.h"
+
+class Journal
+{
+public:
+ enum JournalOp
+ {
+ Journal_Store,
+ Journal_Erase,
+ Journal_Clear,
+ Journal_Prune
+ };
+public:
+ Journal(const char *file);
+public:
+ bool Replay(size_t &files, size_t &ops);
+ void Clear();
+public:
+ void Begin(const char *name, JournalOp jop);
+ void WriteByte(uint8_t num);
+ void WriteInt(uint32_t num);
+ void WriteTime(time_t n);
+ void WriteString(const char *str);
+ size_t End();
+private:
+ String m_File;
+ FILE *m_Fp;
+ size_t m_WriteSize;
+};
+
+class nVault
+{
+public:
+ nVault(const char *name);
+public:
+ bool WriteToFile();
+ bool ReadFromFile();
+public:
+ void Store(const char *key, const char *value, bool temporary=true);
+ size_t Prune(time_t begin, time_t end, bool all=false);
+ HashTable::htNode *Find(const char *key);
+ bool KeyExists(const char *key);
+ void Clear();
+private:
+ String m_File;
+ HashTable *m_Vault;
+};
+
+#endif //_INCLUDE_NVAULT_H
diff --git a/dlls/nvault/nvault.vcproj b/dlls/nvault/nvault.vcproj
index 45034268..0cc035d4 100755
--- a/dlls/nvault/nvault.vcproj
+++ b/dlls/nvault/nvault.vcproj
@@ -118,6 +118,9 @@
+
+
+
+