-/*
- * Copyright (c) 1995-2007, Index Data
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2008 Index Data.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $Id: wrbuf.h,v 1.26 2007-03-20 21:37:31 adam Exp $ */
/**
* \file wrbuf.h
/** \brief empty WRBUF content */
YAZ_EXPORT void wrbuf_rewind(WRBUF b);
-/** \brief grow WRBUF larger */
-YAZ_EXPORT int wrbuf_grow(WRBUF b, int minsize);
+/** \brief writes (append) buffer to WRBUF */
YAZ_EXPORT int wrbuf_write(WRBUF b, const char *buf, int size);
-YAZ_EXPORT int wrbuf_xmlputs_n(WRBUF b, const char *cp, int size);
+/** \brief appends C-string to WRBUF */
YAZ_EXPORT int wrbuf_puts(WRBUF b, const char *buf);
+
+/** \brief writes buffer to WRBUF and XML encode (as CDATA) */
+YAZ_EXPORT int wrbuf_xmlputs_n(WRBUF b, const char *cp, int size);
+/** \brief writes C-String to WRBUF and XML encode (as CDATA) */
+YAZ_EXPORT int wrbuf_xmlputs(WRBUF b, const char *cp);
+
YAZ_EXPORT int wrbuf_puts_replace_char(WRBUF b, const char *buf,
const char from, const char to);
-YAZ_EXPORT int wrbuf_xmlputs(WRBUF b, const char *cp);
+
+/** \brief writes buffer to WRBUF and escape non-ASCII characters */
+YAZ_EXPORT void wrbuf_puts_escaped(WRBUF b, const char *str);
+
+/** \brief writes C-string to WRBUF and escape non-ASCII characters */
+YAZ_EXPORT void wrbuf_write_escaped(WRBUF b, const char *buf, size_t len);
+
+/** \brief writes printf result to WRBUF */
YAZ_EXPORT void wrbuf_printf(WRBUF b, const char *fmt, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)))
int size);
YAZ_EXPORT int wrbuf_iconv_write_cdata(WRBUF b, yaz_iconv_t cd,
const char *buf, int size);
+YAZ_EXPORT int wrbuf_iconv_puts_cdata(WRBUF b, yaz_iconv_t cd,
+ const char *strz);
+
YAZ_EXPORT int wrbuf_iconv_puts(WRBUF b, yaz_iconv_t cd, const char *strz);
YAZ_EXPORT int wrbuf_iconv_putchar(WRBUF b, yaz_iconv_t cd, int ch);
/** \brief cut size of WRBUF */
YAZ_EXPORT void wrbuf_cut_right(WRBUF b, size_t no_to_remove);
+
+/** \brief grow WRBUF larger
+ This function is normally not used by applications
+*/
+YAZ_EXPORT int wrbuf_grow(WRBUF b, int minsize);
+
#define wrbuf_len(b) ((b)->pos)
#define wrbuf_buf(b) ((b)->buf)