summaryrefslogtreecommitdiff
path: root/include/dom/core
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2022-11-27 09:39:47 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2022-11-27 09:39:47 +0000
commitad4cdc900f197c0f373615d454275f38a9c4d181 (patch)
treef9963a39872b027025d5c1800ed36cb0908a2ec3 /include/dom/core
parent14f1b4abd5f395555e8d96e18c5db844bff17fde (diff)
downloadlibdom-ad4cdc900f197c0f373615d454275f38a9c4d181.tar.gz
libdom-ad4cdc900f197c0f373615d454275f38a9c4d181.tar.bz2
DOMTokenList: Initial implementation.
We cover the core behaviours of DOMTokenList and also DOMSettableTokenList so that the IDL can be implemented in NetSurf. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'include/dom/core')
-rw-r--r--include/dom/core/tokenlist.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/dom/core/tokenlist.h b/include/dom/core/tokenlist.h
new file mode 100644
index 0000000..718d3a5
--- /dev/null
+++ b/include/dom/core/tokenlist.h
@@ -0,0 +1,43 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2022 Daniel Silverstone <dsilvers@netsurf-browser.org>
+ */
+
+#ifndef dom_core_tokenlist_h_
+#define dom_core_tokenlist_h_
+
+#include <dom/core/exceptions.h>
+
+struct dom_element;
+struct dom_string;
+
+typedef struct dom_tokenlist dom_tokenlist;
+
+void dom_tokenlist_ref(struct dom_tokenlist *list);
+void dom_tokenlist_unref(struct dom_tokenlist *list);
+
+dom_exception dom_tokenlist_create(struct dom_element *ele, struct dom_string *attr, dom_tokenlist **list);
+
+dom_exception dom_tokenlist_get_length(struct dom_tokenlist *list,
+ uint32_t *length);
+dom_exception _dom_tokenlist_item(struct dom_tokenlist *list,
+ uint32_t index, struct dom_string **value);
+
+#define dom_tokenlist_item(l, i, n) _dom_tokenlist_item((dom_tokenlist *) (l), \
+ (uint32_t) (i), (struct dom_string **) (n))
+
+dom_exception dom_tokenlist_get_value(struct dom_tokenlist *list,
+ struct dom_string **value);
+
+dom_exception dom_tokenlist_set_value(struct dom_tokenlist *list,
+ struct dom_string *value);
+
+dom_exception dom_tokenlist_contains(struct dom_tokenlist *list, struct dom_string *value, bool *contains);
+
+dom_exception dom_tokenlist_add(struct dom_tokenlist *list, struct dom_string *value);
+
+dom_exception dom_tokenlist_remove(struct dom_tokenlist *list, struct dom_string *value);
+
+#endif