#ifndef _DWC_STRINGS_H
#define _DWC_STRINGS_H

/*--------------------------------------------------------------------------
 *  Copyright (c) 2001-2004 Igor Daniloff. 
 *	All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at this directory.
 *------------------------------------------------------------------------*/
 
/* $Id: dwc_strings.h,v 1.22 2005/09/21 09:20:44 asv Exp $ */

#include "dwc_queue.h"
#include "dwc_type.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
    DW_SD_FORWARD,
    DW_SD_BACKWARD
} dwc_direction_t;

#define DW_SD_BEGIN     DW_SD_FORWARD
#define DW_SD_END       DW_SD_BACKWARD

typedef struct dw_ml_string_t*  dwc_multistring_t;
typedef struct dw_mb_list_t*    dwc_mbuf_list_t;

extern dwc_multistring_t  dw_multistring_create  ( dwc_length_t      maxsize );
extern dwc_void_t         dw_multistring_delete  ( dwc_multistring_t list );
extern dwc_length_t       dw_multistring_count   ( dwc_multistring_t list );
extern dwc_length_t       dw_multistring_size    ( dwc_multistring_t list );
extern dwc_bool_t         dw_multistring_contain ( dwc_multistring_t list,
                                                   dwc_string_t      str );
extern dwc_bool_t         dw_multistring_add     ( dwc_multistring_t list, 
                                                   const char*       str );
extern dwc_bool_t         dw_multistring_add_int ( dwc_multistring_t list, 
                                                   const int         val );
extern dwc_bool_t         dw_multistring_append  ( dwc_multistring_t list, 
                                                   dwc_multistring_t str,
                                                   dwc_string_t      sep );
extern dwc_string_t       dw_multistring_concat  ( dwc_multistring_t list,
                                                   dwc_direction_t   dir );
extern dwc_bool_t         dw_multistring_rewind  ( dwc_multistring_t list, 
                                                   dwc_direction_t   dir );
extern dwc_string_t       dw_multistring_getnext ( dwc_multistring_t list );

/* */
extern dwc_mbuf_list_t    dw_mbuf_create  ( dwc_length_t     maxsize );
extern dwc_length_t       dw_mbuf_count   ( dwc_mbuf_list_t  list );
extern dwc_length_t       dw_mbuf_size    ( dwc_mbuf_list_t  list );
extern dwc_bool_t         dw_mbuf_add_chunk( dwc_mbuf_list_t list, 
                                             dwc_membuf_t    chunk,
                                             dwc_length_t    chunk_size );
extern dwc_membuf_t       dw_mbuf_to_linear( dwc_mbuf_list_t list,
                                             dwc_direction_t dir,
                                             dwc_bool_t      is_str );
extern dwc_void_t         dw_mbuf_delete  ( dwc_mbuf_list_t  list );

#ifdef __cplusplus
}
#endif

#endif /* _DWC_STRINGS_H */
