libUPnP  1.8.4
ixmlmembuf.h
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (c) 2000-2003 Intel Corporation
4  * All rights reserved.
5  * Copyright (c) 2012 France Telecom All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * - Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  * - Redistributions in binary form must reproduce the above copyright notice,
13  * this list of conditions and the following disclaimer in the documentation
14  * and/or other materials provided with the distribution.
15  * - Neither name of Intel Corporation nor the names of its contributors
16  * may be used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  **************************************************************************/
32 
33 
34 #ifndef IXML_MEMBUF_H
35 #define IXML_MEMBUF_H
36 
37 
43 #include "ixml.h"
44 
45 
46 #include <stdlib.h> /* for size_t */
47 
48 
49 #define MINVAL(a, b) ( (a) < (b) ? (a) : (b) )
50 #define MAXVAL(a, b) ( (a) > (b) ? (a) : (b) )
51 
52 
53 #define MEMBUF_DEF_SIZE_INC 20u
54 
55 
59 typedef struct
60 {
61  char *buf;
62  size_t length;
63  size_t capacity;
64  size_t size_inc;
65 } ixml_membuf;
66 
67 
71 void ixml_membuf_init(
73  ixml_membuf *m);
74 
75 
84  ixml_membuf *m);
85 
86 
99  ixml_membuf *m,
101  const void *buf,
103  size_t buf_len);
104 
116  ixml_membuf *m,
118  const char *c_str);
119 
131  ixml_membuf *m,
133  const void *buf);
134 
147  ixml_membuf *m,
149  const char *c_str);
150 
163  ixml_membuf *m,
165  const void *buf,
167  size_t buf_len,
170  size_t index);
171 
172 
173 #endif /* IXML_MEMBUF_H */
174 
ixmlNode_getNodeName
EXPORT_SPEC const char * ixmlNode_getNodeName(IXML_Node *nodeptr)
Returns the name of the Node, depending on what type of Node it is, in a read-only string.
Definition: node.c:122
ixml_membuf_init
void ixml_membuf_init(ixml_membuf *m)
ixml_membuf initialization routine.
Definition: ixmlmembuf.c:108
ixmlElement_setAttributeNodeNS
EXPORT_SPEC int ixmlElement_setAttributeNodeNS(IXML_Element *element, IXML_Attr *newAttr, IXML_Attr **rcAttr)
Adds a new attribute node to the element node specified.
ixmlDocument_createTextNodeEx
EXPORT_SPEC int ixmlDocument_createTextNodeEx(IXML_Document *doc, const char *data, IXML_Node **textNode)
Creates a new Text node with the given data.
ixmldebug.h
Auxiliar routines to aid debugging.
ixmlElement_getAttributeNode
EXPORT_SPEC IXML_Attr * ixmlElement_getAttributeNode(IXML_Element *element, const char *name)
Retrieves an attribute node by name. See ixmlElement_getAttributeNodeNS to retrieve an attribute node...
ixmlNode_getFirstChild
EXPORT_SPEC IXML_Node * ixmlNode_getFirstChild(IXML_Node *nodeptr)
Retrieves the first child Node of a Node.
Definition: node.c:307
ixmlDocument_init
void ixmlDocument_init(IXML_Document *doc)
Initializes a Document node.
Definition: document.c:48
ixmlElement_setAttribute
EXPORT_SPEC int ixmlElement_setAttribute(IXML_Element *element, const char *name, const char *value)
Adds a new attribute to an Element.
ixmlDocument_createAttributeNSEx
EXPORT_SPEC int ixmlDocument_createAttributeNSEx(IXML_Document *doc, const char *namespaceURI, const char *qualifiedName, IXML_Attr **attrNode)
Creates a new Attr node with the given qualified name and namespace URI.
ixmlCDATASection_init
EXPORT_SPEC void ixmlCDATASection_init(IXML_CDATASection *nodeptr)
Initializes a CDATASection node.
Definition: node.c:55
ixmlElement_hasAttribute
EXPORT_SPEC BOOL ixmlElement_hasAttribute(IXML_Element *element, const char *name)
Queries whether the Element has an attribute with the given name or a default value.
ixmlElement_removeAttributeNS
EXPORT_SPEC int ixmlElement_removeAttributeNS(IXML_Element *element, const char *namespaceURI, const char *localName)
Removes an attribute using the namespace URI and local name.
ixml_membuf_destroy
void ixml_membuf_destroy(ixml_membuf *m)
ixml_membuf clearing routine.
Definition: ixmlmembuf.c:119
ixmlDocument_createDocument
IXML_Document * ixmlDocument_createDocument()
Creates a new empty Document node.
Definition: document.c:211
_IXML_Document
Data structure representing the DOM Document.
Definition: ixml.h:198
ixmlElement_init
EXPORT_SPEC void ixmlElement_init(IXML_Element *element)
Initializes a IXML_Element node.
Definition: element.c:47
ixmlElement_removeAttribute
EXPORT_SPEC int ixmlElement_removeAttribute(IXML_Element *element, const char *name)
Removes an attribute value by name. The attribute node is not removed.
Parser_isValidXmlName
BOOL Parser_isValidXmlName(const DOMString name)
Check to see whether name is a valid xml name.
Definition: ixmlparser.c:2477
ixmlNode_getElementsByTagName
void ixmlNode_getElementsByTagName(IXML_Node *n, const char *tagname, IXML_NodeList **list)
Returns a nodeList of all descendant Elements with a given tagName, in the order in which they are en...
Definition: node.c:1226
ixmlAttr_free
EXPORT_SPEC void ixmlAttr_free(IXML_Attr *attrNode)
Frees an Attr node.
ixmlDocument_createAttributeEx
EXPORT_SPEC int ixmlDocument_createAttributeEx(IXML_Document *doc, const char *name, IXML_Attr **attrNode)
Creates a new Attr node with the given name.
ixmlDocument_getElementsByTagNameNS
EXPORT_SPEC IXML_NodeList * ixmlDocument_getElementsByTagNameNS(IXML_Document *doc, const char *namespaceURI, const char *localName)
Returns a NodeList of Elements that match the given local name and namespace URI in the order they ar...
ixmlDocument_createElement
EXPORT_SPEC IXML_Element * ixmlDocument_createElement(IXML_Document *doc, const char *tagName)
Creates a new Element node with the given tag name.
ixmlDocument_createCDATASection
EXPORT_SPEC IXML_CDATASection * ixmlDocument_createCDATASection(IXML_Document *doc, const char *data)
Creates a new CDATASection node with given data.
ixml_membuf
The ixml_membuf type.
Definition: ixmlmembuf.h:60
ixmlDocument_setOwnerDocument
static void ixmlDocument_setOwnerDocument(IXML_Document *doc, IXML_Node *nodeptr)
Definition: document.c:68
ixmlNode_init
void ixmlNode_init(IN IXML_Node *nodeptr)
Intializes a node.
ixmlElement_hasAttributeNS
EXPORT_SPEC BOOL ixmlElement_hasAttributeNS(IXML_Element *element, const char *namespaceURI, const char *localName)
Queries whether the Element has an attribute with the given local name and namespace URI or has a def...
ixmlNode_setNodeName
int ixmlNode_setNodeName(IXML_Node *node, const DOMString qualifiedName)
Definition: node.c:1310
ixmlDocument_free
void ixmlDocument_free(IXML_Document *doc)
Frees a Document object and all Nodes associated with it.
Definition: document.c:54
ixmlDocument_createDocumentEx
int ixmlDocument_createDocumentEx(IXML_Document **rtDoc)
Creates a new empty Document node.
Definition: document.c:180
ixml.h
ixmlElement_setTagName
int ixmlElement_setTagName(IXML_Element *element, const char *tagName)
Set the given element's tagName.
Definition: element.c:64
ixmlparser.h
ixmlDocument_createTextNode
EXPORT_SPEC IXML_Node * ixmlDocument_createTextNode(IXML_Document *doc, const char *data)
Creates a new Text node with the given data.
ixmlElement_findAttributeNode
static IXML_Node * ixmlElement_findAttributeNode(IXML_Element *element, IXML_Attr *oldAttr)
Find a attribute node whose contents are the same as the oldAttr.
Definition: element.c:296
_IXML_Node
Data structure common to all types of nodes.
Definition: ixml.h:173
ixmlDocument_getElementById
EXPORT_SPEC IXML_Element * ixmlDocument_getElementById(IXML_Document *doc, const char *tagName)
Returns the Element whose ID matches that given id.
ixmlDocument_createAttribute
EXPORT_SPEC IXML_Attr * ixmlDocument_createAttribute(IXML_Document *doc, const char *name)
Creates a new Attr node with the given name.
ixmlElement_getTagName
const DOMString ixmlElement_getTagName(IXML_Element *element)
Returns the name of the tag as a constant string.
Definition: element.c:54
_IXML_CDATASection
Data structure representing a CDATA section node.
Definition: ixml.h:207
ixmlElement_free
EXPORT_SPEC void ixmlElement_free(IXML_Element *element)
Frees the given Element and any subtree of the Element.
Definition: element.c:706
TRUE
#define TRUE
Definition: upnputil.h:63
ixml_membuf_append_str
int ixml_membuf_append_str(ixml_membuf *m, const char *c_str)
Appends the contents of a NULL terminated string to the designated ixml_membuf.
ixmlNode_getElementsByTagNameNS
void ixmlNode_getElementsByTagNameNS(IXML_Node *n, const char *namespaceURI, const char *localName, IXML_NodeList **list)
Returns a nodeList of all the descendant Elements with a given local name and namespace URI in the or...
Definition: node.c:1282
ixml_membuf_insert
int ixml_membuf_insert(ixml_membuf *m, const void *buf, size_t buf_len, size_t index)
ixmlNode_cloneNode
EXPORT_SPEC IXML_Node * ixmlNode_cloneNode(IXML_Node *nodeptr, BOOL deep)
Clones a Node.
Definition: node.c:1082
ixmlElement_getAttributeNodeNS
EXPORT_SPEC IXML_Attr * ixmlElement_getAttributeNodeNS(IXML_Element *element, const char *namespaceURI, const char *localName)
Retrieves an Attr node by local name and namespace URI.
ixmlCDATASection_free
EXPORT_SPEC void ixmlCDATASection_free(IXML_CDATASection *nodeptr)
Frees a CDATASection node.
Definition: node.c:61
ixml_membuf_assign
int ixml_membuf_assign(ixml_membuf *m, const void *buf, size_t buf_len)
Copies the contents o a buffer to the designated ixml_membuf.
Definition: ixmlmembuf.c:130
ixmlNode_getNodeType
EXPORT_SPEC unsigned short ixmlNode_getNodeType(IXML_Node *nodeptr)
Retrieves the type of a Node. Note that not all possible return values are actually implemented.
Definition: node.c:287
ixmlElement_getAttributeNS
EXPORT_SPEC const char * ixmlElement_getAttributeNS(IXML_Element *element, const char *namespaceURI, const char *localname)
Retrieves an attribute value using the local name and namespace URI.
ixmlElement_getElementsByTagNameNS
EXPORT_SPEC IXML_NodeList * ixmlElement_getElementsByTagNameNS(IXML_Element *element, const char *namespaceURI, const char *localName)
Returns a NodeList of all descendant Elements with a given local name and namespace in the order in w...
ixml_membuf_append
int ixml_membuf_append(ixml_membuf *m, const void *buf)
Appends one byte to the designated ixml_membuffer.
ixmlElement_getAttribute
EXPORT_SPEC const char * ixmlElement_getAttribute(IXML_Element *element, const char *name)
Retrieves an attribute of an Element by name.
_IXML_NodeList
Data structure representing a list of nodes.
Definition: ixml.h:246
Parser_setNodePrefixAndLocalName
int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr)
Set the node prefix and localName as defined by the nodeName in the form of ns:name.
Definition: ixmlparser.c:2658
IxmlPrintf
void IxmlPrintf(const char *DbgFileName, int DbgLineNo, const char *FunctionName, const char *FmtStr,...)
Prints the debug statement either on the standard output or log file along with the information from ...
Definition: ixmldebug.c:19
DOMString
#define DOMString
The type of DOM strings.
Definition: ixml.h:59
ixmlDocument_getElementsByTagName
EXPORT_SPEC IXML_NodeList * ixmlDocument_getElementsByTagName(IXML_Document *doc, const char *tagName)
Returns a NodeList of all Elements that match the given tag name in the order in which they were enco...
ixmlNode_free
EXPORT_SPEC void ixmlNode_free(IXML_Node *nodeptr)
Frees a Node and all Nodes in its subtree.
Definition: node.c:107
ixmlElement_setAttributeNS
EXPORT_SPEC int ixmlElement_setAttributeNS(IXML_Element *element, const char *namespaceURI, const char *qualifiedName, const char *value)
Adds a new attribute to an Element using the local name and namespace URI.
ixml_membuf_assign_str
int ixml_membuf_assign_str(ixml_membuf *m, const char *c_str)
Copies a NULL terminated string to the ixml_buffer.
Definition: ixmlmembuf.c:161
ixmlElement_setAttributeNode
int ixmlElement_setAttributeNode(IXML_Element *element, IXML_Attr *newAttr, IXML_Attr **rtAttr)
Adds a new attribute node to an Element.
Definition: element.c:224
ixmlElement_removeAttributeNode
int ixmlElement_removeAttributeNode(IXML_Element *element, IXML_Attr *oldAttr, IXML_Attr **rtAttr)
Removes the specified attribute node from an Element.
Definition: element.c:322
ixmlDocument_createAttributeNS
EXPORT_SPEC IXML_Attr * ixmlDocument_createAttributeNS(IXML_Document *doc, const char *namespaceURI, const char *qualifiedName)
Creates a new Attribute node with the given qualified name and namespace URI.
_IXML_ATTR
Data structure representing an Attribute node.
Definition: ixml.h:226
ixmlDocument_createElementEx
EXPORT_SPEC int ixmlDocument_createElementEx(IXML_Document *doc, const char *tagName, IXML_Element **rtElement)
Creates a new Element node with the given tag name.
_IXML_Element
Data structure representing an Element node.
Definition: ixml.h:216
ixmlDocument_createElementNS
EXPORT_SPEC IXML_Element * ixmlDocument_createElementNS(IXML_Document *doc, const char *namespaceURI, const char *qualifiedName)
Creates a new Element node in the given qualified name and namespace URI.
Parser_freeNodeContent
void Parser_freeNodeContent(IXML_Node *IXML_Nodeptr)
Fees a node contents.
Definition: ixmlparser.c:2626
ixmlNode_compare
BOOL ixmlNode_compare(IXML_Node *srcNode, IXML_Node *destNode)
Compare two nodes to see whether they are the same node. Parent, sibling and children node are ignore...
Definition: node.c:470
ixmlDocument_importNode
int ixmlDocument_importNode(IXML_Document *doc, IXML_Node *importNode, BOOL deep, IXML_Node **rtNode)
Imports a Node from another Document into this Document.
Definition: document.c:84
ixmlDocument_createCDATASectionEx
EXPORT_SPEC int ixmlDocument_createCDATASectionEx(IXML_Document *doc, const char *data, IXML_CDATASection **cdNode)
Creates a new CDATASection node with given data.
ixmlNode_getNextSibling
EXPORT_SPEC IXML_Node * ixmlNode_getNextSibling(IXML_Node *nodeptr)
Retrieves the sibling Node immediately following this Node.
Definition: node.c:346
ixmlDocument_createElementNSEx
EXPORT_SPEC int ixmlDocument_createElementNSEx(IXML_Document *doc, const char *namespaceURI, const char *qualifiedName, IXML_Element **rtElement)
Creates a new Element node in the given qualified name and namespace URI.
ixmlElement_getElementsByTagName
EXPORT_SPEC IXML_NodeList * ixmlElement_getElementsByTagName(IXML_Element *element, const char *tagName)
Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are e...