1.1 --- a/Frameworks/libpurple.framework/Versions/0.5.6/Headers/xmlnode.h Sun Jun 21 22:04:11 2009 -0400
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,304 +0,0 @@
1.4 -/**
1.5 - * @file xmlnode.h XML DOM functions
1.6 - * @ingroup core
1.7 - */
1.8 -
1.9 -/* purple
1.10 - *
1.11 - * Purple is the legal property of its developers, whose names are too numerous
1.12 - * to list here. Please refer to the COPYRIGHT file distributed with this
1.13 - * source distribution.
1.14 - *
1.15 - * This program is free software; you can redistribute it and/or modify
1.16 - * it under the terms of the GNU General Public License as published by
1.17 - * the Free Software Foundation; either version 2 of the License, or
1.18 - * (at your option) any later version.
1.19 - *
1.20 - * This program is distributed in the hope that it will be useful,
1.21 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.22 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.23 - * GNU General Public License for more details.
1.24 - *
1.25 - * You should have received a copy of the GNU General Public License
1.26 - * along with this program; if not, write to the Free Software
1.27 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
1.28 - */
1.29 -#ifndef _PURPLE_XMLNODE_H_
1.30 -#define _PURPLE_XMLNODE_H_
1.31 -
1.32 -#ifdef __cplusplus
1.33 -extern "C" {
1.34 -#endif
1.35 -
1.36 -/**
1.37 - * The valid types for an xmlnode
1.38 - */
1.39 -typedef enum _XMLNodeType
1.40 -{
1.41 - XMLNODE_TYPE_TAG, /**< Just a tag */
1.42 - XMLNODE_TYPE_ATTRIB, /**< Has attributes */
1.43 - XMLNODE_TYPE_DATA /**< Has data */
1.44 -} XMLNodeType;
1.45 -
1.46 -/**
1.47 - * An xmlnode.
1.48 - */
1.49 -typedef struct _xmlnode xmlnode;
1.50 -struct _xmlnode
1.51 -{
1.52 - char *name; /**< The name of the node. */
1.53 - char *xmlns; /**< The namespace of the node */
1.54 - XMLNodeType type; /**< The type of the node. */
1.55 - char *data; /**< The data for the node. */
1.56 - size_t data_sz; /**< The size of the data. */
1.57 - struct _xmlnode *parent; /**< The parent node or @c NULL.*/
1.58 - struct _xmlnode *child; /**< The child node or @c NULL.*/
1.59 - struct _xmlnode *lastchild; /**< The last child node or @c NULL.*/
1.60 - struct _xmlnode *next; /**< The next node or @c NULL. */
1.61 - char *prefix; /**< The namespace prefix if any. */
1.62 - GHashTable *namespace_map; /**< The namespace map. */
1.63 -};
1.64 -
1.65 -/**
1.66 - * Creates a new xmlnode.
1.67 - *
1.68 - * @param name The name of the node.
1.69 - *
1.70 - * @return The new node.
1.71 - */
1.72 -xmlnode *xmlnode_new(const char *name);
1.73 -
1.74 -/**
1.75 - * Creates a new xmlnode child.
1.76 - *
1.77 - * @param parent The parent node.
1.78 - * @param name The name of the child node.
1.79 - *
1.80 - * @return The new child node.
1.81 - */
1.82 -xmlnode *xmlnode_new_child(xmlnode *parent, const char *name);
1.83 -
1.84 -/**
1.85 - * Inserts a node into a node as a child.
1.86 - *
1.87 - * @param parent The parent node to insert child into.
1.88 - * @param child The child node to insert into parent.
1.89 - */
1.90 -void xmlnode_insert_child(xmlnode *parent, xmlnode *child);
1.91 -
1.92 -/**
1.93 - * Gets a child node named name.
1.94 - *
1.95 - * @param parent The parent node.
1.96 - * @param name The child's name.
1.97 - *
1.98 - * @return The child or NULL.
1.99 - */
1.100 -xmlnode *xmlnode_get_child(const xmlnode *parent, const char *name);
1.101 -
1.102 -/**
1.103 - * Gets a child node named name in a namespace.
1.104 - *
1.105 - * @param parent The parent node.
1.106 - * @param name The child's name.
1.107 - * @param xmlns The namespace.
1.108 - *
1.109 - * @return The child or NULL.
1.110 - */
1.111 -xmlnode *xmlnode_get_child_with_namespace(const xmlnode *parent, const char *name, const char *xmlns);
1.112 -
1.113 -/**
1.114 - * Gets the next node with the same name as node.
1.115 - *
1.116 - * @param node The node of a twin to find.
1.117 - *
1.118 - * @return The twin of node or NULL.
1.119 - */
1.120 -xmlnode *xmlnode_get_next_twin(xmlnode *node);
1.121 -
1.122 -/**
1.123 - * Inserts data into a node.
1.124 - *
1.125 - * @param node The node to insert data into.
1.126 - * @param data The data to insert.
1.127 - * @param size The size of the data to insert. If data is
1.128 - * null-terminated you can pass in -1.
1.129 - */
1.130 -void xmlnode_insert_data(xmlnode *node, const char *data, gssize size);
1.131 -
1.132 -/**
1.133 - * Gets (escaped) data from a node.
1.134 - *
1.135 - * @param node The node to get data from.
1.136 - *
1.137 - * @return The data from the node or NULL. This data is in raw escaped format.
1.138 - * You must g_free this string when finished using it.
1.139 - */
1.140 -char *xmlnode_get_data(xmlnode *node);
1.141 -
1.142 -/**
1.143 - * Gets unescaped data from a node.
1.144 - *
1.145 - * @param node The node to get data from.
1.146 - *
1.147 - * @return The data from the node, in unescaped form. You must g_free
1.148 - * this string when finished using it.
1.149 - */
1.150 -char *xmlnode_get_data_unescaped(xmlnode *node);
1.151 -
1.152 -/**
1.153 - * Sets an attribute for a node.
1.154 - *
1.155 - * @param node The node to set an attribute for.
1.156 - * @param attr The name of the attribute.
1.157 - * @param value The value of the attribute.
1.158 - */
1.159 -void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value);
1.160 -
1.161 -/**
1.162 - * Sets a prefixed attribute for a node
1.163 - *
1.164 - * @param node The node to set an attribute for.
1.165 - * @param attr The name of the attribute to set
1.166 - * @param prefix The prefix of the attribute to ste
1.167 - * @param value The value of the attribute
1.168 - */
1.169 -void xmlnode_set_attrib_with_prefix(xmlnode *node, const char *attr, const char *prefix, const char *value);
1.170 -
1.171 -/**
1.172 - * Sets a namespaced attribute for a node
1.173 - *
1.174 - * @param node The node to set an attribute for.
1.175 - * @param attr The name of the attribute to set
1.176 - * @param xmlns The namespace of the attribute to ste
1.177 - * @param value The value of the attribute
1.178 - */
1.179 -void xmlnode_set_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns, const char *value);
1.180 -
1.181 -/**
1.182 - * Gets an attribute from a node.
1.183 - *
1.184 - * @param node The node to get an attribute from.
1.185 - * @param attr The attribute to get.
1.186 - *
1.187 - * @return The value of the attribute.
1.188 - */
1.189 -const char *xmlnode_get_attrib(xmlnode *node, const char *attr);
1.190 -
1.191 -/**
1.192 - * Gets a namespaced attribute from a node
1.193 - *
1.194 - * @param node The node to get an attribute from.
1.195 - * @param attr The attribute to get
1.196 - * @param xmlns The namespace of the attribute to get
1.197 - *
1.198 - * @return The value of the attribute/
1.199 - */
1.200 -const char *xmlnode_get_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns);
1.201 -
1.202 -/**
1.203 - * Removes an attribute from a node.
1.204 - *
1.205 - * @param node The node to remove an attribute from.
1.206 - * @param attr The attribute to remove.
1.207 - */
1.208 -void xmlnode_remove_attrib(xmlnode *node, const char *attr);
1.209 -
1.210 -/**
1.211 - * Removes a namespaced attribute from a node
1.212 - *
1.213 - * @param node The node to remove an attribute from
1.214 - * @param attr The attribute to remove
1.215 - * @param xmlns The namespace of the attribute to remove
1.216 - */
1.217 -void xmlnode_remove_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns);
1.218 -
1.219 -/**
1.220 - * Sets the namespace of a node
1.221 - *
1.222 - * @param node The node to qualify
1.223 - * @param xmlns The namespace of the node
1.224 - */
1.225 -void xmlnode_set_namespace(xmlnode *node, const char *xmlns);
1.226 -
1.227 -/**
1.228 - * Returns the namespace of a node
1.229 - *
1.230 - * @param node The node to get the namepsace from
1.231 - * @return The namespace of this node
1.232 - */
1.233 -const char *xmlnode_get_namespace(xmlnode *node);
1.234 -
1.235 -/**
1.236 - * Sets the prefix of a node
1.237 - *
1.238 - * @param node The node to qualify
1.239 - * @param prefix The prefix of the node
1.240 - */
1.241 -void xmlnode_set_prefix(xmlnode *node, const char *prefix);
1.242 -
1.243 -/**
1.244 - * Returns the prefix of a node
1.245 - *
1.246 - * @param node The node to get the prefix from
1.247 - * @return The prefix of this node
1.248 - */
1.249 -const char *xmlnode_get_prefix(const xmlnode *node);
1.250 -
1.251 -/**
1.252 - * Returns the node in a string of xml.
1.253 - *
1.254 - * @param node The starting node to output.
1.255 - * @param len Address for the size of the string.
1.256 - *
1.257 - * @return The node represented as a string. You must
1.258 - * g_free this string when finished using it.
1.259 - */
1.260 -char *xmlnode_to_str(const xmlnode *node, int *len);
1.261 -
1.262 -/**
1.263 - * Returns the node in a string of human readable xml.
1.264 - *
1.265 - * @param node The starting node to output.
1.266 - * @param len Address for the size of the string.
1.267 - *
1.268 - * @return The node as human readable string including
1.269 - * tab and new line characters. You must
1.270 - * g_free this string when finished using it.
1.271 - */
1.272 -char *xmlnode_to_formatted_str(const xmlnode *node, int *len);
1.273 -
1.274 -/**
1.275 - * Creates a node from a string of XML. Calling this on the
1.276 - * root node of an XML document will parse the entire document
1.277 - * into a tree of nodes, and return the xmlnode of the root.
1.278 - *
1.279 - * @param str The string of xml.
1.280 - * @param size The size of the string, or -1 if @a str is
1.281 - * NUL-terminated.
1.282 - *
1.283 - * @return The new node.
1.284 - */
1.285 -xmlnode *xmlnode_from_str(const char *str, gssize size);
1.286 -
1.287 -/**
1.288 - * Creates a new node from the source node.
1.289 - *
1.290 - * @param src The node to copy.
1.291 - *
1.292 - * @return A new copy of the src node.
1.293 - */
1.294 -xmlnode *xmlnode_copy(const xmlnode *src);
1.295 -
1.296 -/**
1.297 - * Frees a node and all of its children.
1.298 - *
1.299 - * @param node The node to free.
1.300 - */
1.301 -void xmlnode_free(xmlnode *node);
1.302 -
1.303 -#ifdef __cplusplus
1.304 -}
1.305 -#endif
1.306 -
1.307 -#endif /* _PURPLE_XMLNODE_H_ */