php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
tag.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2019 Alexander Borisov
3 *
4 * Author: Alexander Borisov <borisov@lexbor.com>
5 */
6
7#ifndef LEXBOR_TAG_H
8#define LEXBOR_TAG_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include "lexbor/core/hash.h"
15#include "lexbor/core/shs.h"
16#include "lexbor/core/dobject.h"
17#include "lexbor/core/str.h"
18
19#include "lexbor/tag/const.h"
20
21
29
30
33
36
39 const lxb_char_t *name, size_t len);
40
41/*
42 * Inline functions
43 */
46{
47 const lxb_tag_data_t *data = lxb_tag_data_by_id(tag_id);
48 if (data == NULL) {
49 if (len != NULL) {
50 *len = 0;
51 }
52
53 return NULL;
54 }
55
56 if (len != NULL) {
57 *len = data->entry.length;
58 }
59
60 return lexbor_hash_entry_str(&data->entry);
61}
62
65{
66 const lxb_tag_data_t *data = lxb_tag_data_by_id(tag_id);
67 if (data == NULL) {
68 if (len != NULL) {
69 *len = 0;
70 }
71
72 return NULL;
73 }
74
75 if (len != NULL) {
76 *len = data->entry.length;
77 }
78
79 return lexbor_hash_entry_str(&data->entry);
80}
81
84{
86 if (data == NULL) {
87 return LXB_TAG__UNDEF;
88 }
89
90 return data->tag_id;
91}
92
98
99
100/*
101 * No inline functions for ABI.
102 */
103LXB_API const lxb_char_t *
105
106LXB_API const lxb_char_t *
108
111 const lxb_char_t *name, size_t len);
112
115
116
117#ifdef __cplusplus
118} /* extern "C" */
119#endif
120
121#endif /* LEXBOR_TAG_H */
size_t len
Definition apprentice.c:174
#define LXB_API
Definition def.h:48
#define NULL
Definition gdcache.h:45
lxb_inline lexbor_mraw_t * lexbor_hash_mraw(const lexbor_hash_t *hash)
Definition hash.h:155
lxb_inline lxb_char_t * lexbor_hash_entry_str(const lexbor_hash_entry_t *entry)
Definition hash.h:161
struct lexbor_hash lexbor_hash_t
Definition hash.h:41
struct lexbor_hash_entry lexbor_hash_entry_t
Definition hash.h:42
hash(string $algo, string $data, bool $binary=false, array $options=[])
Definition hash.stub.php:12
zend_constant * data
bool read_only
Definition tag.h:26
lexbor_hash_entry_t entry
Definition tag.h:23
size_t ref_count
Definition tag.h:25
lxb_tag_id_t tag_id
Definition tag.h:24
@ LXB_TAG__UNDEF
Definition const.h:24
uintptr_t lxb_tag_id_t
Definition const.h:21
LXB_API const lxb_char_t * lxb_tag_name_upper_by_id_noi(lxb_tag_id_t tag_id, size_t *len)
Definition tag.c:130
lxb_inline lexbor_mraw_t * lxb_tag_mraw(lexbor_hash_t *hash)
Definition tag.h:94
LXB_API lxb_tag_id_t lxb_tag_id_by_name_noi(lexbor_hash_t *hash, const lxb_char_t *name, size_t len)
Definition tag.c:136
lxb_inline lxb_tag_id_t lxb_tag_id_by_name(lexbor_hash_t *hash, const lxb_char_t *name, size_t len)
Definition tag.h:83
LXB_API lexbor_mraw_t * lxb_tag_mraw_noi(lexbor_hash_t *hash)
Definition tag.c:142
LXB_API const lxb_tag_data_t * lxb_tag_data_by_name(lexbor_hash_t *hash, const lxb_char_t *name, size_t len)
Definition tag.c:77
LXB_API const lxb_tag_data_t * lxb_tag_data_by_name_upper(lexbor_hash_t *hash, const lxb_char_t *name, size_t len)
LXB_API const lxb_char_t * lxb_tag_name_by_id_noi(lxb_tag_id_t tag_id, size_t *len)
Definition tag.c:124
lxb_inline const lxb_char_t * lxb_tag_name_by_id(lxb_tag_id_t tag_id, size_t *len)
Definition tag.h:45
lxb_inline const lxb_char_t * lxb_tag_name_upper_by_id(lxb_tag_id_t tag_id, size_t *len)
Definition tag.h:64
LXB_API const lxb_tag_data_t * lxb_tag_data_by_id(lxb_tag_id_t tag_id)
Definition tag.c:63
#define lxb_inline
Definition types.h:21
unsigned char lxb_char_t
Definition types.h:27
zend_string * name