libdom
Loading...
Searching...
No Matches
attr.h
Go to the documentation of this file.
1/*
2 * This file is part of libdom.
3 * Licensed under the MIT License,
4 * http://www.opensource.org/licenses/mit-license.php
5 * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
6 */
7
8#ifndef dom_core_attr_h_
9#define dom_core_attr_h_
10
11#include <stdbool.h>
12
13#include <dom/core/exceptions.h>
14#include <dom/core/node.h>
15
16struct dom_element;
17struct dom_type_info;
18struct dom_node;
19struct dom_attr;
20
21typedef struct dom_attr dom_attr;
22
33
34/* DOM Attr vtable */
35typedef struct dom_attr_vtable {
37
39 dom_string **result);
41 bool *result);
43 dom_string **result);
45 dom_string *value);
47 struct dom_element **result);
49 struct dom_type_info **result);
50 dom_exception (*dom_attr_is_id)(struct dom_attr *attr, bool *result);
52
53static inline dom_exception dom_attr_get_name(struct dom_attr *attr,
54 dom_string **result)
55{
56 return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
57 dom_attr_get_name(attr, result);
58}
59#define dom_attr_get_name(a, r) dom_attr_get_name((struct dom_attr *) (a), (r))
60
61static inline dom_exception dom_attr_get_specified(struct dom_attr *attr,
62 bool *result)
63{
64 return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
65 dom_attr_get_specified(attr, result);
66}
67#define dom_attr_get_specified(a, r) dom_attr_get_specified( \
68 (struct dom_attr *) (a), (bool *) (r))
69
70static inline dom_exception dom_attr_get_value(struct dom_attr *attr,
71 dom_string **result)
72{
73 return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
74 dom_attr_get_value(attr, result);
75}
76#define dom_attr_get_value(a, r) dom_attr_get_value((struct dom_attr *) (a), (r))
77
78static inline dom_exception dom_attr_set_value(struct dom_attr *attr,
80{
81 return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
83}
84#define dom_attr_set_value(a, v) dom_attr_set_value((struct dom_attr *) (a), (v))
85
86static inline dom_exception dom_attr_get_owner_element(struct dom_attr *attr,
87 struct dom_element **result)
88{
89 return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
90 dom_attr_get_owner_element(attr, result);
91}
92#define dom_attr_get_owner_element(a, r) dom_attr_get_owner_element(\
93 (struct dom_attr *) (a), (struct dom_element **) (r))
94
96 struct dom_attr *attr, struct dom_type_info **result)
97{
98 return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
100}
101#define dom_attr_get_schema_type_info(a, r) dom_attr_get_schema_type_info( \
102 (struct dom_attr *) (a), (struct dom_type_info **) (r))
103
104static inline dom_exception dom_attr_is_id(struct dom_attr *attr, bool *result)
105{
106 return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
107 dom_attr_is_id(attr, result);
108}
109#define dom_attr_is_id(a, r) dom_attr_is_id((struct dom_attr *) (a), \
110 (bool *) (r))
111
112/*-----------------------------------------------------------------------*/
144/* Make a attribute node readonly */
146
147#endif
dom_exception
Definition exceptions.h:24
dom_exception dom_attr_set_short(dom_attr *a, unsigned short value)
Definition attr.c:288
#define dom_attr_get_value(a, r)
Definition attr.h:76
#define dom_attr_set_value(a, v)
Definition attr.h:84
dom_exception dom_attr_set_bool(dom_attr *a, bool value)
Definition attr.c:350
void dom_attr_mark_readonly(dom_attr *a)
Definition attr.c:389
dom_exception dom_attr_get_bool(dom_attr *a, bool *value)
Definition attr.c:331
#define dom_attr_get_specified(a, r)
Definition attr.h:67
dom_exception dom_attr_get_short(dom_attr *a, unsigned short *value)
Definition attr.c:269
struct dom_attr_vtable dom_attr_vtable
dom_exception dom_attr_set_integer(dom_attr *a, uint32_t value)
Definition attr.c:226
#define dom_attr_is_id(a, r)
Definition attr.h:109
#define dom_attr_get_name(a, r)
Definition attr.h:59
dom_attr_type dom_attr_get_type(dom_attr *a)
Definition attr.c:193
dom_exception dom_attr_get_integer(dom_attr *a, uint32_t *value)
Definition attr.c:207
#define dom_attr_get_owner_element(a, r)
Definition attr.h:92
#define dom_attr_get_schema_type_info(a, r)
Definition attr.h:101
dom_attr_type
Definition attr.h:26
@ DOM_ATTR_STRING
Definition attr.h:28
@ DOM_ATTR_UNSET
Definition attr.h:27
@ DOM_ATTR_INTEGER
Definition attr.h:31
@ DOM_ATTR_BOOL
Definition attr.h:29
@ DOM_ATTR_SHORT
Definition attr.h:30
Definition attr.h:35
struct dom_node_vtable base
Definition attr.h:36
dom_exception(* dom_attr_get_name)(struct dom_attr *attr, dom_string **result)
Definition attr.h:38
dom_exception(* dom_attr_is_id)(struct dom_attr *attr, bool *result)
Definition attr.h:50
dom_exception(* dom_attr_get_owner_element)(struct dom_attr *attr, struct dom_element **result)
Definition attr.h:46
dom_exception(* dom_attr_set_value)(struct dom_attr *attr, dom_string *value)
Definition attr.h:44
dom_exception(* dom_attr_get_schema_type_info)(struct dom_attr *attr, struct dom_type_info **result)
Definition attr.h:48
dom_exception(* dom_attr_get_value)(struct dom_attr *attr, dom_string **result)
Definition attr.h:42
dom_exception(* dom_attr_get_specified)(struct dom_attr *attr, bool *result)
Definition attr.h:40
Definition attr.c:31
union dom_attr::@1 value
Definition element.h:29
Definition node.h:85
Definition node.h:79
Definition string.h:19
Definition typeinfo.c:14