StormByte 2.0.0
C++26 foundation of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Safe Namespace Reference

Types that are safe to pass across a DLL boundary: owners and polymorphic clones on Base's heap. More...

Namespaces

namespace  Heap
 Allocate and free raw blocks on Base's heap.
 

Classes

class  Clonable
 Polymorphic copy and move through a base. More...
 
class  CString
 Owned NUL-terminated buffer, safe to use across a DLL boundary. More...
 
class  Shared
 Shared owner of a T allocated on Base's heap. More...
 
class  String
 Owned UTF-8 text composed of StormByte::Safe::CString. More...
 
class  Unique
 Unique owner of a T allocated on Base's heap. More...
 
class  WCString
 Owned NUL-terminated wide buffer, safe to use across a DLL boundary. More...
 
class  Weak
 Non-owning observer of a Shared control block. More...
 
class  WString
 Wide counterpart of String. More...
 

Concepts

concept  ValidSmartPointer
 true when SmartPointer is StormByte::Safe::Shared<T> or StormByte::Safe::Unique<T>.
 

Functions

std::ostream & operator<< (std::ostream &stream, const CString &text)
 Writes text to stream.
 
bool operator== (const char *str, const CString &text) noexcept
 Content equality.
 
bool operator!= (const char *str, const CString &text) noexcept
 Content inequality.
 
void swap (CString &left, CString &right) noexcept
 Swaps two buffers.
 
template<class T , class U >
Shared< T > StaticPointerCast (const Shared< U > &from) noexcept
 static_cast of the stored pointer.
 
template<class T , class U >
Shared< T > DynamicPointerCast (const Shared< U > &from) noexcept
 dynamic_cast of the stored pointer.
 
template<class T , class U >
Shared< T > ConstPointerCast (const Shared< U > &from) noexcept
 const_cast of the stored pointer.
 
template<class T , class U >
Shared< T > ReinterpretPointerCast (const Shared< U > &from) noexcept
 reinterpret_cast of the stored pointer.
 
std::ostream & operator<< (std::ostream &stream, const String &text)
 Writes text to stream.
 
bool operator== (const char *str, const String &text) noexcept
 Content equality.
 
bool operator!= (const char *str, const String &text) noexcept
 Content inequality.
 
void swap (String &left, String &right) noexcept
 Swaps two texts.
 
std::wostream & operator<< (std::wostream &stream, const WCString &text)
 Writes text to stream.
 
bool operator== (const wchar_t *str, const WCString &text) noexcept
 Content equality.
 
bool operator!= (const wchar_t *str, const WCString &text) noexcept
 Content inequality.
 
void swap (WCString &left, WCString &right) noexcept
 Swaps two buffers.
 
std::wostream & operator<< (std::wostream &stream, const WString &text)
 Writes text to stream.
 
bool operator== (const wchar_t *str, const WString &text) noexcept
 Content equality.
 
bool operator!= (const wchar_t *str, const WString &text) noexcept
 Content inequality.
 
void swap (WString &left, WString &right) noexcept
 Swaps two texts.
 

Variables

template<class T >
class STORMBYTE_PUBLIC_TYPE Shared
 
template<class T >
class STORMBYTE_PUBLIC_TYPE Unique
 
template<class T >
class STORMBYTE_PUBLIC_TYPE Weak
 

Detailed Description

Types that are safe to pass across a DLL boundary: owners and polymorphic clones on Base's heap.

Unit count. Defined in size.hxx. Forwarded so Type::Sized can name it.

Owned UTF-8 and wide text on top of StormByte::Safe::CString / StormByte::Safe::WCString.

Types safe to pass across a DLL boundary.

Suite text types owned by Base.

Function Documentation

◆ ConstPointerCast()

template<class T , class U >
Shared< T > StormByte::Safe::ConstPointerCast ( const Shared< U > &  from)
noexcept

const_cast of the stored pointer.

The control block stays.

Template Parameters
TTarget pointee.
USource pointee.
Parameters
fromOwner.
Returns
Owner of the cast pointer.

◆ DynamicPointerCast()

template<class T , class U >
Shared< T > StormByte::Safe::DynamicPointerCast ( const Shared< U > &  from)
noexcept

dynamic_cast of the stored pointer.

Empty when the cast fails.

Template Parameters
TTarget pointee.
USource pointee.
Parameters
fromOwner.
Returns
Owner of the cast pointer, or empty.

◆ operator!=() [1/4]

bool StormByte::Safe::operator!= ( const char *  str,
const CString &  text 
)
inlinenoexcept

Content inequality.

Parameters
strC string; may be null.
textBuffer.
Returns
Whether the texts differ.

◆ operator!=() [2/4]

bool StormByte::Safe::operator!= ( const char *  str,
const String &  text 
)
inlinenoexcept

Content inequality.

Parameters
strC string; may be null.
textText.
Returns
Whether the texts differ.

◆ operator!=() [3/4]

bool StormByte::Safe::operator!= ( const wchar_t *  str,
const WCString &  text 
)
inlinenoexcept

Content inequality.

Parameters
strC wide string; may be null.
textBuffer.
Returns
Whether the texts differ.

◆ operator!=() [4/4]

bool StormByte::Safe::operator!= ( const wchar_t *  str,
const WString &  text 
)
inlinenoexcept

Content inequality.

Parameters
strWide C string; may be null.
textText.
Returns
Whether the texts differ.

◆ operator<<() [1/4]

std::ostream & StormByte::Safe::operator<< ( std::ostream &  stream,
const CString &  text 
)
inline

Writes text to stream.

Parameters
streamDestination.
textSource.
Returns
stream.

◆ operator<<() [2/4]

std::ostream & StormByte::Safe::operator<< ( std::ostream &  stream,
const String &  text 
)
inline

Writes text to stream.

Parameters
streamDestination.
textSource.
Returns
stream.

◆ operator<<() [3/4]

std::wostream & StormByte::Safe::operator<< ( std::wostream &  stream,
const WCString &  text 
)
inline

Writes text to stream.

Parameters
streamDestination.
textSource.
Returns
stream.

◆ operator<<() [4/4]

std::wostream & StormByte::Safe::operator<< ( std::wostream &  stream,
const WString &  text 
)
inline

Writes text to stream.

Parameters
streamDestination.
textSource.
Returns
stream.

◆ operator==() [1/4]

bool StormByte::Safe::operator== ( const char *  str,
const CString &  text 
)
inlinenoexcept

Content equality.

Parameters
strC string; may be null.
textBuffer.
Returns
Whether the texts are equal.

◆ operator==() [2/4]

bool StormByte::Safe::operator== ( const char *  str,
const String &  text 
)
inlinenoexcept

Content equality.

Parameters
strC string; may be null.
textText.
Returns
Whether the texts are equal.

◆ operator==() [3/4]

bool StormByte::Safe::operator== ( const wchar_t *  str,
const WCString &  text 
)
inlinenoexcept

Content equality.

Parameters
strC wide string; may be null.
textBuffer.
Returns
Whether the texts are equal.

◆ operator==() [4/4]

bool StormByte::Safe::operator== ( const wchar_t *  str,
const WString &  text 
)
inlinenoexcept

Content equality.

Parameters
strWide C string; may be null.
textText.
Returns
Whether the texts are equal.

◆ ReinterpretPointerCast()

template<class T , class U >
Shared< T > StormByte::Safe::ReinterpretPointerCast ( const Shared< U > &  from)
noexcept

reinterpret_cast of the stored pointer.

The control block stays.

Template Parameters
TTarget pointee.
USource pointee.
Parameters
fromOwner.
Returns
Owner of the cast pointer.

◆ StaticPointerCast()

template<class T , class U >
Shared< T > StormByte::Safe::StaticPointerCast ( const Shared< U > &  from)
noexcept

static_cast of the stored pointer.

The control block stays.

Template Parameters
TTarget pointee.
USource pointee.
Parameters
fromOwner.
Returns
Owner of the cast pointer.

◆ swap() [1/4]

void StormByte::Safe::swap ( CString &  left,
CString &  right 
)
inlinenoexcept

Swaps two buffers.

Parameters
leftFirst buffer.
rightSecond buffer.

◆ swap() [2/4]

void StormByte::Safe::swap ( String &  left,
String &  right 
)
inlinenoexcept

Swaps two texts.

Parameters
leftFirst text.
rightSecond text.

◆ swap() [3/4]

void StormByte::Safe::swap ( WCString &  left,
WCString &  right 
)
inlinenoexcept

Swaps two buffers.

Parameters
leftFirst buffer.
rightSecond buffer.

◆ swap() [4/4]

void StormByte::Safe::swap ( WString &  left,
WString &  right 
)
inlinenoexcept

Swaps two texts.

Parameters
leftFirst text.
rightSecond text.

Variable Documentation

◆ Shared

◆ Unique

◆ Weak

template<class T >
class STORMBYTE_PUBLIC_TYPE StormByte::Safe::Weak