xref: /php-src/ext/dom/lexbor/lexbor/ns/ns.h (revision bffab33a)
1 /*
2  * Copyright (C) 2018 Alexander Borisov
3  *
4  * Author: Alexander Borisov <borisov@lexbor.com>
5  */
6 
7 #ifndef LEXBOR_NS_H
8 #define LEXBOR_NS_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #include "lexbor/core/hash.h"
15 #include "lexbor/core/shs.h"
16 
17 #include "lexbor/ns/const.h"
18 
19 
20 typedef struct {
21     lexbor_hash_entry_t  entry;
22 
23     lxb_ns_id_t          ns_id;
24     size_t               ref_count;
25     bool                 read_only;
26 }
27 lxb_ns_data_t;
28 
29 typedef struct {
30     lexbor_hash_entry_t  entry;
31 
32     lxb_ns_prefix_id_t   prefix_id;
33     size_t               ref_count;
34     bool                 read_only;
35 }
36 lxb_ns_prefix_data_t;
37 
38 
39 /* Link */
40 LXB_API const lxb_char_t *
41 lxb_ns_by_id(lexbor_hash_t *hash, lxb_ns_id_t ns_id, size_t *length);
42 
43 LXB_API const lxb_ns_data_t *
44 lxb_ns_data_by_id(lexbor_hash_t *hash, lxb_ns_id_t ns_id);
45 
46 LXB_API const lxb_ns_data_t *
47 lxb_ns_data_by_link(lexbor_hash_t *hash, const lxb_char_t *name, size_t length);
48 
49 /* Prefix */
50 LXB_API const lxb_ns_prefix_data_t *
51 lxb_ns_prefix_append(lexbor_hash_t *hash,
52                      const lxb_char_t *prefix, size_t length);
53 
54 LXB_API const lxb_ns_prefix_data_t *
55 lxb_ns_prefix_data_by_id(lexbor_hash_t *hash, lxb_ns_prefix_id_t prefix_id);
56 
57 LXB_API const lxb_ns_prefix_data_t *
58 lxb_ns_prefix_data_by_name(lexbor_hash_t *hash,
59                            const lxb_char_t *name, size_t length);
60 
61 
62 #ifdef __cplusplus
63 } /* extern "C" */
64 #endif
65 
66 #endif /* LEXBOR_NS_H */
67