/* 	File: am_managed_string.h
 * 	Author(s): Pat Gunn
 * 	Date: 14 Aug 2003
 * 	Purpose: I've had to write code that builds strings far too often, and I want dynamically
 *		growable strings. Allocating and freeing too often really is irritating.
 */

#ifndef AM_MANAGED_STRING_H
#define AM_MANAGED_STRING_H

#include "standard.h"
#include "ambs.h"

typedef struct managed_string_struct
{
int managed_string_code;
char* content;
int length;
} managed_string;

managed_string* mk_managed_string(char* src);
void free_managed_string(managed_string* here);
managed_string* mk_copy_managed_string(managed_string* src);
char* mk_string_from_managed_string(managed_string* src);
char* ref_string_from_managed_string(managed_string* src);

void append_to_managed_string(managed_string* targ, char* stuff);
void prepend_to_managed_string(managed_string* targ, char* stuff);

void fprintf_into_managed_string(managed_string* targ, char* fmt, ...);

/* Replace all occurances of things from @chars in $targ with $rep */
void trans_managed_string(managed_string* targ, char* chars, char rep);
#endif
