summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_xml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG/src/jabber_xml.cpp')
-rw-r--r--protocols/JabberG/src/jabber_xml.cpp188
1 files changed, 0 insertions, 188 deletions
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp
index bd0fbe08eb..f2336123c7 100644
--- a/protocols/JabberG/src/jabber_xml.cpp
+++ b/protocols/JabberG/src/jabber_xml.cpp
@@ -199,191 +199,3 @@ int XmlGetChildCount(const TiXmlElement *hXml)
}
return iCount;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-void XPath::ProcessPath(LookupInfo &info)
-{
- if (!info.nodeName) return;
-
- char *nodeName = (char *)alloca(sizeof(char) * (info.nodeName.length+1));
- mir_strncpy(nodeName, info.nodeName.p, info.nodeName.length+1);
-
- if (info.attrName && info.attrValue) {
- char *attrName = (char *)alloca(sizeof(char)* (info.attrName.length + 1));
- mir_strncpy(attrName, info.attrName.p, info.attrName.length + 1);
- char *attrValue = (char *)alloca(sizeof(char)* (info.attrValue.length + 1));
- mir_strncpy(attrValue, info.attrValue.p, info.attrValue.length + 1);
- m_hXml = XmlGetChildByTag(m_hXml, nodeName, attrName, attrValue);
- }
- else m_hXml = m_hXml->FirstChildElement(nodeName);
-
- info.Reset();
-}
-
-XPath::PathType XPath::LookupImpl()
-{
- LookupState state = S_START;
- LookupInfo info = {};
-
- for (const char *p = m_szPath; state < S_FINAL; ++p) {
- switch (state) {
- case S_START:
- ProcessPath(info);
- if (!m_hXml) {
- state = S_FINAL_ERROR;
- break;
- }
-
- switch (*p) {
- case 0:
- state = S_FINAL_ERROR;
- break;
- case '@':
- info.attrName.Begin(p + 1);
- state = S_ATTR_STEP;
- break;
- case '/':
- break;
- default:
- info.nodeName.Begin(p);
- state = S_NODE_NAME;
- break;
- };
- break;
-
- case S_ATTR_STEP:
- switch (*p) {
- case 0:
- info.attrName.End(p);
- state = S_FINAL_ATTR;
- break;
- default:
- break;
- };
- break;
-
- case S_NODE_NAME:
- switch (*p) {
- case 0:
- info.nodeName.End(p);
- state = S_FINAL_NODESET;
- break;
- case '[':
- info.nodeName.End(p);
- state = S_NODE_OPENBRACKET;
- break;
- case '/':
- info.nodeName.End(p);
- state = S_START;
- break;
- default:
- break;
- };
- break;
-
- case S_NODE_OPENBRACKET:
- switch (*p) {
- case 0:
- state = S_FINAL_ERROR;
- break;
- case '@':
- info.attrName.Begin(p + 1);
- state = S_NODE_ATTRNAME;
- break;
- default:
- state = S_FINAL_ERROR;
- break;
- };
- break;
-
- case S_NODE_ATTRNAME:
- switch (*p) {
- case 0:
- state = S_FINAL_ERROR;
- break;
- case '=':
- info.attrName.End(p);
- state = S_NODE_ATTREQUALS;
- break;
- default:
- break;
- };
- break;
-
- case S_NODE_ATTREQUALS:
- switch (*p) {
- case 0:
- state = S_FINAL_ERROR;
- break;
- case '\'':
- info.attrValue.Begin(p + 1);
- state = S_NODE_ATTRVALUE;
- break;
- default:
- state = S_FINAL_ERROR;
- break;
- };
- break;
-
- case S_NODE_ATTRVALUE:
- switch (*p) {
- case 0:
- state = S_FINAL_ERROR;
- break;
- case '\'':
- info.attrValue.End(p);
- state = S_NODE_ATTRCLOSEVALUE;
- break;
- default:
- break;
- };
- break;
-
- case S_NODE_ATTRCLOSEVALUE:
- switch (*p) {
- case 0:
- state = S_FINAL_ERROR;
- break;
- case ']':
- state = S_NODE_CLOSEBRACKET;
- break;
- default:
- state = S_FINAL_ERROR;
- break;
- };
- break;
-
- case S_NODE_CLOSEBRACKET:
- switch (*p) {
- case 0:
- state = S_FINAL_NODE;
- break;
- case '/':
- state = S_START;
- break;
- default:
- state = S_FINAL_ERROR;
- break;
- };
- break;
- }
-
- if (!*p && (state < S_FINAL))
- state = S_FINAL_ERROR;
- }
-
- switch (state) {
- case S_FINAL_ATTR:
- m_szParam = info.attrName.p;
- return T_ATTRIBUTE;
- case S_FINAL_NODE:
- ProcessPath(info);
- return T_NODE;
- case S_FINAL_NODESET:
- m_szParam = info.nodeName.p;
- return T_NODESET;
- }
-
- return T_ERROR;
-}