libtbag/Err.cpp
/**
 * Convert system error to libtbag::Err.
 *
 * @param[in] system_error
 *      system error code defined in errno.h (c++: cerrno)
 *
 * @return Converted libtbag::Err code.
 *
 * @remarks
 *  Each of the macros defined in <cerrno> expands to integer constant expressions with type int,
 *  each with a positive value, matching most of the POSIX error codes. The following constants
 *  are defined (the implementation may define more, as long as they begin with 'E' followed by
 *  digits or uppercase letters)
 *
 * @warning
 *  All values are required to be unique except that the values
 *  of EOPNOTSUPP and ENOTSUP may be identical and the values
 *  of EAGAIN and EWOULDBLOCK may be identical.
 *
 * @see <http://en.cppreference.com/w/cpp/error/errno_macros>
 * @see <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html>
 */
Convert system error to libtbag::Err.
@param[in] system_error
system error code defined in errno.h (c++: cerrno)

@return Converted libtbag::Err code.

@remarks
Each of the macros defined in  expands to integer constant expressions with type int,
each with a positive value, matching most of the POSIX error codes. The following constants
are defined (the implementation may define more, as long as they begin with 'E' followed by
digits or uppercase letters)

@warning
All values are required to be unique except that the values
of EOPNOTSUPP and ENOTSUP may be identical and the values
of EAGAIN and EWOULDBLOCK may be identical.


Convert system error to libtbag :: Err . @param [ in ] system_error system error code defined in errno . h ( c ++ : cerrno ) @return Converted libtbag :: Err code . @remarks Each of the macros defined in expands to integer constant expressions with type int each with a positive value matching most of the POSIX error codes . The following constants are defined ( the implementation may define more as long as they begin with ' E ' followed by digits or uppercase letters ) @warning All values are required to be unique except that the values of EOPNOTSUPP and ENOTSUP may be identical and the values of EAGAIN and EWOULDBLOCK may be identical .
static libtbag::Err convertSystemErrorToErr(int system_error)
{
    switch (system_error) {
#define _TABG_XX(name, msg) case name: return libtbag::Err::E_##name;
#define _TABG_DUP_XX(name, msg)
    TBAG_SYSTEM_ERROR_INFO_MAP(_TABG_XX, _TABG_DUP_XX)
#undef _TABG_DUP_XX
#undef _TABG_XX
#if defined(EOPNOTSUPP) && defined(ENOTSUP) && (EOPNOTSUPP != ENOTSUP)
    case EOPNOTSUPP: return libtbag::Err::E_EOPNOTSUPP; 
#endif
#if defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
    case EWOULDBLOCK: return libtbag::Err::E_EWOULDBLOCK; 
#endif
    default: return libtbag::Err::E_UNKNOWN;
    }
}
static libtbag :: Err convertSystemErrorToErr ( int system_error ) { switch ( system_error ) { #define _TABG_XX ( name , msg )  case name: return libtbag::Err::E_##name; #define _TABG_DUP_XX ( name , msg ) 
    TBAG_SYSTEM_ERROR_INFO_MAP(_TABG_XX, _TABG_DUP_XX) #undef  _TABG_DUP_XX #undef  _TABG_XX #if defined ( EOPNOTSUPP ) && defined ( ENOTSUP ) && ( EOPNOTSUPP != ENOTSUP ) case EOPNOTSUPP : return libtbag :: Err :: E_EOPNOTSUPP ; #endif #if defined ( EWOULDBLOCK ) && defined ( EAGAIN ) && ( EWOULDBLOCK != EAGAIN ) case EWOULDBLOCK : return libtbag :: Err :: E_EWOULDBLOCK ; #endif default : return libtbag :: Err :: E_UNKNOWN ; } }
Convert system error to libtbag::Err.
Convert system error to libtbag :: Err .
// Operation not supported on socket. // Operation would block.