corelib/include/ebcl/inline/Messages.hh

154 lines
4.5 KiB
C++

/******************************************************************************/
/* UI<=>GAME MESSAGES - INLINE CODE *******************************************/
/******************************************************************************/
#ifndef _H_LW_LIB_INLINE_MESSAGES
#define _H_LW_LIB_INLINE_MESSAGES
#include <lw/lib/GameLoop.hh>
namespace lw {
/*= T_ProgressInfoPart =======================================================*/
inline T_ProgressInfoPart::T_ProgressInfoPart( T_String text ,
uint32_t progress , uint32_t total ) noexcept
: text_( std::move( text ) ) , progress_( progress ) , total_( total )
{ }
inline T_ProgressInfoPart::T_ProgressInfoPart( T_ProgressInfoPart&& other ) noexcept
: text_( std::move( other.text_ ) ) , progress_( other.progress_ ) ,
total_( other.total_ )
{ }
inline T_ProgressInfoPart::T_ProgressInfoPart( T_ProgressInfoPart const& other )
: text_( other.text_ ) , progress_( other.progress_ ) , total_( other.total_ )
{ }
/*----------------------------------------------------------------------------*/
inline T_String const& T_ProgressInfoPart::text( ) const noexcept
{
return text_;
}
inline uint32_t T_ProgressInfoPart::progress( ) const noexcept
{
return progress_;
}
inline uint32_t T_ProgressInfoPart::total( ) const noexcept
{
return total_;
}
/*= T_ProgressInfo ===========================================================*/
inline T_ProgressInfo::T_ProgressInfo( T_String text , uint32_t progress , uint32_t total ) noexcept
: main_( std::move( text ) , progress , total ) , sub_( )
{ }
inline T_ProgressInfo::T_ProgressInfo( T_ProgressInfoPart main ) noexcept
: main_( std::move( main ) )
{ }
inline T_ProgressInfo::T_ProgressInfo(
T_ProgressInfoPart main ,
T_ProgressInfoPart sub ) noexcept
: main_( std::move( main ) ) ,
sub_( std::move( sub ) )
{ }
inline T_ProgressInfo::T_ProgressInfo( T_ProgressInfoPart main ,
T_String sText , uint32_t sProgress , uint32_t sTotal ) noexcept
: main_( std::move( main ) ) ,
sub_( T_ProgressInfoPart{ std::move( sText ) , sProgress , sTotal } )
{ }
inline T_ProgressInfo::T_ProgressInfo( T_String text , uint32_t progress , uint32_t total ,
T_String sText , uint32_t sProgress , uint32_t sTotal ) noexcept
: main_( std::move( text ) , progress , total ) ,
sub_( T_ProgressInfoPart{ std::move( sText ) , sProgress , sTotal } )
{ }
inline T_ProgressInfo::T_ProgressInfo( T_ProgressInfo&& other ) noexcept
: main_( std::move( other.main_ ) ) , sub_( std::move( other.sub_ ) )
{ }
/*----------------------------------------------------------------------------*/
inline T_ProgressInfoPart const& T_ProgressInfo::main( ) const noexcept
{
return main_;
}
inline bool T_ProgressInfo::hasSub( ) const noexcept
{
return sub_.present( );
}
inline T_ProgressInfoPart const& T_ProgressInfo::sub( ) const
{
return (T_ProgressInfoPart const&) sub_;
}
/*= T_GameMessage ============================================================*/
template< E_MessageDirection D , typename MT , typename MD >
inline constexpr T_GameMessage< D , MT , MD >::T_GameMessage( ) noexcept
: type_( ) , data_( )
{ }
template< E_MessageDirection D , typename MT , typename MD >
inline constexpr T_GameMessage< D , MT , MD >::T_GameMessage(
T_Type type ) noexcept
: type_( type ) , data_( )
{ }
template< E_MessageDirection D , typename MT , typename MD >
inline T_GameMessage< D , MT , MD >::T_GameMessage(
T_Type type ,
T_Data data ) noexcept
: type_( type ) , data_( data )
{ }
template< E_MessageDirection D , typename MT , typename MD >
inline T_GameMessage< D , MT , MD >::T_GameMessage(
T_Self_&& other ) noexcept
: type_( other.type_ ) , data_( std::move( other.data_ ) )
{ }
template< E_MessageDirection D , typename MT , typename MD >
inline T_GameMessage< D >& T_GameMessage< D , MT , MD >::operator =(
T_Self_&& other ) noexcept
{
type_ = other.type_;
data_ = std::move( other.data_ );
return *this;
}
/*----------------------------------------------------------------------------*/
template< E_MessageDirection D , typename MT , typename MD >
inline constexpr bool T_GameMessage< D , MT , MD >::hasMessage( ) const noexcept
{
return type_.present( );
}
template< E_MessageDirection D , typename MT , typename MD >
inline constexpr MT T_GameMessage< D , MT , MD >::type( ) const noexcept
{
return type_;
}
template< E_MessageDirection D , typename MT , typename MD >
template< typename T >
constexpr T const& T_GameMessage< D , MT , MD >::data( ) const
{
return (T const&)( (MD const&) data_ );
}
} // namespace lw
#endif // _H_LW_LIB_INLINE_MESSAGES