mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 15:02:50 +02:00
Lots of places hat casts from (const char*) to (char *) to silence
a "deprecated conversion" warning. Instead of casting (which is
inherently wrong), fix up the libxmltree interfaces.
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@117 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Branch: ni/coolstream
Commit: 8070a9613d
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2009-12-22 (Tue, 22 Dec 2009)
------------------
This commit was generated by Migit
157 lines
4.3 KiB
C++
157 lines
4.3 KiB
C++
/* xmltree.h
|
|
*
|
|
* XMLTree API header
|
|
*
|
|
* $Id: xmltree.h,v 1.1 2002/01/18 20:22:39 tmbinc Exp $
|
|
*
|
|
* Changelog:
|
|
* $Log: xmltree.h,v $
|
|
* Revision 1.1 2002/01/18 20:22:39 tmbinc
|
|
* initial checkin
|
|
*
|
|
* Revision 1.1.1.1 2001/10/07 13:01:15 tmbinc
|
|
* Import of ezap2-200110070
|
|
*
|
|
* Revision 1.4 1999/02/26 13:17:22 cvs
|
|
* - thousands of bugs fixed (really)
|
|
* - modifications in the XML part
|
|
* - added a new object for testing, cpiwButton (usable already, see
|
|
* win32/ts.cpp)
|
|
* - modified ts.cpp to create a pseudo-GUI again (for testing the
|
|
* buttons)
|
|
* - ts now exits on a click in the windows
|
|
* - ts has no titlebar anymore (will soon by replace by a special
|
|
* widget)
|
|
*
|
|
* (ryg)
|
|
*
|
|
* Revision 1.3 1999/01/25 18:05:27 cvs
|
|
* ARG! tmb, next time you look bevor you say shit, okay? (ryg)
|
|
*
|
|
* Revision 1.1 1999/01/24 16:01:15 cvs
|
|
* First release of the XMLTree API (ryg)
|
|
*
|
|
*/
|
|
|
|
#ifndef __XMLTREE_H
|
|
#define __XMLTREE_H
|
|
|
|
#include "xmlparse.h"
|
|
|
|
class XMLAttribute
|
|
{
|
|
private:
|
|
char *name, *value;
|
|
XMLAttribute *next, *prev;
|
|
|
|
public:
|
|
XMLAttribute();
|
|
XMLAttribute(char *nam, char *val);
|
|
XMLAttribute(XMLAttribute *prv, char *nam, char *val);
|
|
XMLAttribute(XMLAttribute *prv, char *nam, char *val, XMLAttribute *nxt);
|
|
~XMLAttribute();
|
|
|
|
char *GetName() { return name; }
|
|
char *GetValue() { return value; }
|
|
XMLAttribute *GetNext() { return next; }
|
|
XMLAttribute *GetPrevious() { return prev; }
|
|
|
|
void SetName(char *nam);
|
|
void SetValue(char *val);
|
|
void SetNext(XMLAttribute *nxt);
|
|
void SetPrevious(XMLAttribute *prv);
|
|
};
|
|
|
|
class XMLTreeNode
|
|
{
|
|
public:
|
|
// matching mode: case insensitive or case sensitive?
|
|
|
|
enum matchmode
|
|
{
|
|
MATCH_CASE = 0,
|
|
MATCH_NOCASE = 1
|
|
};
|
|
|
|
private:
|
|
XMLAttribute *attributes;
|
|
XMLTreeNode *next;
|
|
XMLTreeNode *child;
|
|
XMLTreeNode *parent;
|
|
|
|
char *type;
|
|
char *data;
|
|
unsigned int dataSize;
|
|
unsigned int pdataOff;
|
|
|
|
matchmode mmode;
|
|
|
|
public:
|
|
XMLTreeNode(XMLTreeNode *prnt);
|
|
XMLTreeNode(XMLTreeNode *prnt, char *typ);
|
|
XMLTreeNode(XMLTreeNode *prnt, char *typ, char *dta, unsigned int dtaSize);
|
|
XMLTreeNode(XMLTreeNode *prnt, char *typ, char *dta, unsigned int dtaSize, XMLTreeNode *cld);
|
|
XMLTreeNode(XMLTreeNode *prnt, char *typ, char *dta, unsigned int dtaSize, XMLTreeNode *cld, XMLTreeNode *nxt);
|
|
~XMLTreeNode();
|
|
|
|
// add modes: add the node as child or neighbour?
|
|
|
|
enum addmode
|
|
{
|
|
ADD_NEIGHBOUR = 0,
|
|
ADD_CHILD = 1
|
|
};
|
|
|
|
XMLTreeNode *GetNext() const { return next; }
|
|
XMLTreeNode *GetChild() const { return child; }
|
|
XMLTreeNode *GetParent() const { return parent; };
|
|
|
|
XMLAttribute *GetAttributes() const { return attributes; }
|
|
XMLAttribute *GetAttribute(const char *name) const;
|
|
char *GetAttributeValue(const char *name) const;
|
|
|
|
matchmode GetMatchingMode() const { return mmode; }
|
|
|
|
char *GetType() const { return type; }
|
|
char *GetData() const { return data; }
|
|
unsigned int GetDataSize() const { return dataSize; }
|
|
unsigned int GetPDataOff() const { return pdataOff; }
|
|
|
|
void AddNode(XMLTreeNode *node, addmode mode);
|
|
XMLTreeNode *AddNode(addmode mode);
|
|
|
|
void SetNext(XMLTreeNode *nxt);
|
|
void SetChild(XMLTreeNode *cld);
|
|
void SetParent(XMLTreeNode *prnt);
|
|
|
|
void SetAttribute(char *name, char *value);
|
|
void SetType(char *typ);
|
|
void SetData(char *dat, unsigned int datSize);
|
|
void AppendData(char *dat, unsigned int datSize);
|
|
void SetPDataOff(int pdo);
|
|
|
|
void SetMatchingMode(matchmode mode);
|
|
|
|
void DeleteAttribute(char *name);
|
|
void DeleteAttributes();
|
|
void DeleteChildren();
|
|
};
|
|
|
|
class XMLTreeParser:public XML_Parser
|
|
{
|
|
protected:
|
|
XMLTreeNode *root, *current;
|
|
|
|
virtual void StartElementHandler(const XML_Char *name, const XML_Char **atts);
|
|
virtual void EndElementHandler(const XML_Char *name);
|
|
virtual void CharacterDataHandler(const XML_Char *s, int len);
|
|
|
|
public:
|
|
XMLTreeParser(const XML_Char *encoding);
|
|
virtual ~XMLTreeParser();
|
|
|
|
XMLTreeNode *RootNode() { return root; };
|
|
};
|
|
|
|
#endif // __XMLTREE_H
|