1 // Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the name Chromium Embedded 14 // Framework nor the names of its contributors may be used to endorse 15 // or promote products derived from this software without specific prior 16 // written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // 30 // --------------------------------------------------------------------------- 31 // 32 // This file was generated by the CEF translator tool and should not edited 33 // by hand. See the translator.README.txt file in the tools directory for 34 // more information. 35 // 36 // $hash=76de25a0d0f0a2cc4657f46c26ec44b6d7d937e8$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_CEF_XML_READER_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_CEF_XML_READER_CAPI_H_ 41 #pragma once 42 43 #include "include/capi/cef_base_capi.h" 44 #include "include/capi/cef_stream_capi.h" 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 /// 51 // Structure that supports the reading of XML data via the libxml streaming API. 52 // The functions of this structure should only be called on the thread that 53 // creates the object. 54 /// 55 typedef struct _cef_xml_reader_t { 56 /// 57 // Base structure. 58 /// 59 cef_base_ref_counted_t base; 60 61 /// 62 // Moves the cursor to the next node in the document. This function must be 63 // called at least once to set the current cursor position. Returns true (1) 64 // if the cursor position was set successfully. 65 /// 66 int(CEF_CALLBACK* move_to_next_node)(struct _cef_xml_reader_t* self); 67 68 /// 69 // Close the document. This should be called directly to ensure that cleanup 70 // occurs on the correct thread. 71 /// 72 int(CEF_CALLBACK* close)(struct _cef_xml_reader_t* self); 73 74 /// 75 // Returns true (1) if an error has been reported by the XML parser. 76 /// 77 int(CEF_CALLBACK* has_error)(struct _cef_xml_reader_t* self); 78 79 /// 80 // Returns the error string. 81 /// 82 // The resulting string must be freed by calling cef_string_userfree_free(). 83 cef_string_userfree_t(CEF_CALLBACK* get_error)( 84 struct _cef_xml_reader_t* self); 85 86 // The below functions retrieve data for the node at the current cursor 87 // position. 88 89 /// 90 // Returns the node type. 91 /// 92 cef_xml_node_type_t(CEF_CALLBACK* get_type)(struct _cef_xml_reader_t* self); 93 94 /// 95 // Returns the node depth. Depth starts at 0 for the root node. 96 /// 97 int(CEF_CALLBACK* get_depth)(struct _cef_xml_reader_t* self); 98 99 /// 100 // Returns the local name. See http://www.w3.org/TR/REC-xml-names/#NT- 101 // LocalPart for additional details. 102 /// 103 // The resulting string must be freed by calling cef_string_userfree_free(). 104 cef_string_userfree_t(CEF_CALLBACK* get_local_name)( 105 struct _cef_xml_reader_t* self); 106 107 /// 108 // Returns the namespace prefix. See http://www.w3.org/TR/REC-xml-names/ for 109 // additional details. 110 /// 111 // The resulting string must be freed by calling cef_string_userfree_free(). 112 cef_string_userfree_t(CEF_CALLBACK* get_prefix)( 113 struct _cef_xml_reader_t* self); 114 115 /// 116 // Returns the qualified name, equal to (Prefix:)LocalName. See 117 // http://www.w3.org/TR/REC-xml-names/#ns-qualnames for additional details. 118 /// 119 // The resulting string must be freed by calling cef_string_userfree_free(). 120 cef_string_userfree_t(CEF_CALLBACK* get_qualified_name)( 121 struct _cef_xml_reader_t* self); 122 123 /// 124 // Returns the URI defining the namespace associated with the node. See 125 // http://www.w3.org/TR/REC-xml-names/ for additional details. 126 /// 127 // The resulting string must be freed by calling cef_string_userfree_free(). 128 cef_string_userfree_t(CEF_CALLBACK* get_namespace_uri)( 129 struct _cef_xml_reader_t* self); 130 131 /// 132 // Returns the base URI of the node. See http://www.w3.org/TR/xmlbase/ for 133 // additional details. 134 /// 135 // The resulting string must be freed by calling cef_string_userfree_free(). 136 cef_string_userfree_t(CEF_CALLBACK* get_base_uri)( 137 struct _cef_xml_reader_t* self); 138 139 /// 140 // Returns the xml:lang scope within which the node resides. See 141 // http://www.w3.org/TR/REC-xml/#sec-lang-tag for additional details. 142 /// 143 // The resulting string must be freed by calling cef_string_userfree_free(). 144 cef_string_userfree_t(CEF_CALLBACK* get_xml_lang)( 145 struct _cef_xml_reader_t* self); 146 147 /// 148 // Returns true (1) if the node represents an NULL element. <a/> is considered 149 // NULL but <a></a> is not. 150 /// 151 int(CEF_CALLBACK* is_empty_element)(struct _cef_xml_reader_t* self); 152 153 /// 154 // Returns true (1) if the node has a text value. 155 /// 156 int(CEF_CALLBACK* has_value)(struct _cef_xml_reader_t* self); 157 158 /// 159 // Returns the text value. 160 /// 161 // The resulting string must be freed by calling cef_string_userfree_free(). 162 cef_string_userfree_t(CEF_CALLBACK* get_value)( 163 struct _cef_xml_reader_t* self); 164 165 /// 166 // Returns true (1) if the node has attributes. 167 /// 168 int(CEF_CALLBACK* has_attributes)(struct _cef_xml_reader_t* self); 169 170 /// 171 // Returns the number of attributes. 172 /// 173 size_t(CEF_CALLBACK* get_attribute_count)(struct _cef_xml_reader_t* self); 174 175 /// 176 // Returns the value of the attribute at the specified 0-based index. 177 /// 178 // The resulting string must be freed by calling cef_string_userfree_free(). 179 cef_string_userfree_t(CEF_CALLBACK* get_attribute_byindex)( 180 struct _cef_xml_reader_t* self, 181 int index); 182 183 /// 184 // Returns the value of the attribute with the specified qualified name. 185 /// 186 // The resulting string must be freed by calling cef_string_userfree_free(). 187 cef_string_userfree_t(CEF_CALLBACK* get_attribute_byqname)( 188 struct _cef_xml_reader_t* self, 189 const cef_string_t* qualifiedName); 190 191 /// 192 // Returns the value of the attribute with the specified local name and 193 // namespace URI. 194 /// 195 // The resulting string must be freed by calling cef_string_userfree_free(). 196 cef_string_userfree_t(CEF_CALLBACK* get_attribute_bylname)( 197 struct _cef_xml_reader_t* self, 198 const cef_string_t* localName, 199 const cef_string_t* namespaceURI); 200 201 /// 202 // Returns an XML representation of the current node's children. 203 /// 204 // The resulting string must be freed by calling cef_string_userfree_free(). 205 cef_string_userfree_t(CEF_CALLBACK* get_inner_xml)( 206 struct _cef_xml_reader_t* self); 207 208 /// 209 // Returns an XML representation of the current node including its children. 210 /// 211 // The resulting string must be freed by calling cef_string_userfree_free(). 212 cef_string_userfree_t(CEF_CALLBACK* get_outer_xml)( 213 struct _cef_xml_reader_t* self); 214 215 /// 216 // Returns the line number for the current node. 217 /// 218 int(CEF_CALLBACK* get_line_number)(struct _cef_xml_reader_t* self); 219 220 // Attribute nodes are not traversed by default. The below functions can be 221 // used to move the cursor to an attribute node. move_to_carrying_element() 222 // can be called afterwards to return the cursor to the carrying element. The 223 // depth of an attribute node will be 1 + the depth of the carrying element. 224 225 /// 226 // Moves the cursor to the attribute at the specified 0-based index. Returns 227 // true (1) if the cursor position was set successfully. 228 /// 229 int(CEF_CALLBACK* move_to_attribute_byindex)(struct _cef_xml_reader_t* self, 230 int index); 231 232 /// 233 // Moves the cursor to the attribute with the specified qualified name. 234 // Returns true (1) if the cursor position was set successfully. 235 /// 236 int(CEF_CALLBACK* move_to_attribute_byqname)( 237 struct _cef_xml_reader_t* self, 238 const cef_string_t* qualifiedName); 239 240 /// 241 // Moves the cursor to the attribute with the specified local name and 242 // namespace URI. Returns true (1) if the cursor position was set 243 // successfully. 244 /// 245 int(CEF_CALLBACK* move_to_attribute_bylname)( 246 struct _cef_xml_reader_t* self, 247 const cef_string_t* localName, 248 const cef_string_t* namespaceURI); 249 250 /// 251 // Moves the cursor to the first attribute in the current element. Returns 252 // true (1) if the cursor position was set successfully. 253 /// 254 int(CEF_CALLBACK* move_to_first_attribute)(struct _cef_xml_reader_t* self); 255 256 /// 257 // Moves the cursor to the next attribute in the current element. Returns true 258 // (1) if the cursor position was set successfully. 259 /// 260 int(CEF_CALLBACK* move_to_next_attribute)(struct _cef_xml_reader_t* self); 261 262 /// 263 // Moves the cursor back to the carrying element. Returns true (1) if the 264 // cursor position was set successfully. 265 /// 266 int(CEF_CALLBACK* move_to_carrying_element)(struct _cef_xml_reader_t* self); 267 } cef_xml_reader_t; 268 269 /// 270 // Create a new cef_xml_reader_t object. The returned object's functions can 271 // only be called from the thread that created the object. 272 /// 273 CEF_EXPORT cef_xml_reader_t* cef_xml_reader_create( 274 struct _cef_stream_reader_t* stream, 275 cef_xml_encoding_type_t encodingType, 276 const cef_string_t* URI); 277 278 #ifdef __cplusplus 279 } 280 #endif 281 282 #endif // CEF_INCLUDE_CAPI_CEF_XML_READER_CAPI_H_ 283