github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_xml_reader_capi.h (about) 1 // Copyright (c) 2014 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 37 #ifndef CEF_INCLUDE_CAPI_CEF_XML_READER_CAPI_H_ 38 #define CEF_INCLUDE_CAPI_CEF_XML_READER_CAPI_H_ 39 #pragma once 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 #include "include/capi/cef_base_capi.h" 46 #include "include/capi/cef_stream_capi.h" 47 48 49 /// 50 // Structure that supports the reading of XML data via the libxml streaming API. 51 // The functions of this structure should only be called on the thread that 52 // creates the object. 53 /// 54 typedef struct _cef_xml_reader_t { 55 /// 56 // Base structure. 57 /// 58 cef_base_t base; 59 60 /// 61 // Moves the cursor to the next node in the document. This function must be 62 // called at least once to set the current cursor position. Returns true (1) 63 // if the cursor position was set successfully. 64 /// 65 int (CEF_CALLBACK *move_to_next_node)(struct _cef_xml_reader_t* self); 66 67 /// 68 // Close the document. This should be called directly to ensure that cleanup 69 // occurs on the correct thread. 70 /// 71 int (CEF_CALLBACK *close)(struct _cef_xml_reader_t* self); 72 73 /// 74 // Returns true (1) if an error has been reported by the XML parser. 75 /// 76 int (CEF_CALLBACK *has_error)(struct _cef_xml_reader_t* self); 77 78 /// 79 // Returns the error string. 80 /// 81 // The resulting string must be freed by calling cef_string_userfree_free(). 82 cef_string_userfree_t (CEF_CALLBACK *get_error)( 83 struct _cef_xml_reader_t* self); 84 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, int index); 181 182 /// 183 // Returns the value of the attribute with the specified qualified name. 184 /// 185 // The resulting string must be freed by calling cef_string_userfree_free(). 186 cef_string_userfree_t (CEF_CALLBACK *get_attribute_byqname)( 187 struct _cef_xml_reader_t* self, const cef_string_t* qualifiedName); 188 189 /// 190 // Returns the value of the attribute with the specified local name and 191 // namespace URI. 192 /// 193 // The resulting string must be freed by calling cef_string_userfree_free(). 194 cef_string_userfree_t (CEF_CALLBACK *get_attribute_bylname)( 195 struct _cef_xml_reader_t* self, const cef_string_t* localName, 196 const cef_string_t* namespaceURI); 197 198 /// 199 // Returns an XML representation of the current node's children. 200 /// 201 // The resulting string must be freed by calling cef_string_userfree_free(). 202 cef_string_userfree_t (CEF_CALLBACK *get_inner_xml)( 203 struct _cef_xml_reader_t* self); 204 205 /// 206 // Returns an XML representation of the current node including its children. 207 /// 208 // The resulting string must be freed by calling cef_string_userfree_free(). 209 cef_string_userfree_t (CEF_CALLBACK *get_outer_xml)( 210 struct _cef_xml_reader_t* self); 211 212 /// 213 // Returns the line number for the current node. 214 /// 215 int (CEF_CALLBACK *get_line_number)(struct _cef_xml_reader_t* self); 216 217 218 // Attribute nodes are not traversed by default. The below functions can be 219 // used to move the cursor to an attribute node. move_to_carrying_element() 220 // can be called afterwards to return the cursor to the carrying element. The 221 // depth of an attribute node will be 1 + the depth of the carrying element. 222 223 /// 224 // Moves the cursor to the attribute at the specified 0-based index. Returns 225 // true (1) if the cursor position was set successfully. 226 /// 227 int (CEF_CALLBACK *move_to_attribute_byindex)(struct _cef_xml_reader_t* self, 228 int index); 229 230 /// 231 // Moves the cursor to the attribute with the specified qualified name. 232 // Returns true (1) if the cursor position was set successfully. 233 /// 234 int (CEF_CALLBACK *move_to_attribute_byqname)(struct _cef_xml_reader_t* self, 235 const cef_string_t* qualifiedName); 236 237 /// 238 // Moves the cursor to the attribute with the specified local name and 239 // namespace URI. Returns true (1) if the cursor position was set 240 // successfully. 241 /// 242 int (CEF_CALLBACK *move_to_attribute_bylname)(struct _cef_xml_reader_t* self, 243 const cef_string_t* localName, const cef_string_t* namespaceURI); 244 245 /// 246 // Moves the cursor to the first attribute in the current element. Returns 247 // true (1) if the cursor position was set successfully. 248 /// 249 int (CEF_CALLBACK *move_to_first_attribute)(struct _cef_xml_reader_t* self); 250 251 /// 252 // Moves the cursor to the next attribute in the current element. Returns true 253 // (1) if the cursor position was set successfully. 254 /// 255 int (CEF_CALLBACK *move_to_next_attribute)(struct _cef_xml_reader_t* self); 256 257 /// 258 // Moves the cursor back to the carrying element. Returns true (1) if the 259 // cursor position was set successfully. 260 /// 261 int (CEF_CALLBACK *move_to_carrying_element)(struct _cef_xml_reader_t* self); 262 } cef_xml_reader_t; 263 264 265 /// 266 // Create a new cef_xml_reader_t object. The returned object's functions can 267 // only be called from the thread that created the object. 268 /// 269 CEF_EXPORT cef_xml_reader_t* cef_xml_reader_create( 270 struct _cef_stream_reader_t* stream, cef_xml_encoding_type_t encodingType, 271 const cef_string_t* URI); 272 273 274 #ifdef __cplusplus 275 } 276 #endif 277 278 #endif // CEF_INCLUDE_CAPI_CEF_XML_READER_CAPI_H_