blocxx
Namespaces | Functions

SafeCString.cpp File Reference

#include "blocxx/BLOCXX_config.h"
#include "blocxx/SafeCString.hpp"
#include <cstring>
#include <new>

Go to the source code of this file.

Namespaces

namespace  BLOCXX_NAMESPACE
 

Taken from RFC 1321.


namespace  BLOCXX_NAMESPACE::SafeCString
namespace  BLOCXX_NAMESPACE::SafeCString::Impl

Functions

 BLOCXX_NAMESPACE::SafeCString::BLOCXX_DEFINE_EXCEPTION (Overflow)
char * BLOCXX_NAMESPACE::SafeCString::str_dup (char const *s)
 Like std::strdup, except that new is used to allocate memory.
char * BLOCXX_NAMESPACE::SafeCString::str_dup_nothrow (char const *s)
 Like std::strdup, except that no-throw new is used to allocate memory and NULL is returned on allocation failure.
char * BLOCXX_NAMESPACE::SafeCString::strcpy_trunc (char *dst, std::size_t dstsize, char const *src)
 PROMISE: copies the first n = min(strlen(src), dstsize - 1) characters of C-string src to dst, null-terminating the result.
char * BLOCXX_NAMESPACE::SafeCString::strcpy_trunc (char *dst, std::size_t dstsize, char const *src, std::size_t srclen)
 PROMISE: copies the first n = min(strlen(src), srclen, dstsize - 1) characters of C-string src to dst, null-terminating the result.
char * BLOCXX_NAMESPACE::SafeCString::strcpy_check (char *dst, std::size_t dstsize, char const *src)
 PROMISE: copies the first n = min(strlen(src), dstsize - 1) chars of the C-string src to dst and appends a terminating '\0'.
char * BLOCXX_NAMESPACE::SafeCString::strcpy_check (char *dst, std::size_t dstsize, char const *src, std::size_t srclen)
 PROMISE: copies the first min(n, dstsize - 1) chars of the C-string src to dst, where n = min(strlen(src), srclen), and appends a terminating '\0'.
char * BLOCXX_NAMESPACE::SafeCString::strcat_trunc (char *dst, std::size_t dstsize, char const *src)
 PROMISE: If dst[0..dstsize-1] contains a '\0', appends to C-string dst the first min(strlen(src), dstsize - 1 - strlen(dst)) characters of C-string src, and null terminates the result.
char * BLOCXX_NAMESPACE::SafeCString::strcat_trunc (char *dst, std::size_t dstsize, char const *src, std::size_t srclen)
 PROMISE: If dst[0..dstsize-1] contains a '\0', appends to C-string dst the first min(strlen(src), srclen, dstsize - 1 - strlen(dst)) characters of C-string src, and null terminates the result.
char * BLOCXX_NAMESPACE::SafeCString::strcat_check (char *dst, std::size_t dstsize, char const *src)
 PROMISE: If dst[0..dstsize-1] contains a '\0', appends to C-string dst the first min(strlen(src), dstsize - 1 - strlen(dst)) characters of C-string src and null terminates the result.
char * BLOCXX_NAMESPACE::SafeCString::strcat_check (char *dst, std::size_t dstsize, char const *src, std::size_t srclen)
 PROMISE: If dst[0..dstsize-1] contains a '\0', appends to C-string dst the first min(N, dstsize - 1 - strlen(dst)) characters of C-string src, where N = min(strlen(src), srclen), and null terminates the result.
std::size_t BLOCXX_NAMESPACE::SafeCString::Impl::nchars_check (int retval, std::size_t dstsize)