StringBuffer.h File Reference

#include <algorithm>
#include "../debug/Log.h"
#include "ScratchBuffer.h"

Go to the source code of this file.

Namespaces

namespace  oasys

Classes

class  oasys::StringBuffer
 Utility class that wraps a growable string buffer, similar to std::ostringstream, but with printf() style arguments instead of the << operator. More...
class  oasys::StaticStringBuffer< _sz >
 Initially stack allocated StringBuffer, which handles the common cases where the StringBuffer is used to sprintf a bunch of stuff together. More...

Defines

#define STRINGBUFFER_VAPPENDF(_stringbuf, _fmt)
 Since it's unsafe to call a function multiple times with the same va_list, this wrapper macro is needed to wrap multiple calls to vsnprintf in a varargs function.


Define Documentation

#define STRINGBUFFER_VAPPENDF ( _stringbuf,
_fmt   ) 

Value:

do {                                                        \
        size_t ret;                                             \
        size_t len = 0;                                         \
                                                                \
        /* call once optimistically with no known length */     \
        {                                                       \
            va_list ap;                                         \
            va_start(ap, _fmt);                                 \
            ret = (_stringbuf).vappendf(_fmt, &len, ap);        \
            va_end(ap);                                         \
        }                                                       \
                                                                \
        /* call again with the known length */                  \
        if (ret >= len)                                         \
        {                                                       \
            (_stringbuf).trim(len);                             \
            len = ret;                                          \
            va_list ap;                                         \
            va_start(ap, _fmt);                                 \
            ret = (_stringbuf).vappendf(_fmt, &len, ap);        \
            va_end(ap);                                         \
        }                                                       \
                                                                \
        ASSERT(ret == len);                                     \
    } while (0)
Since it's unsafe to call a function multiple times with the same va_list, this wrapper macro is needed to wrap multiple calls to vsnprintf in a varargs function.

Definition at line 179 of file StringBuffer.h.

Referenced by oasys::StringBuffer::appendf(), oasys::TclCommandInterp::shutdown(), oasys::StaticStringBuffer< _sz >::StaticStringBuffer(), and oasys::StringBuffer::StringBuffer().


Generated on Sat Sep 8 08:36:19 2007 for DTN Reference Implementation by  doxygen 1.5.3