/*
 * frostbasicstring.h
 *
 *  Created on: Jun 29, 2012
 *      Author: ergino
 */

#include "frost_common.h"
#include <stdio.h>
#include <stdarg.h>

#ifndef FROST_BASICSTRING_H_
#define FROST_BASICSTRING_H_

#ifdef __cplusplus
extern "C"
{
#endif

typedef struct frost_basic_string
{
    char *str;
    unsigned long len;
    unsigned long allocated_len;
} frost_basic_string;

frost_basic_string     *frost_string_new                (const char *init);
frost_basic_string     *frost_string_new_len            (const char *init, signed   long len);
frost_basic_string     *frost_string_sized_new          (unsigned long default_size);
char                   *frost_string_free               (frost_basic_string *string, frost_bool free_segment);
frost_basic_string     *frost_string_append             (frost_basic_string *string, const char *val);
void                   frost_string_printf              (frost_basic_string *string, const char *format, ...);
void                   frost_string_append_printf      (frost_basic_string *string, const char *format, ...);
frost_basic_string     *frost_string_append_c           (frost_basic_string *string, char c);
frost_basic_string     *frost_string_append             (frost_basic_string *string, const char *val);
frost_basic_string     *frost_string_append_len         (frost_basic_string *string, const char *val, signed   long len);
frost_basic_string     *frost_string_truncate           (frost_basic_string *string, unsigned long len);
frost_basic_string     *frost_string_prepend            (frost_basic_string *string, const char *val);
frost_basic_string     *frost_string_erase              (frost_basic_string *string, signed   long pos, signed   long len);
frost_basic_string     *frost_string_insert             (frost_basic_string *string, signed   long pos, const char *val);
void                  frost_string_append_printf       (frost_basic_string *string, const char *format, ...);
void                  frost_string_append_vprintf      (frost_basic_string *string, const char *format, va_list args);
void                  frost_string_printf               (frost_basic_string *string, const char *format, ...);
frost_basic_string    *frost_string_truncate            (frost_basic_string *string, unsigned long len);
frost_basic_string    *frost_string_set_size            (frost_basic_string *string, unsigned long len);

#ifdef __cplusplus
}
#endif

#endif /* FROSTBASICSTRING_H_ */
