Copyright (C) Kevin Larke 2009-2020

This file is part of libcm.

libcm 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, either version 3 of the License, or (at your option) any later version.

libcm 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.

See the GNU General Public License distributed with the libcm package or look here: .


cmStrStream : String stream text sink.

enum
{
  kOkSsRC = cmOkRC,
  kLHeapMemFailSsRC
};

typedef cmHandle_t cmStrStreamH_t;
typedef cmRC_t     cmSsRC_t;

extern cmStrStreamH_t cmStrStreamNullHandle;


// If 'dfltBlkByteCnt' 'is set to 0 then the dfltBlkByteCnt is internally set to 4096.
cmSsRC_t cmOStrStreamCreate( cmCtx_t* ctx, cmStrStreamH_t* hp, unsigned dfltBlkByteCnt );
cmSsRC_t cmOStrStreamDestroy( cmStrStreamH_t* hp );

bool     cmOStrStreamIsValid( cmStrStreamH_t h );

cmSsRC_t cmOStrStreamWrite(     cmStrStreamH_t h, const void* dp, unsigned byteCnt );
cmSsRC_t cmOStrStreamWriteStr(  cmStrStreamH_t h, const cmChar_t* str );
cmSsRC_t cmOStrStreamWriteStrN( cmStrStreamH_t h, const cmChar_t* str, unsigned n );
cmSsRC_t cmOStrStreamVPrintf(   cmStrStreamH_t h, const cmChar_t* fmt, va_list vl );  
cmSsRC_t cmOStrStreamPrintf(    cmStrStreamH_t h, const cmChar_t* fmt, ... );

unsigned  cmOStrStreamByteCount( cmStrStreamH_t h );
void*     cmOStrStreamAllocBuf(  cmStrStreamH_t h );
cmChar_t* cmOStrStreamAllocText( cmStrStreamH_t h );