/* This class implements a dynamic string buffer Copyright (C) 1998 Martin Vogt This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation. For more information look at the file COPYRIGHT in this package */ #include "dynBuffer.h" #include using namespace std; DynBuffer::DynBuffer(int size) { nSize=size; msg=(char*) malloc(sizeof(char)*(nSize+1)); msg[nSize]='\0'; clear(); } DynBuffer::~DynBuffer() { free (msg); } void DynBuffer::clear() { msg[0]='\0'; } void DynBuffer::append(int value) { DynBuffer buf(30); sprintf(buf.getData(),"%d",value); append(buf.getData()); } void DynBuffer::append(char* appendMsg) { if (appendMsg == msg) { cout << "cannot append to self"< nlen) { bytes=nlen; } i=0; aktPos=bytes; while(aktPos <= nlen) { msg[i]=msg[aktPos]; i++; aktPos++; } } void DynBuffer::print() { printf("DynBuffer:%s\n",msg); }