#ifndef	__ACL_XMLCODE_INCLUDE_H__
#define	__ACL_XMLCODE_INCLUDE_H__

#include "../stdlib/acl_define.h"
#include "../stdlib/acl_vstring.h"

#ifdef	__cplusplus
extern "C" {
#endif

ACL_API int acl_xml_encode(const char *in, ACL_VSTRING *out);
ACL_API int acl_xml_decode(const char *in, ACL_VSTRING *out);

#ifndef ACL_CLIENT_ONLY

/**
 * xml ַ
 * @param in {const char**} Դַĵַغõַ¼δݵַ
 *  㹻õַָԴβĺһλ
 * @param ilen {size_t} Դݵݳ
 * @param out {char*} 洢תĽ
 * @param olen {size_t} ĴС
 * @return {size_t} ת洢ڵݳ(óпܴԴݳ)
 *  Ϊ
 *  1) == 0 ʱ 0
 *  2) == 1 ʱ 0һֽڱ '\0'
 *  3) > 1 ʱһֽڱ '\0'ֵ > 0( '\0')
 *  ע
 *  1) غ in ĵַᷢı䣬ָһĵַ
 *  2) ڵǰӦȱ in ĵַ in δʣĳȼ㷽ʽ
 *     ilen -= in_saved - in;
 *  3) Ȼ olen > 0 ʱڲԶ out β '\0صݳ
 *      '\0'
 */
ACL_API size_t acl_xml_encode2(const char** in, size_t ilen,
		char* out, size_t olen);

ACL_API const char *acl_xml_decode2(const char *in, char **out, size_t *size);

#endif /* ACL_CLIENT_ONLY */

#ifdef	__cplusplus
}
#endif

#endif
