Logo Search packages:      
Sourcecode: wvstreams version File versions

WvString WvBufBase< unsigned char >::getstr (  )  [inherited]

Returns the entire buffer as a null-terminated WvString.

If the buffer contains null characters, they will seem to prematurely terminate the string.

After this operation, ungettable() >= length of the string.

Returns: the buffer contents as a string

Definition at line 17 of file wvbuffer.cc.

References WvString::edit(), WvBufBaseCommonImpl< T >::move(), WvFastString::setsize(), and WvBufBaseCommonImpl< T >::used().

Referenced by WvEncoder::encodebufstr(), WvEncoder::flushstrstr(), WvX509Mgr::get_extension(), WvRSAKey::getpem(), non_breaking(), UniIniGen::refresh(), strreplace(), undupe(), url_encode(), and wvtcl_encode().

    /* Copy the contents into the string.
     * We used to just return a reference to those bytes, but
     * that required modifying the buffer to append a null
     * terminator, which does not work with read-only buffers.
     * This method is also somewhat safer if a little slower.
    WvString result;
    size_t len = used();
    result.setsize(len + 1);
    char *str = result.edit();
    move(str, len);
    str[len] = '\0';
    return result;

Generated by  Doxygen 1.6.0   Back to index