diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2014-01-23 23:41:58 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2014-01-23 23:41:58 +0000 |
commit | 91bee91db8eb8d9a62afb31b3be5a834e8f2135d (patch) | |
tree | dec17afa252b302448e5e7c3d583c553967420d4 /src/core/string.h | |
parent | 7cf749f4a5d167e924d5ea2fc3d1772ff697d6e1 (diff) | |
download | libdom-91bee91db8eb8d9a62afb31b3be5a834e8f2135d.tar.gz libdom-91bee91db8eb8d9a62afb31b3be5a834e8f2135d.tar.bz2 |
Strip and collapse whitespace when gathering html option values.
Diffstat (limited to 'src/core/string.h')
-rw-r--r-- | src/core/string.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/string.h b/src/core/string.h index cbf7d36..9fca1fa 100644 --- a/src/core/string.h +++ b/src/core/string.h @@ -14,5 +14,28 @@ /* Map the lwc_error to dom_exception */ dom_exception _dom_exception_from_lwc_error(lwc_error err); +enum dom_whitespace_op { + DOM_WHITESPACE_STRIP_LEADING = (1 << 0), + DOM_WHITESPACE_STRIP_TRAILING = (1 << 1), + DOM_WHITESPACE_STRIP = DOM_WHITESPACE_STRIP_LEADING | + DOM_WHITESPACE_STRIP_TRAILING, + DOM_WHITESPACE_COLLAPSE = (1 << 2), + DOM_WHITESPACE_STRIP_COLLAPSE = DOM_WHITESPACE_STRIP | + DOM_WHITESPACE_COLLAPSE +}; + +/** Perform whitespace operations on given string + * + * \param s Given string + * \param op Whitespace operation(s) to perform + * \param ret New string with whitespace ops performed. Caller owns ref + * + * \return DOM_NO_ERR on success. + * + * \note Right now, will return DOM_NOT_SUPPORTED_ERR if ascii_only is false. + */ +dom_exception dom_string_whitespace_op(dom_string *s, + enum dom_whitespace_op op, dom_string **ret); + #endif |