/* * Copyright (C) 2007 Tildeslash Ltd. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * There are special exceptions to the terms and conditions of the GPL * as it is applied to this software. View the full text of the exception * in the file EXCEPTIONS accompanying this software distribution. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef STRINGBUFFER_H #define STRINGBUFFER_H #include /** * A String Buffer implements a mutable sequence of characters. * * @version \$Id: StringBuffer.h,v 1.11 2007/01/02 10:29:52 hauk Exp $ * @file */ #define T StringBuffer_T typedef struct T *T; /** * Constructs a string buffer so that it represents the same sequence of * characters as the string argument; in other words, the initial contents * of the string buffer is a copy of the argument string. * @param s the initial contents of the buffer * @return A new StringBuffer object */ T StringBuffer_new(const char *s); /** * Destroy a StringBuffer object and free allocated resources * @param S a StringBuffer object reference */ void StringBuffer_free(T *S); /** * The characters of the String argument are appended, in order, to the * contents of this string buffer, increasing the length of this string * buffer by the length of the arguments. * @param S StringBuffer object * @param s A string with optional var args * @return a reference to this StringBuffer */ T StringBuffer_append(T S, const char *s, ...); /** * The characters of the String argument are appended, in order, to the * contents of this string buffer, increasing the length of this string * buffer by the length of the arguments. * @param S StringBuffer object * @param s A string with optional var args * @param ap A variable argument list * @return a reference to this StringBuffer */ T StringBuffer_vappend(T S, const char *s, va_list ap); /** * Returns the length (character count) of this string buffer. * @param S StringBuffer object * @return the length of the sequence of characters currently represented * by this string buffer */ int StringBuffer_length(T S); /** * Clear the contents of the string buffer. I.e. set buffer length to 0. * @param S StringBuffer object */ void StringBuffer_clear(T S); /** * Converts to a string representing the data in this string buffer. * @param S StringBuffer object * @return a string representation of the string buffer */ const char *StringBuffer_toString(T S); #undef T #endif