X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Fwrbuf.h;h=dc2a75d47740f540c080d708c59e17e56212642d;hp=56a40233f22c1bc42864f26aa9cc3ab3055706e3;hb=d72929b7de6221054feb6a220dc72289b0f3e03d;hpb=d38ee71c31b49ad13164039140ed47d18e9432cb diff --git a/include/yaz/wrbuf.h b/include/yaz/wrbuf.h index 56a4023..dc2a75d 100644 --- a/include/yaz/wrbuf.h +++ b/include/yaz/wrbuf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995-2007, Index Data + * 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: @@ -24,7 +24,7 @@ * (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 $ */ +/* $Id: wrbuf.h,v 1.29 2008-01-30 19:58:24 adam Exp $ */ /** * \file wrbuf.h @@ -56,14 +56,26 @@ YAZ_EXPORT void wrbuf_destroy(WRBUF b); /** \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))) @@ -74,6 +86,9 @@ YAZ_EXPORT int wrbuf_iconv_write(WRBUF b, yaz_iconv_t cd, const char *buf, 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); @@ -85,6 +100,12 @@ YAZ_EXPORT void wrbuf_chop_right(WRBUF b); /** \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)