resizeablestringformatter.h

来自「跨操作系统的微型中间件」· C头文件 代码 · 共 41 行

H
41
字号
/*    File:       ResizeableStringFormatter.h    Contains:   Derived from StringFormatter, this transparently grows the                output buffer if the original buffer is too small to hold all                the data being placed in it        */#ifndef __RESIZEABLE_STRING_FORMATTER_H__#define __RESIZEABLE_STRING_FORMATTER_H__#include "StringFormatter.h"class ResizeableStringFormatter : public StringFormatter{    public:        // Pass in inBuffer=NULL and inBufSize=0 to dynamically allocate the initial buffer.        ResizeableStringFormatter(char* inBuffer = NULL, UInt32 inBufSize = 0)            : StringFormatter(inBuffer, inBufSize), fOriginalBuffer(inBuffer) {}                //If we've been forced to increase the buffer size, fStartPut WILL be a dynamically allocated        //buffer, and it WON'T be equal to fOriginalBuffer (obviously).        virtual ~ResizeableStringFormatter() {  if (fStartPut != fOriginalBuffer) delete [] fStartPut; }    private:                // This function will get called by StringFormatter if the current        // output buffer is full. This object allocates a buffer that's twice        // as big as the old one.        virtual void    BufferIsFull(char* inBuffer, UInt32 inBufferLen);                char*           fOriginalBuffer;        };#endif //__RESIZEABLE_STRING_FORMATTER_H__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?