summaryrefslogtreecommitdiff
path: root/skinengine/src/xml_cache.cpp
diff options
context:
space:
mode:
authorwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-04-21 14:14:52 +0000
committerwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-04-21 14:14:52 +0000
commitcb4a46e7fbe62d788e66ed6121c717a2d22a4d7c (patch)
tree30df260fdc5a1b5a7049c2f8cac8b7ef17513d6d /skinengine/src/xml_cache.cpp
parent19b6f534d2e784a1e120bf52c4aa07004798f473 (diff)
svn.miranda.im is moving to a new home!
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@7 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'skinengine/src/xml_cache.cpp')
-rw-r--r--skinengine/src/xml_cache.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/skinengine/src/xml_cache.cpp b/skinengine/src/xml_cache.cpp
new file mode 100644
index 0000000..136d257
--- /dev/null
+++ b/skinengine/src/xml_cache.cpp
@@ -0,0 +1,71 @@
+#include "headers.h"
+
+CXmlCache g_XmlCache;
+
+CXmlCache::CachedFile::CachedFile(const TCHAR *path, bool load)
+{
+ this->path = _tcsdup(path);
+ if (load)
+ {
+ } else
+ {
+ hXmlRoot = NULL;
+ }
+}
+
+CXmlCache::CachedFile::~CachedFile()
+{
+ free(path);
+ if (hXmlRoot) xi.destroyNode(hXmlRoot);
+}
+
+CXmlCache::CXmlCache(): m_files(5, CachedFile::cmp), m_classes(10, CachedClass::cmp)
+{
+}
+
+CXmlCache::~CXmlCache()
+{
+}
+
+void CXmlCache::LoadXmlFile(const TCHAR *path)
+{
+ CachedFile *file = new CachedFile(path);
+ if (!file->hXmlRoot)
+ {
+ delete file;
+ return;
+ }
+
+ int count = xi.getChildCount(file->hXmlRoot);
+ for (int i = 0; i < count; ++i)
+ {
+ HXML hXml = xi.getChild(file->hXmlRoot, i);
+ if (!hXml) break;
+
+ const TCHAR *tagName = xi.getName(hXml);
+ if (!tagName || lstrcmp(tagName, _T("class"))) continue;
+
+ const TCHAR *className = xi.getAttrValue(hXml, _T("name"));
+ if (!className) continue;
+
+ RegisterClass(className, file, hXml);
+ }
+}
+
+void CXmlCache::UnloadXmlFile(const TCHAR *path)
+{
+}
+
+void CXmlCache::RegisterClass(const TCHAR *name, CachedFile *file, HXML hXmlClass)
+{
+ CachedClass *cls = new CachedClass;
+ cls->name = name;
+ cls->file = file;
+ cls->hXml = hXmlClass;
+ m_classes.insert(cls);
+}
+
+ISkinElement *CXmlCache::CreateObject(const TCHAR *name)
+{
+ return NULL;
+}