1 /* 2 * Copyright (C) 2021-2022 Alexander Borisov 3 * 4 * Author: Alexander Borisov <borisov@lexbor.com> 5 */ 6 7 #ifndef LXB_CSS_AT_RULE_H 8 #define LXB_CSS_AT_RULE_H 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 #include "lexbor/css/base.h" 15 #include "lexbor/css/syntax/syntax.h" 16 #include "lexbor/css/at_rule/const.h" 17 18 19 typedef struct { 20 lxb_css_at_rule_type_t type; 21 lexbor_str_t prelude; 22 lexbor_str_t block; 23 } 24 lxb_css_at_rule__undef_t; 25 26 typedef struct { 27 lexbor_str_t name; 28 lexbor_str_t prelude; 29 lexbor_str_t block; 30 } 31 lxb_css_at_rule__custom_t; 32 33 typedef struct { 34 uintptr_t reserved; 35 } 36 lxb_css_at_rule_media_t; 37 38 typedef struct { 39 uintptr_t reserved; 40 } 41 lxb_css_at_rule_namespace_t; 42 43 44 LXB_API const lxb_css_entry_data_t * 45 lxb_css_at_rule_by_name(const lxb_char_t *name, size_t length); 46 47 LXB_API const lxb_css_entry_data_t * 48 lxb_css_at_rule_by_id(uintptr_t id); 49 50 LXB_API void * 51 lxb_css_at_rule_destroy(lxb_css_memory_t *memory, void *value, 52 lxb_css_at_rule_type_t type, bool self_destroy); 53 54 LXB_API lxb_status_t 55 lxb_css_at_rule_serialize(const void *style, lxb_css_at_rule_type_t type, 56 lexbor_serialize_cb_f cb, void *ctx); 57 LXB_API lxb_status_t 58 lxb_css_at_rule_serialize_str(const void *style, lxb_css_at_rule_type_t type, 59 lexbor_mraw_t *mraw, lexbor_str_t *str); 60 LXB_API lxb_status_t 61 lxb_css_at_rule_serialize_name(const void *style, lxb_css_at_rule_type_t type, 62 lexbor_serialize_cb_f cb, void *ctx); 63 LXB_API lxb_status_t 64 lxb_css_at_rule_serialize_name_str(const void *style, lxb_css_at_rule_type_t type, 65 lexbor_mraw_t *mraw, lexbor_str_t *str); 66 67 /* _undef. */ 68 69 LXB_API void * 70 lxb_css_at_rule__undef_create(lxb_css_memory_t *memory); 71 72 LXB_API void * 73 lxb_css_at_rule__undef_destroy(lxb_css_memory_t *memory, 74 void *style, bool self_destroy); 75 LXB_API lxb_status_t 76 lxb_css_at_rule__undef_make(lxb_css_parser_t *parser, 77 lxb_css_at_rule__undef_t *undef, 78 const lxb_css_syntax_at_rule_offset_t *at_rule); 79 LXB_API lxb_status_t 80 lxb_css_at_rule__undef_serialize(const void *style, lexbor_serialize_cb_f cb, 81 void *ctx); 82 LXB_API lxb_status_t 83 lxb_css_at_rule__undef_serialize_name(const void *at, lexbor_serialize_cb_f cb, 84 void *ctx); 85 86 /* _custom. */ 87 88 LXB_API void * 89 lxb_css_at_rule__custom_create(lxb_css_memory_t *memory); 90 91 LXB_API void * 92 lxb_css_at_rule__custom_destroy(lxb_css_memory_t *memory, 93 void *style, bool self_destroy); 94 LXB_API lxb_status_t 95 lxb_css_at_rule__custom_make(lxb_css_parser_t *parser, 96 lxb_css_at_rule__custom_t *custom, 97 const lxb_css_syntax_at_rule_offset_t *at_rule); 98 LXB_API lxb_status_t 99 lxb_css_at_rule__custom_serialize(const void *style, lexbor_serialize_cb_f cb, 100 void *ctx); 101 LXB_API lxb_status_t 102 lxb_css_at_rule__custom_serialize_name(const void *at, lexbor_serialize_cb_f cb, 103 void *ctx); 104 105 /* Media. */ 106 107 LXB_API void * 108 lxb_css_at_rule_media_create(lxb_css_memory_t *memory); 109 110 LXB_API void * 111 lxb_css_at_rule_media_destroy(lxb_css_memory_t *memory, 112 void *style, bool self_destroy); 113 LXB_API lxb_status_t 114 lxb_css_at_rule_media_serialize(const void *style, lexbor_serialize_cb_f cb, 115 void *ctx); 116 117 /* Namespace. */ 118 119 LXB_API void * 120 lxb_css_at_rule_namespace_create(lxb_css_memory_t *memory); 121 122 LXB_API void * 123 lxb_css_at_rule_namespace_destroy(lxb_css_memory_t *memory, 124 void *style, bool self_destroy); 125 LXB_API lxb_status_t 126 lxb_css_at_rule_namespace_serialize(const void *style, lexbor_serialize_cb_f cb, 127 void *ctx); 128 129 130 #ifdef __cplusplus 131 } /* extern "C" */ 132 #endif 133 134 #endif /* LXB_CSS_AT_RULE_H */ 135