Add missing files
[gmpc-magnatune.git] / src / axl / axl_doc.h
blobf05af4230918d854f134e8fb388403a34789b512
1 /**
2 * LibAxl: Another XML library
3 * Copyright (C) 2006 Advanced Software Production Line, S.L.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1 of
8 * the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free
17 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 * 02111-1307 USA
20 * You may find a copy of the license under this software is released
21 * at COPYING file. This is LGPL software: you are welcome to
22 * develop proprietary applications using this library without any
23 * royalty or fee but returning back any change, improvement or
24 * addition in the form of source code, project image, documentation
25 * patches, etc.
27 * For commercial support on build XML enabled solutions contact us:
29 * Postal address:
30 * Advanced Software Production Line, S.L.
31 * C/ Dr. Michavila NÂș 14
32 * Coslada 28820 Madrid
33 * Spain
35 * Email address:
36 * info@aspl.es - http://fact.aspl.es
38 #ifndef __AXL_DOC_H__
39 #define __AXL_DOC_H__
41 #include <axl_decl.h>
43 BEGIN_C_DECLS
45 /**
46 * \addtogroup axl_doc_module
47 * @{
50 axlDoc * axl_doc_create (const char * version,
51 const char * encoding,
52 bool standalone);
54 axlDoc * axl_doc_parse (const char * entity,
55 int entity_size,
56 axlError ** error);
58 axlDoc * axl_doc_parse_strings (axlError ** error,
59 ...);
61 axlDoc * axl_doc_parse_from_file (const char * file_path,
62 axlError ** error);
64 bool axl_doc_dump (axlDoc * doc,
65 char ** content,
66 int * size);
68 bool axl_doc_dump_pretty (axlDoc * doc,
69 char ** content,
70 int * size,
71 int tabular);
73 bool axl_doc_dump_to_file (axlDoc * doc,
74 char * file_path);
76 bool axl_doc_dump_pretty_to_file (axlDoc * doc,
77 char * file_path,
78 int tabular);
80 int axl_doc_get_flat_size (axlDoc * doc);
82 bool axl_doc_are_equal (axlDoc * doc,
83 axlDoc * doc2);
85 bool axl_doc_are_equal_trimmed (axlDoc * doc,
86 axlDoc * doc2);
88 axlNode * axl_doc_get_root (axlDoc * doc);
90 void axl_doc_set_root (axlDoc * doc,
91 axlNode * root);
93 axlList * axl_doc_get_list (axlDoc * doc,
94 const char * path_to);
96 axlNode * axl_doc_get (axlDoc * doc,
97 const char * path_to);
99 /**
100 * @brief Convenience macro that allows to call \ref
101 * axl_node_find_called, providing a document, making the parent
102 * reference to use the root document node.
104 * See \ref axl_node_find_called for more information.
106 * @param doc The document where the node lookup will be produced.
107 * @param name The child node name that is looked up.
109 * @return A reference to the node found or NULL if it fails to find
110 * the node requested.
112 #define axl_doc_find_called(doc,name) (axl_node_find_called(axl_doc_get_root(doc),name))
114 const char * axl_doc_get_content_at (axlDoc * doc,
115 const char * path_to,
116 int * content_size);
118 const char * axl_doc_get_encoding (axlDoc * doc);
120 bool axl_doc_get_standalone (axlDoc * doc);
122 void axl_doc_free (axlDoc * doc);
124 void axl_doc_set_child_current_parent (axlDoc * doc,
125 axlNode * node);
127 void axl_doc_pop_current_parent (axlDoc * doc);
129 void axl_doc_add_pi_target (axlDoc * doc,
130 char * target,
131 char * content);
133 bool axl_doc_has_pi_target (axlDoc * doc,
134 char * pi_target);
136 char * axl_doc_get_pi_target_content (axlDoc * doc,
137 char * pi_target);
139 axlList * axl_doc_get_pi_target_list (axlDoc * doc);
141 axlPI * axl_pi_create (char * name,
142 char * content);
144 axlPI * axl_pi_copy (axlPI * pi);
146 bool axl_pi_are_equal (axlPI * pi,
147 axlPI * pi2);
149 char * axl_pi_get_name (axlPI * pi);
151 char * axl_pi_get_content (axlPI * pi);
153 void axl_pi_free (axlPI * pi);
155 int axl_pi_get_size (axlPI * pi);
157 bool axl_doc_iterate (axlDoc * doc,
158 AxlIterationMode mode,
159 axlIterationFunc func,
160 axlPointer ptr);
162 bool axl_doc_iterate_full (axlDoc * doc,
163 AxlIterationMode mode,
164 axlIterationFunc2 func,
165 axlPointer ptr,
166 axlPointer ptr2);
168 bool axl_doc_iterate_full_from (axlDoc * doc,
169 axlNode * starting_from,
170 AxlIterationMode mode,
171 axlIterationFunc2 func,
172 axlPointer ptr,
173 axlPointer ptr2);
175 /* private API starts from here, do not use this API */
177 bool axl_doc_consume_comments (axlDoc * doc,
178 axlStream * stream,
179 axlError ** error);
181 bool axl_doc_consume_pi (axlDoc * doc,
182 axlNode * node,
183 axlStream * stream,
184 axlError ** error);
186 axlFactory * axl_doc_get_item_factory (axlDoc * doc);
188 /* @} */
190 END_C_DECLS
192 #endif