summaryrefslogtreecommitdiff
path: root/SkinEngine/src/xml_cache.h
diff options
context:
space:
mode:
Diffstat (limited to 'SkinEngine/src/xml_cache.h')
-rw-r--r--SkinEngine/src/xml_cache.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/SkinEngine/src/xml_cache.h b/SkinEngine/src/xml_cache.h
new file mode 100644
index 0000000..50e30e0
--- /dev/null
+++ b/SkinEngine/src/xml_cache.h
@@ -0,0 +1,50 @@
+#ifndef xml_cache_h__
+#define xml_cache_h__
+
+class CXmlCache
+{
+private:
+ struct CachedFile
+ {
+ TCHAR *path;
+ HXML hXmlRoot;
+
+ CachedFile(const TCHAR *path, bool load=true);
+ ~CachedFile();
+
+ static int cmp(const CachedFile *p1, const CachedFile *p2)
+ {
+ return lstrcmp(p1->path, p2->path);
+ }
+ };
+
+ struct CachedClass
+ {
+ const TCHAR *name;
+ CachedFile *file;
+ HXML hXml;
+
+ static int cmp(const CachedClass *p1, const CachedClass *p2)
+ {
+ return lstrcmp(p1->name, p2->name);
+ }
+ };
+
+ OBJLIST<CachedClass> m_classes;
+ OBJLIST<CachedFile> m_files;
+
+ void RegisterClass(const TCHAR *name, CachedFile *file, HXML hXmlClass);
+
+public:
+ CXmlCache();
+ ~CXmlCache();
+
+ void LoadXmlFile(const TCHAR *path);
+ void UnloadXmlFile(const TCHAR *path);
+
+ ISkinElement *CreateObject(const TCHAR *name);
+};
+
+extern CXmlCache g_XmlCache;
+
+#endif // xml_cache_h__