summaryrefslogtreecommitdiff
path: root/src/core/string.h
blob: 9fca1fa2766554ceb2f59cf2bceda770b6257fe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * This file is part of libdom.
 * Licensed under the MIT License,
 *                http://www.opensource.org/licenses/mit-license.php
 * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
 */

#ifndef dom_internal_core_string_h_
#define dom_internal_core_string_h_

#include <dom/core/string.h>

/* 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