Conversion Library
[Libraries]


Detailed Description

Created: 10th June 2006 Updated: 13th March 2007.

This library defines a number of components that provide conversion functionality.

The components provided by the Conversion Library include:


Classes

struct  ignore_interface_cast_exception
 A function class that does not throw any exceptions. More...
struct  throw_bad_interface_cast_exception
 A function class that throws the bad_interface_cast exception class. More...
struct  noaddref_release
 A function class that calls Release() on the interface. More...
struct  addref_release
 A function class that does not call Release() on the interface. More...
class  interface_cast_base
 Base class for the interface cast classes comstl::interface_cast_noaddref and comstl::interface_cast_addref. More...
class  interface_cast_noaddref
 Interface cast for raw pointers that does not add a net reference count. More...
class  interface_cast_addref
 Interface cast for raw pointers that does add a net reference count. More...
struct  any_caster_invalid_type
 Helper class used by any_caster, to define invalid conversions. More...
union  any_caster
 A dangerous, but sometimes necessary, tool for handling bad libraries. More...
class  multibyte2wide
 Converts a multibyte (char-based) string to a wide (whar_t-based) string. More...
class  wide2multibyte
 Converts a wide (whar_t-based) string to a multibyte (char-based) string. More...
class  explicit_cast
 This class is used to provide explicit casting operators. More...
class  explicit_cast< T & >
 Being able to cast to non-const references does not work, since the compilers will refuse to apply such to a temporary. More...
class  explicit_cast< T * >
 Not sure I really like this one, and reserve the right to remove it but for now it stays. More...
class  literal_cast
 Provides compile-time validation for casts of literal values. More...
struct  ptr_cast
 A cast that throws bad_cast for pointer cast failures, as well as for reference casts. More...
union  union_caster
 Cast class used by the union_cast cast function. More...
class  multibyte2wide
 Converts a multibyte (char-based) string to a wide (whar_t-based) string. More...
class  wide2multibyte
 Converts a wide (whar_t-based) string to a multibyte (char-based) string. More...
union  basic_resource_id
 Shim type for conversion between integer and c-string resource identifiers. More...

Typedefs

typedef multibyte2wide< 256 > m2w
 Type that converts a multibyte string to a wide string.
typedef wide2multibyte< 256 > w2m
 Type that converts a wide string to a multibyte string.
typedef multibyte2wide< 256 > a2w
 [Deprecated] Type that converts a multibyte string to a wide string.
typedef wide2multibyte< 256 > w2a
 [Deprecated] Type that converts a wide string to a multibyte string.
typedef multibyte2wide< 256 > m2w
 Type that converts a multibyte string to a wide string.
typedef wide2multibyte< 256 > w2m
 Type that converts a wide string to a multibyte string.
typedef multibyte2wide< 256 > a2w
 [Deprecated] Type that converts a multibyte string to a wide string.
typedef wide2multibyte< 256 > w2a
 [Deprecated] Type that converts a wide string to a multibyte string.
typedef basic_resource_id< char > resource_id_a
 Specialisation for use with the ANSI char type.
typedef basic_resource_id
< wchar_t > 
resource_id_w
 Specialisation for use with the Unicode wchar_t type.
typedef basic_resource_id< TCHAR > resource_id
 Specialisation for use with the Windows TCHAR type.
typedef stlsoft::union_caster
< LPARAM, char const *, true > 
StrA2LPARAM
 Checked conversion from char const* to LPARAM.
typedef stlsoft::union_caster
< LPARAM, wchar_t const
*, true > 
StrW2LPARAM
 Checked conversion from wchar_t const* to LPARAM.
typedef stlsoft::union_caster
< LPARAM, TCHAR const *, true > 
StrT2LPARAM
 Checked conversion from TCHAR const* to LPARAM.
typedef stlsoft::union_caster
< HWND, WPARAM, false > 
WPARAM2HWND
 Checked conversion from WPARAM to HWND.
typedef stlsoft::union_caster
< HWND, LPARAM, false > 
LPARAM2HWND
 Checked conversion from LPARAM to HWND.
typedef stlsoft::union_caster
< WPARAM, HWND, false > 
HWND2WPARAM
 Checked conversion from HWND to WPARAM.
typedef stlsoft::union_caster
< LPARAM, HWND, false > 
HWND2LPARAM
 Checked conversion from HWND to LPARAM.
typedef stlsoft::union_caster
< UINT, HWND, false > 
HWND2UINT
 Checked conversion from HWND to UINT.
typedef stlsoft::union_caster
< int, WPARAM, false > 
WPARAM2int
 Checked conversion from WPARAM to int.
typedef stlsoft::union_caster
< WPARAM, int, false > 
int2WPARAM
 Checked conversion from int to WPARAM.
typedef stlsoft::union_caster
< WPARAM, void *, true > 
Ptr2WPARAM
 Checked conversion from void* to WPARAM.
typedef stlsoft::union_caster
< LPARAM, void *, true > 
Ptr2LPARAM
 Checked conversion from void* to LPARAM.
typedef stlsoft::union_caster
< UINT, void *, true > 
Ptr2UINT
 Checked conversion from void* to UINT.
typedef stlsoft::union_caster
< char const *, int, true > 
Id2StrA
 Checked conversion from int to char const*.
typedef stlsoft::union_caster
< wchar_t const *, int, true > 
Id2StrW
 Checked conversion from int to wchar_t const*.
typedef stlsoft::union_caster
< TCHAR const *, int, true > 
Id2StrT
 Checked conversion from int to TCHAR const*.
typedef stlsoft::union_caster
< LPARAM, HICON, false > 
HICON2LPARAM
 Checked conversion from HICON to LPARAM.
typedef stlsoft::union_caster
< HICON, LONG, false > 
LONG2HICON
 Checked conversion from LONG to HICON.
typedef stlsoft::union_caster
< LRESULT, HICON, false > 
HICON2LRESULT
 Checked conversion from HICON to LRESULT.
typedef stlsoft::union_caster
< HICON, LRESULT, false > 
LRESULT2HICON
 Checked conversion from LRESULT to HICON.

Functions

template<typename I>
interface AddRef ()
template<typename IDest, typename ISrc>
bool interface_cast_test (ISrc *src)
 Determines whether an interface is available on an object.
template<typename IDest, typename ISrc>
bool interface_cast_test (stlsoft::ref_ptr< ISrc > &src)
 Determines whether an interface is available on an object.
template<typename IDest, typename ISrc>
stlsoft::ref_ptr< IDest > interface_cast (ISrc *src)
 Casts a raw interface pointer to a wrapped instance.
template<typename IDest, typename ISrc>
stlsoft::ref_ptr< IDest > interface_cast (stlsoft::ref_ptr< ISrc > src)
 Casts between instances of wrapped instances.
template<typename IDest, typename ISrc>
stlsoft::ref_ptr< IDest > try_interface_cast (ISrc *src)
 Attempts to cast a raw interface pointer to a wrapped instance.
template<typename IDest, typename ISrc>
stlsoft::ref_ptr< IDest > try_interface_cast (stlsoft::ref_ptr< ISrc > src)
 Attempts to cast between instances of wrapped instances.
template<typename R, typename C, typename V>
method_cast (C &c, HRESULT(C::*pfn)(V *))
template<typename R, typename C, typename V>
method_cast (C *c, HRESULT(STDAPICALLTYPE C::*pfn)(V *))
template<typename TO, typename FROM>
TO check_cast (FROM from)
 A cast operator function that performs runtime verification on the cast instance in debug builds.
size_t format_bytes (void const *pv, size_t cb, char *buff, size_t cchBuff, size_t byteGrouping, char const *groupSeparator, int groupsPerLine=-1, char const *lineSeparator="\n") throw ()
 Formats the contents of a contiguous block of memory into hexadecimal text, optionally aligning into groups and/or lines.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_sint8_t i)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_uint8_t i)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_sint16_t i)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_uint16_t i)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_sint32_t i)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_uint32_t i)
 Highly efficient conversion of integer to string.
template<typename C, size_t N>
C const * integer_to_string (C(&buf)[N], ss_sint8_t i)
 Highly efficient conversion of integer to string.
template<typename C, size_t N>
C const * integer_to_string (C(&buf)[N], ss_uint8_t i)
 Highly efficient conversion of integer to string.
template<typename C, size_t N>
C const * integer_to_string (C(&buf)[N], ss_sint16_t i)
 Highly efficient conversion of integer to string.
template<typename C, size_t N>
C const * integer_to_string (C(&buf)[N], ss_uint16_t i)
 Highly efficient conversion of integer to string.
template<typename C, size_t N>
C const * integer_to_string (C(&buf)[N], ss_sint32_t i)
 Highly efficient conversion of integer to string.
template<typename C, size_t N>
C const * integer_to_string (C(&buf)[N], ss_uint32_t i)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_sint8_t i, size_t &cchRes)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_uint8_t i, size_t &cchRes)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_sint16_t i, size_t &cchRes)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_uint16_t i, size_t &cchRes)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_sint32_t i, size_t &cchRes)
 Highly efficient conversion of integer to string.
template<typename C>
C const * integer_to_string (C *buf, size_t cchBuf, ss_uint32_t i, size_t &cchRes)
 Highly efficient conversion of integer to string.
template<typename C>
size_t translate_thousands (C *dest, size_t cchDest, C const *picture, C const *rawNumber, C fmtSep, C outputSep)
template<typename C, typename I>
size_t format_thousands (C *dest, size_t cchDest, C const *picture, I const &number, C fmtSep, C outputSep)
template<typename C, typename I>
size_t format_thousands (C *dest, size_t cchDest, C const *picture, I const &number)
template<typename TO, typename FROM>
TO sap_cast (FROM from)
 A cast operator function that casts between non void pointers of the same cv-qualification.
template<typename TO, typename FROM>
union_caster< TO, FROM, true > union_cast (FROM const from, bool bCheckAlign=true)
 A powerful cast operator that limits the danger of reinterpret_cast, while avoiding the spurious warnings issued by some compilers.
template<typename TO, typename FROM>
union_caster< TO, FROM, true > make_union_cast (FROM const from, bool bCheckAlign=true)
 [DEPRECATED] Synonym for stlsoft::union_cast().
template<typename C>
C const * int_to_string (ws_sint8_t value)
 Converts a signed 8-bit integer to a character string.
template<typename C>
C const * int_to_string (ws_uint8_t value)
 Converts a unsigned 8-bit integer to a character string.
template<typename C>
C const * int_to_string (ws_sint16_t value)
 Converts a signed 16-bit integer to a character string.
template<typename C>
C const * int_to_string (ws_uint16_t value)
 Converts a unsigned 16-bit integer to a character string.
template<typename C>
C const * int_to_string (ws_sint32_t value)
 Converts a signed 32-bit integer to a character string.
template<typename C>
C const * int_to_string (ws_uint32_t value)
 Converts a unsigned 32-bit integer to a character string.
template<typename C>
C const * int_to_string (ws_sint64_t const &value)
 Converts a signed 64-bit integer to a character string.
template<typename C>
C const * int_to_string (ws_uint64_t const &value)
 Converts a unsigned 64-bit integer to a character string.


Typedef Documentation

typedef multibyte2wide<256> a2w

[Deprecated] Type that converts a multibyte string to a wide string.

Deprecated:
This name is deprecated in favour of winstl::m2w

typedef multibyte2wide<256> a2w

[Deprecated] Type that converts a multibyte string to a wide string.

Deprecated:
This name is deprecated in favour of stlsoft::m2w

typedef stlsoft:: union_caster<LPARAM, HICON, false> HICON2LPARAM

Checked conversion from HICON to LPARAM.

typedef stlsoft:: union_caster<LRESULT, HICON, false> HICON2LRESULT

Checked conversion from HICON to LRESULT.

typedef stlsoft:: union_caster<LPARAM, HWND, false> HWND2LPARAM

Checked conversion from HWND to LPARAM.

typedef stlsoft:: union_caster<UINT, HWND, false> HWND2UINT

Checked conversion from HWND to UINT.

typedef stlsoft:: union_caster<WPARAM, HWND, false> HWND2WPARAM

Checked conversion from HWND to WPARAM.

typedef stlsoft:: union_caster<char const*, int, true> Id2StrA

Checked conversion from int to char const*.

typedef stlsoft:: union_caster<TCHAR const*, int, true> Id2StrT

Checked conversion from int to TCHAR const*.

typedef stlsoft:: union_caster<wchar_t const*, int, true> Id2StrW

Checked conversion from int to wchar_t const*.

typedef stlsoft:: union_caster<WPARAM, int, false> int2WPARAM

Checked conversion from int to WPARAM.

typedef stlsoft:: union_caster<HICON, LONG, false> LONG2HICON

Checked conversion from LONG to HICON.

typedef stlsoft:: union_caster<HWND, LPARAM, false> LPARAM2HWND

Checked conversion from LPARAM to HWND.

typedef stlsoft:: union_caster<HICON, LRESULT, false> LRESULT2HICON

Checked conversion from LRESULT to HICON.

typedef multibyte2wide<256> m2w

Type that converts a multibyte string to a wide string.

typedef multibyte2wide<256> m2w

Type that converts a multibyte string to a wide string.

typedef stlsoft:: union_caster<LPARAM, void*, true> Ptr2LPARAM

Checked conversion from void* to LPARAM.

typedef stlsoft:: union_caster<UINT, void*, true> Ptr2UINT

Checked conversion from void* to UINT.

typedef stlsoft:: union_caster<WPARAM, void*, true> Ptr2WPARAM

Checked conversion from void* to WPARAM.

typedef basic_resource_id<TCHAR> resource_id

Specialisation for use with the Windows TCHAR type.

typedef basic_resource_id< char > resource_id_a

Specialisation for use with the ANSI char type.

typedef basic_resource_id< wchar_t > resource_id_w

Specialisation for use with the Unicode wchar_t type.

typedef stlsoft:: union_caster<LPARAM, char const*, true> StrA2LPARAM

Checked conversion from char const* to LPARAM.

typedef stlsoft:: union_caster<LPARAM, TCHAR const*, true> StrT2LPARAM

Checked conversion from TCHAR const* to LPARAM.

typedef stlsoft:: union_caster<LPARAM, wchar_t const*, true> StrW2LPARAM

Checked conversion from wchar_t const* to LPARAM.

typedef wide2multibyte<256> w2a

[Deprecated] Type that converts a wide string to a multibyte string.

Deprecated:
This name is deprecated in favour of winstl::w2m

typedef wide2multibyte<256> w2a

[Deprecated] Type that converts a wide string to a multibyte string.

Deprecated:
This name is deprecated in favour of stlsoft::w2m

typedef wide2multibyte<256> w2m

Type that converts a wide string to a multibyte string.

typedef wide2multibyte<256> w2m

Type that converts a wide string to a multibyte string.

typedef stlsoft:: union_caster<HWND, WPARAM, false> WPARAM2HWND

Checked conversion from WPARAM to HWND.

typedef stlsoft:: union_caster<int, WPARAM, false> WPARAM2int

Checked conversion from WPARAM to int.


Function Documentation

TO stlsoft::dotnetstl_project::check_cast ( FROM  from  )  [inline]

A cast operator function that performs runtime verification on the cast instance in debug builds.

In debug builds, application of check_cast is equivalent to using __try_cast. In release builds it is equivalent to using static_cast.

size_t stlsoft::format_bytes ( void const *  pv,
size_t  cb,
char *  buff,
size_t  cchBuff,
size_t  byteGrouping,
char const *  groupSeparator,
int  groupsPerLine = -1,
char const *  lineSeparator = "\n" 
) throw () [inline]

Formats the contents of a contiguous block of memory into hexadecimal text, optionally aligning into groups and/or lines.

Parameters:
pv Pointer to the block
cb Number of bytes in the block
buff Pointer to the destination character buffer to receive the formatted contents
cchBuff Number of character spaces available in the buffer
byteGrouping Number of bytes in a group. Must be 0, 1, 2, 4, 6, 16 or 32. If 0, is reevaluated to sizeof(int)
groupSeparator Group separator. If NULL, defaults to ""
groupsPerLine Number of groups per line
lineSeparator Line separator. If NULL, no line separation is done
Returns:
If sufficient space was available, then the number of characters written to the buffer. Otherwise, returns a size that is guaranteed to be large enough to write the result.

References stlsoft::sap_cast(), STLSOFT_ASSERT, STLSOFT_MESSAGE_ASSERT, and STLSOFT_NUM_ELEMENTS.

size_t stlsoft::format_thousands ( C *  dest,
size_t  cchDest,
C const *  picture,
I const &  number 
) [inline]

Parameters:
dest Pointer to buffer to receive translation. If NULL, function returns required size.
cchDest Size of available buffer. Ignored if dest is NULL.
picture Grouping picture. May not be NULL. Behaviour is undefined if contains any characters other than fmtSep and digits.
number The raw number form. May not be NULL. Behaviour is undefined contains any characters other than digits.

size_t stlsoft::format_thousands ( C *  dest,
size_t  cchDest,
C const *  picture,
I const &  number,
fmtSep,
outputSep 
) [inline]

Parameters:
dest Pointer to buffer to receive translation. If NULL, function returns required size.
cchDest Size of available buffer. Ignored if dest is NULL.
picture Grouping picture. May not be NULL. Behaviour is undefined if contains any characters other than fmtSep and digits.
number The raw number form. May not be NULL. Behaviour is undefined contains any characters other than digits.
fmtSep The separator in the format.
outputSep The separator in the output.

References stlsoft::integer_to_string(), STLSOFT_NUM_ELEMENTS, STLSOFT_STATIC_ASSERT, and stlsoft::translate_thousands().

C const* winstl::int_to_string ( ws_uint64_t const &  value  )  [inline]

Converts a unsigned 64-bit integer to a character string.

For example:

unsigned char   v = 20;

assert(0 == ::strcmp(winstl::int_to_string<char>(v), "20"));
assert(0 == ::wcscmp(winstl::int_to_string<wchar_t>(v), L"20"));

Warning:
This function is *not* re-entrant. You must ensure that it is only invoked once in a statement. This includes possible invocations by other functions in the same statement.

References stlsoft::integer_to_string().

C const* winstl::int_to_string ( ws_sint64_t const &  value  )  [inline]

Converts a signed 64-bit integer to a character string.

For example:

signed char   v = 19;

assert(0 == ::strcmp(winstl::int_to_string<char>(v), "19"));
assert(0 == ::wcscmp(winstl::int_to_string<wchar_t>(v), L"19"));

Warning:
This function is *not* re-entrant. You must ensure that it is only invoked once in a statement. This includes possible invocations by other functions in the same statement.

References stlsoft::integer_to_string().

C const* winstl::int_to_string ( ws_uint32_t  value  )  [inline]

Converts a unsigned 32-bit integer to a character string.

For example:

unsigned char   v = 18;

assert(0 == ::strcmp(winstl::int_to_string<char>(v), "18"));
assert(0 == ::wcscmp(winstl::int_to_string<wchar_t>(v), L"18"));

Warning:
This function is *not* re-entrant. You must ensure that it is only invoked once in a statement. This includes possible invocations by other functions in the same statement.

References stlsoft::integer_to_string().

C const* winstl::int_to_string ( ws_sint32_t  value  )  [inline]

Converts a signed 32-bit integer to a character string.

For example:

signed char   v = 17;

assert(0 == ::strcmp(winstl::int_to_string<char>(v), "17"));
assert(0 == ::wcscmp(winstl::int_to_string<wchar_t>(v), L"17"));

Warning:
This function is *not* re-entrant. You must ensure that it is only invoked once in a statement. This includes possible invocations by other functions in the same statement.

References stlsoft::integer_to_string().

C const* winstl::int_to_string ( ws_uint16_t  value  )  [inline]

Converts a unsigned 16-bit integer to a character string.

For example:

unsigned char   v = 16;

assert(0 == ::strcmp(winstl::int_to_string<char>(v), "16"));
assert(0 == ::wcscmp(winstl::int_to_string<wchar_t>(v), L"16"));

Warning:
This function is *not* re-entrant. You must ensure that it is only invoked once in a statement. This includes possible invocations by other functions in the same statement.

References stlsoft::integer_to_string().

C const* winstl::int_to_string ( ws_sint16_t  value  )  [inline]

Converts a signed 16-bit integer to a character string.

For example:

signed char   v = 15;

assert(0 == ::strcmp(winstl::int_to_string<char>(v), "15"));
assert(0 == ::wcscmp(winstl::int_to_string<wchar_t>(v), L"15"));

Warning:
This function is *not* re-entrant. You must ensure that it is only invoked once in a statement. This includes possible invocations by other functions in the same statement.

References stlsoft::integer_to_string().

C const* winstl::int_to_string ( ws_uint8_t  value  )  [inline]

Converts a unsigned 8-bit integer to a character string.

For example:

unsigned char   v = 14;

assert(0 == ::strcmp(winstl::int_to_string<char>(v), "14"));
assert(0 == ::wcscmp(winstl::int_to_string<wchar_t>(v), L"14"));

Warning:
This function is *not* re-entrant. You must ensure that it is only invoked once in a statement. This includes possible invocations by other functions in the same statement.

References stlsoft::integer_to_string().

C const* winstl::int_to_string ( ws_sint8_t  value  )  [inline]

Converts a signed 8-bit integer to a character string.

For example:

signed char   v = 13;

assert(0 == ::strcmp(winstl::int_to_string<char>(v), "13"));
assert(0 == ::wcscmp(winstl::int_to_string<wchar_t>(v), L"13"));

Warning:
This function is *not* re-entrant. You must ensure that it is only invoked once in a statement. This includes possible invocations by other functions in the same statement.

References stlsoft::integer_to_string().

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_uint32_t  i,
size_t &  cchRes 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_sint32_t  i,
size_t &  cchRes 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_uint16_t  i,
size_t &  cchRes 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_sint16_t  i,
size_t &  cchRes 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_uint8_t  i,
size_t &  cchRes 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_sint8_t  i,
size_t &  cchRes 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C(&)  buf[N],
ss_uint32_t  i 
) [inline]

Highly efficient conversion of integer to string.

References STLSOFT_STATIC_ASSERT.

C const* stlsoft::integer_to_string ( C(&)  buf[N],
ss_sint32_t  i 
) [inline]

Highly efficient conversion of integer to string.

References STLSOFT_STATIC_ASSERT.

C const* stlsoft::integer_to_string ( C(&)  buf[N],
ss_uint16_t  i 
) [inline]

Highly efficient conversion of integer to string.

References STLSOFT_STATIC_ASSERT.

C const* stlsoft::integer_to_string ( C(&)  buf[N],
ss_sint16_t  i 
) [inline]

Highly efficient conversion of integer to string.

References STLSOFT_STATIC_ASSERT.

C const* stlsoft::integer_to_string ( C(&)  buf[N],
ss_uint8_t  i 
) [inline]

Highly efficient conversion of integer to string.

References STLSOFT_STATIC_ASSERT.

C const* stlsoft::integer_to_string ( C(&)  buf[N],
ss_sint8_t  i 
) [inline]

Highly efficient conversion of integer to string.

References STLSOFT_STATIC_ASSERT.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_uint32_t  i 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_sint32_t  i 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_uint16_t  i 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_sint16_t  i 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_uint8_t  i 
) [inline]

Highly efficient conversion of integer to string.

C const* stlsoft::integer_to_string ( C *  buf,
size_t  cchBuf,
ss_sint8_t  i 
) [inline]

Highly efficient conversion of integer to string.

Referenced by stlsoft::format_thousands(), and winstl::int_to_string().

stlsoft:: ref_ptr<IDest> comstl::interface_cast ( stlsoft::ref_ptr< ISrc >  src  )  [inline]

Casts between instances of wrapped instances.

stlsoft::ref_ptr<IStream>   stm = . . .

try
{
  stlsoft::ref_ptr<IStorage>  stg = comstl::interface_cast<IStorage>(stm);

  printf("Wrapper object has IStorage interface\n");
}
catch(comstl::bad_interface_cast &)
{
  printf("Wrapper object does not have IStorage interface\n");
}

Note:
For technical reasons, the cast destination type differs from the conventional behaviour. Rather than specifying the actual resultant type, e.g. stlsoft::ref_ptr<IStream>, just the destination interface type must be specified, e.g. interface_cast<IStream>.
Exceptions:
comstl::bad_interface_cast When compiling with exception - detected when STLSOFT_CF_EXCEPTION_SUPPORT is defined - this will throw an instance of comstl::bad_interface_cast if the requested interface cannot be acquired. When compiling absent exception support, this cast function is not defined; instead use comstl::try_interface_cast.
Examples:
by_library/conversion/interface_cast/interface_cast.cpp.

References comstl::interface_cast().

stlsoft:: ref_ptr<IDest> comstl::interface_cast ( ISrc *  src  )  [inline]

Casts a raw interface pointer to a wrapped instance.

IStream* stm = . . .

try
{
  stlsoft::ref_ptr<IStorage>  stg = comstl::interface_cast<IStorage>(stm);

  printf("Object has IStorage interface\n");
}
catch(comstl::bad_interface_cast &)
{
  printf("Object does not have IStorage interface\n");
}

Note:
For technical reasons, the cast destination type differs from the conventional behaviour. Rather than specifying the actual resultant type, e.g. stlsoft::ref_ptr<IStream>, just the destination interface type must be specified, e.g. interface_cast<IStream>.
Exceptions:
comstl::bad_interface_cast When compiling with exception - detected when STLSOFT_CF_EXCEPTION_SUPPORT is defined - this will throw an instance of comstl::bad_interface_cast if the requested interface cannot be acquired. When compiling absent exception support, this cast function is not defined; instead use comstl::try_interface_cast.
Examples:
by_library/com_utility/creation_functions/creation_functions.cpp, and by_project/comstl/comstl.cpp.

References stlsoft_ns_qual.

Referenced by comstl::interface_cast().

bool comstl::interface_cast_test ( stlsoft::ref_ptr< ISrc > &  src  )  [inline]

Determines whether an interface is available on an object.

stlsoft::ref_ptr<IStream>   stm = . . .

if(comstl::interface_cast_test<IStorage>(stm))
{
  printf("Wrapper object has IStorage interface\n");
}
else
{
  printf("Wrapper object does not have IStorage interface\n");
}

Parameters:
src wrapper instance holding the object whose capabilities will be tested. May be empty.

bool comstl::interface_cast_test ( ISrc *  src  )  [inline]

Determines whether an interface is available on an object.

Parameters:
src The object whose capabilities will be tested. May be NULL
IStream* stm = . . .

if(comstl::interface_cast_test<IStorage*>(stm))
{
  printf("Object has IStorage interface\n");
}
else
{
  printf("Object does not have IStorage interface\n");
}

union_caster<TO, FROM, true> stlsoft::make_union_cast ( FROM const   from,
bool  bCheckAlign = true 
) [inline]

[DEPRECATED] Synonym for stlsoft::union_cast().

Deprecated:
This function is now deprecated in favour of the new function union_cast.

TO stlsoft::sap_cast ( FROM  from  )  [inline]

A cast operator function that casts between non void pointers of the same cv-qualification.

The implementation of the operator uses compile-time enforcement of various constraints to ensure that:

  • the FROM and TO types are both pointers
  • no cv-qualifiers are stripped from the FROM type

For example, this cast is allowed:

int*          pi = . . .;
short const*  ps = stlsoft::sap_cast<short const*>(pi);

but this cast is not:

int const*    pi = . . .;
short*        ps = stlsoft::sap_cast<short*>(pi);

Parameters:
from The pointer to cast from.
Remarks:
The cast operator was inspired by an item in the Sutter/Alexandrescu coding standards book, and its names stands for Sutter-Alexandrescu-Pointer cast. The acronym is overloaded, since one might also be said to be a sap if one made injudicious use of the cast, due to its inherent dangers.
Examples:
by_library/conversion/sap_cast/sap_cast.cpp.

References ss_typename_type_k, and STLSOFT_STATIC_ASSERT.

Referenced by allocator_base< T, stlsoft::new_allocator< T > >::_Charalloc(), FORMATETC_policy::copy(), and stlsoft::format_bytes().

size_t stlsoft::translate_thousands ( C *  dest,
size_t  cchDest,
C const *  picture,
C const *  rawNumber,
fmtSep,
outputSep 
) [inline]

Parameters:
dest Pointer to buffer to receive translation. If NULL, function returns required size.
cchDest Size of available buffer. Ignored if dest is NULL.
picture Grouping picture. May not be NULL. Behaviour is undefined if contains any characters other than fmtSep and digits.
rawNumber The raw number form. May not be NULL. Behaviour is undefined contains any characters other than digits.
fmtSep The separator in the format.
outputSep The separator in the output.

References auto_buffer::end(), and STLSOFT_ASSERT.

Referenced by stlsoft::format_thousands().

stlsoft:: ref_ptr<IDest> comstl::try_interface_cast ( stlsoft::ref_ptr< ISrc >  src  )  [inline]

Attempts to cast between instances of wrapped instances.

Note:
For technical reasons, the cast destination type differs from the conventional behaviour. Rather than specifying the actual resultant type, e.g. stlsoft::ref_ptr<IStream>, just the destination interface type must be specified, e.g. interface_cast<IStream>.

References comstl::try_interface_cast().

stlsoft:: ref_ptr<IDest> comstl::try_interface_cast ( ISrc *  src  )  [inline]

Attempts to cast a raw interface pointer to a wrapped instance.

IStream*                    pstm  = . . .
stlsoft::ref_ptr<IStorage>  stg   = comstl::interface_cast<IStorage>(pstm);

if(!stg.empty())
{
  . . . // use stg->
}

Note:
For technical reasons, the cast destination type differs from the conventional behaviour. Rather than specifying the actual resultant type, e.g. stlsoft::ref_ptr<IStream>, just the destination interface type must be specified, e.g. interface_cast<IStream>.
Returns:

References stlsoft_ns_qual.

Referenced by comstl::try_interface_cast().

union_caster<TO, FROM, true> stlsoft::union_cast ( FROM const   from,
bool  bCheckAlign = true 
) [inline]

A powerful cast operator that limits the danger of reinterpret_cast, while avoiding the spurious warnings issued by some compilers.

A union cast would be applied as follows:

// This assumes sizeof(int) == sizeof(short*)

short  *ps;
int    i = stlsoft::union_cast<int>(ps);    // Ok: same size
double d = stlsoft::union_cast<double>(ps); // Compile error: different size
Examples:
by_library/conversion/union_cast/union_cast.cpp.

Referenced by comstl::CoInitSecurity().


Generated on Thu Jun 10 08:58:17 2010 for STLSoft by  doxygen 1.5.6