xref: /PHP-8.4/ext/dom/lexbor/lexbor/html/token_attr.h (revision bffab33a)
1 /*
2  * Copyright (C) 2018-2020 Alexander Borisov
3  *
4  * Author: Alexander Borisov <borisov@lexbor.com>
5  */
6 
7 #ifndef LEXBOR_HTML_TOKEN_ATTR_H
8 #define LEXBOR_HTML_TOKEN_ATTR_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #include "lexbor/core/str.h"
15 #include "lexbor/core/dobject.h"
16 
17 #include "lexbor/dom/interfaces/attr.h"
18 
19 #include "lexbor/html/base.h"
20 
21 
22 typedef struct lxb_html_token_attr lxb_html_token_attr_t;
23 typedef int lxb_html_token_attr_type_t;
24 
25 enum lxb_html_token_attr_type {
26     LXB_HTML_TOKEN_ATTR_TYPE_UNDEF      = 0x0000,
27     LXB_HTML_TOKEN_ATTR_TYPE_NAME_NULL  = 0x0001,
28     LXB_HTML_TOKEN_ATTR_TYPE_VALUE_NULL = 0x0002
29 };
30 
31 struct lxb_html_token_attr {
32     const lxb_char_t           *name_begin;
33     const lxb_char_t           *name_end;
34 
35     const lxb_char_t           *value_begin;
36     const lxb_char_t           *value_end;
37 
38     const lxb_dom_attr_data_t  *name;
39     lxb_char_t                 *value;
40     size_t                     value_size;
41 
42     lxb_html_token_attr_t      *next;
43     lxb_html_token_attr_t      *prev;
44 
45     lxb_html_token_attr_type_t type;
46 };
47 
48 
49 LXB_API lxb_html_token_attr_t *
50 lxb_html_token_attr_create(lexbor_dobject_t *dobj);
51 
52 LXB_API void
53 lxb_html_token_attr_clean(lxb_html_token_attr_t *attr);
54 
55 LXB_API lxb_html_token_attr_t *
56 lxb_html_token_attr_destroy(lxb_html_token_attr_t *attr,
57                             lexbor_dobject_t *dobj);
58 
59 LXB_API const lxb_char_t *
60 lxb_html_token_attr_name(lxb_html_token_attr_t *attr, size_t *length);
61 
62 
63 #ifdef __cplusplus
64 } /* extern "C" */
65 #endif
66 
67 #endif /* LEXBOR_HTML_TOKEN_ATTR_H */
68