// -*- C++ -*-
//===---------------------------- system_error ----------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_SYSTEM_ERROR
#define _LIBCPP_SYSTEM_ERROR

/*
    system_error synopsis

namespace std
{

class error_category
{
public:
    virtual ~error_category();

    error_category(const error_category&) = delete;
    error_category& operator=(const error_category&) = delete;

    virtual const char* name() const = 0;
    virtual error_condition default_error_condition(int ev) const;
    virtual bool equivalent(int code, const error_condition& condition) const;
    virtual bool equivalent(const error_code& code, int condition) const;
    virtual string message(int ev) const = 0;

    bool operator==(const error_category& rhs) const;
    bool operator!=(const error_category& rhs) const;
    bool operator<(const error_category& rhs) const;
};

const error_category& generic_category();
const error_category& system_category();

template <class T> struct is_error_code_enum
    : public false_type {};

template <class T> struct is_error_condition_enum
    : public false_type {};

class error_code
{
public:
    // constructors:
    error_code();
    error_code(int val, const error_category& cat);
    template <class ErrorCodeEnum>
        error_code(ErrorCodeEnum e);

    // modifiers:
    void assign(int val, const error_category& cat);
    template <class ErrorCodeEnum>
        error_code& operator=(ErrorCodeEnum e);
    void clear();

    // observers:
    int value() const;
    const error_category& category() const;
    error_condition default_error_condition() const;
    string message() const;
    explicit operator bool() const;
};

// non-member functions:
bool operator<(const error_code& lhs, const error_code& rhs);
template <class charT, class traits>
    basic_ostream<charT,traits>&
    operator<<(basic_ostream<charT,traits>& os, const error_code& ec);

class error_condition
{
public:
    // constructors:
    error_condition();
    error_condition(int val, const error_category& cat);
    template <class ErrorConditionEnum>
        error_condition(ErrorConditionEnum e);

    // modifiers:
    void assign(int val, const error_category& cat);
    template <class ErrorConditionEnum>
        error_condition& operator=(ErrorConditionEnum e);
    void clear();

    // observers:
    int value() const;
    const error_category& category() const;
    string message() const;
    explicit operator bool() const;
};

bool operator<(const error_condition& lhs, const error_condition& rhs);

class system_error
    : public runtime_error
{
public:
    system_error(error_code ec, const string& what_arg);
    system_error(error_code ec, const char* what_arg);
    system_error(error_code ec);
    system_error(int ev, const error_category& ecat, const string& what_arg);
    system_error(int ev, const error_category& ecat, const char* what_arg);
    system_error(int ev, const error_category& ecat);

    const error_code& code() const throw();
    const char* what() const throw();
};

enum class errc
{
    address_family_not_supported,       // EAFNOSUPPORT
    address_in_use,                     // EADDRINUSE
    address_not_available,              // EADDRNOTAVAIL
    already_connected,                  // EISCONN
    argument_list_too_long,             // E2BIG
    argument_out_of_domain,             // EDOM
    bad_address,                        // EFAULT
    bad_file_descriptor,                // EBADF
    bad_message,                        // EBADMSG
    broken_pipe,                        // EPIPE
    connection_aborted,                 // ECONNABORTED
    connection_already_in_progress,     // EALREADY
    connection_refused,                 // ECONNREFUSED
    connection_reset,                   // ECONNRESET
    cross_device_link,                  // EXDEV
    destination_address_required,       // EDESTADDRREQ
    device_or_resource_busy,            // EBUSY
    directory_not_empty,                // ENOTEMPTY
    executable_format_error,            // ENOEXEC
    file_exists,                        // EEXIST
    file_too_large,                     // EFBIG
    filename_too_long,                  // ENAMETOOLONG
    function_not_supported,             // ENOSYS
    host_unreachable,                   // EHOSTUNREACH
    identifier_removed,                 // EIDRM
    illegal_byte_sequence,              // EILSEQ
    inappropriate_io_control_operation, // ENOTTY
    interrupted,                        // EINTR
    invalid_argument,                   // EINVAL
    invalid_seek,                       // ESPIPE
    io_error,                           // EIO
    is_a_directory,                     // EISDIR
    message_size,                       // EMSGSIZE
    network_down,                       // ENETDOWN
    network_reset,                      // ENETRESET
    network_unreachable,                // ENETUNREACH
    no_buffer_space,                    // ENOBUFS
    no_child_process,                   // ECHILD
    no_link,                            // ENOLINK
    no_lock_available,                  // ENOLCK
    no_message_available,               // ENODATA
    no_message,                         // ENOMSG
    no_protocol_option,                 // ENOPROTOOPT
    no_space_on_device,                 // ENOSPC
    no_stream_resources,                // ENOSR
    no_such_device_or_address,          // ENXIO
    no_such_device,                     // ENODEV
    no_such_file_or_directory,          // ENOENT
    no_such_process,                    // ESRCH
    not_a_directory,                    // ENOTDIR
    not_a_socket,                       // ENOTSOCK
    not_a_stream,                       // ENOSTR
    not_connected,                      // ENOTCONN
    not_enough_memory,                  // ENOMEM
    not_supported,                      // ENOTSUP
    operation_canceled,                 // ECANCELED
    operation_in_progress,              // EINPROGRESS
    operation_not_permitted,            // EPERM
    operation_not_supported,            // EOPNOTSUPP
    operation_would_block,              // EWOULDBLOCK
    owner_dead,                         // EOWNERDEAD
    permission_denied,                  // EACCES
    protocol_error,                     // EPROTO
    protocol_not_supported,             // EPROTONOSUPPORT
    read_only_file_system,              // EROFS
    resource_deadlock_would_occur,      // EDEADLK
    resource_unavailable_try_again,     // EAGAIN
    result_out_of_range,                // ERANGE
    state_not_recoverable,              // ENOTRECOVERABLE
    stream_timeout,                     // ETIME
    text_file_busy,                     // ETXTBSY
    timed_out,                          // ETIMEDOUT
    too_many_files_open_in_system,      // ENFILE
    too_many_files_open,                // EMFILE
    too_many_links,                     // EMLINK
    too_many_symbolic_link_levels,      // ELOOP
    value_too_large,                    // EOVERFLOW
    wrong_protocol_type                 // EPROTOTYPE
};

template <> struct is_error_condition_enum<errc>
    : true_type { }

error_code make_error_code(errc e);
error_condition make_error_condition(errc e);

// Comparison operators:
bool operator==(const error_code& lhs, const error_code& rhs);
bool operator==(const error_code& lhs, const error_condition& rhs);
bool operator==(const error_condition& lhs, const error_code& rhs);
bool operator==(const error_condition& lhs, const error_condition& rhs);
bool operator!=(const error_code& lhs, const error_code& rhs);
bool operator!=(const error_code& lhs, const error_condition& rhs);
bool operator!=(const error_condition& lhs, const error_code& rhs);
bool operator!=(const error_condition& lhs, const error_condition& rhs);

template <> struct hash<std::error_code>;

}  // std

*/

#include <__config>
#include <cerrno>
#include <type_traits>
#include <stdexcept>
#include <__functional_base>

#pragma GCC system_header

_LIBCPP_BEGIN_NAMESPACE_STD

// is_error_code_enum

template <class _Tp> struct is_error_code_enum
    : public false_type {};

// is_error_condition_enum

template <class _Tp> struct is_error_condition_enum
    : public false_type {};

// Some error codes are not present on all platforms, so we provide equivalents
// for them:

//enum class errc
struct errc
{
enum _ {
    address_family_not_supported        = EAFNOSUPPORT,
    address_in_use                      = EADDRINUSE,
    address_not_available               = EADDRNOTAVAIL,
    already_connected                   = EISCONN,
    argument_list_too_long              = E2BIG,
    argument_out_of_domain              = EDOM,
    bad_address                         = EFAULT,
    bad_file_descriptor                 = EBADF,
    bad_message                         = EBADMSG,
    broken_pipe                         = EPIPE,
    connection_aborted                  = ECONNABORTED,
    connection_already_in_progress      = EALREADY,
    connection_refused                  = ECONNREFUSED,
    connection_reset                    = ECONNRESET,
    cross_device_link                   = EXDEV,
    destination_address_required        = EDESTADDRREQ,
    device_or_resource_busy             = EBUSY,
    directory_not_empty                 = ENOTEMPTY,
    executable_format_error             = ENOEXEC,
    file_exists                         = EEXIST,
    file_too_large                      = EFBIG,
    filename_too_long                   = ENAMETOOLONG,
    function_not_supported              = ENOSYS,
    host_unreachable                    = EHOSTUNREACH,
    identifier_removed                  = EIDRM,
    illegal_byte_sequence               = EILSEQ,
    inappropriate_io_control_operation  = ENOTTY,
    interrupted                         = EINTR,
    invalid_argument                    = EINVAL,
    invalid_seek                        = ESPIPE,
    io_error                            = EIO,
    is_a_directory                      = EISDIR,
    message_size                        = EMSGSIZE,
    network_down                        = ENETDOWN,
    network_reset                       = ENETRESET,
    network_unreachable                 = ENETUNREACH,
    no_buffer_space                     = ENOBUFS,
    no_child_process                    = ECHILD,
    no_link                             = ENOLINK,
    no_lock_available                   = ENOLCK,
#ifdef ENODATA
    no_message_available                = ENODATA,
#else
    no_message_available                = ENOMSG,
#endif
    no_message                          = ENOMSG,
    no_protocol_option                  = ENOPROTOOPT,
    no_space_on_device                  = ENOSPC,
#ifdef ENOSR
    no_stream_resources                 = ENOSR,
#else
    no_stream_resources                 = ENOMEM,
#endif
    no_such_device_or_address           = ENXIO,
    no_such_device                      = ENODEV,
    no_such_file_or_directory           = ENOENT,
    no_such_process                     = ESRCH,
    not_a_directory                     = ENOTDIR,
    not_a_socket                        = ENOTSOCK,
#ifdef ENOSTR
    not_a_stream                        = ENOSTR,
#else
    not_a_stream                        = EINVAL,
#endif
    not_connected                       = ENOTCONN,
    not_enough_memory                   = ENOMEM,
    not_supported                       = ENOTSUP,
    operation_canceled                  = ECANCELED,
    operation_in_progress               = EINPROGRESS,
    operation_not_permitted             = EPERM,
    operation_not_supported             = EOPNOTSUPP,
    operation_would_block               = EWOULDBLOCK,
    owner_dead                          = EOWNERDEAD,
    permission_denied                   = EACCES,
    protocol_error                      = EPROTO,
    protocol_not_supported              = EPROTONOSUPPORT,
    read_only_file_system               = EROFS,
    resource_deadlock_would_occur       = EDEADLK,
    resource_unavailable_try_again      = EAGAIN,
    result_out_of_range                 = ERANGE,
    state_not_recoverable               = ENOTRECOVERABLE,
#ifdef ETIME
    stream_timeout                      = ETIME,
#else
    stream_timeout                      = ETIMEDOUT,
#endif
    text_file_busy                      = ETXTBSY,
    timed_out                           = ETIMEDOUT,
    too_many_files_open_in_system       = ENFILE,
    too_many_files_open                 = EMFILE,
    too_many_links                      = EMLINK,
    too_many_symbolic_link_levels       = ELOOP,
    value_too_large                     = EOVERFLOW,
    wrong_protocol_type                 = EPROTOTYPE
};

    _ __v_;

    errc(_ __v) : __v_(__v) {}
    operator int() const {return __v_;}

};

template <> struct is_error_condition_enum<errc>
    : true_type { };

template <> struct is_error_condition_enum<errc::_>
    : true_type { };

class error_condition;
class error_code;

// class error_category

class __do_message;

class error_category
{
public:
    virtual ~error_category();

private:
    error_category();
    error_category(const error_category&);// = delete;
    error_category& operator=(const error_category&);// = delete;

public:
    virtual const char* name() const = 0;
    virtual error_condition default_error_condition(int __ev) const;
    virtual bool equivalent(int __code, const error_condition& __condition) const;
    virtual bool equivalent(const error_code& __code, int __condition) const;
    virtual string message(int __ev) const = 0;

    _LIBCPP_ALWAYS_INLINE
    bool operator==(const error_category& __rhs) const {return this == &__rhs;}

    _LIBCPP_ALWAYS_INLINE
    bool operator!=(const error_category& __rhs) const {return !(*this == __rhs);}

    _LIBCPP_ALWAYS_INLINE
    bool operator< (const error_category& __rhs) const {return this < &__rhs;}

    friend class __do_message;
};

class _LIBCPP_HIDDEN __do_message
    : public error_category
{
public:
    virtual string message(int ev) const;
};

const error_category& generic_category();
const error_category& system_category();

class error_condition
{
    int __val_;
    const error_category* __cat_;
public:
    _LIBCPP_ALWAYS_INLINE
    error_condition() : __val_(0), __cat_(&generic_category()) {}

    _LIBCPP_ALWAYS_INLINE
    error_condition(int __val, const error_category& __cat)
        : __val_(__val), __cat_(&__cat) {}

    template <class _E>
        _LIBCPP_ALWAYS_INLINE
        error_condition(_E __e, typename enable_if<is_error_condition_enum<_E>::value>::type* = 0)
            {*this = make_error_condition(__e);}

    _LIBCPP_ALWAYS_INLINE
    void assign(int __val, const error_category& __cat)
    {
        __val_ = __val;
        __cat_ = &__cat;
    }

    template <class _E>
        _LIBCPP_ALWAYS_INLINE
        typename enable_if
        <
            is_error_condition_enum<_E>::value,
            error_condition&
        >::type
        operator=(_E __e)
            {*this = make_error_condition(__e); return *this;}

    _LIBCPP_ALWAYS_INLINE
    void clear()
    {
        __val_ = 0;
        __cat_ = &generic_category();
    }

    _LIBCPP_ALWAYS_INLINE
    int value() const {return __val_;}

    _LIBCPP_ALWAYS_INLINE
    const error_category& category() const {return *__cat_;}
    string message() const;

    _LIBCPP_ALWAYS_INLINE
    //explicit
        operator bool() const {return __val_ != 0;}
};

inline _LIBCPP_INLINE_VISIBILITY
error_condition
make_error_condition(errc __e)
{
    return error_condition(static_cast<int>(__e), generic_category());
}

inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const error_condition& __x, const error_condition& __y)
{
    return __x.category() < __y.category()
        || __x.category() == __y.category() && __x.value() < __y.value();
}

// error_code

class error_code
{
    int __val_;
    const error_category* __cat_;
public:
    _LIBCPP_ALWAYS_INLINE
    error_code() : __val_(0), __cat_(&system_category()) {}

    _LIBCPP_ALWAYS_INLINE
    error_code(int __val, const error_category& __cat)
        : __val_(__val), __cat_(&__cat) {}

    template <class _E>
        _LIBCPP_ALWAYS_INLINE
        error_code(_E __e, typename enable_if<is_error_code_enum<_E>::value>::type* = 0)
            {*this = make_error_code(__e);}

    _LIBCPP_ALWAYS_INLINE
    void assign(int __val, const error_category& __cat)
    {
        __val_ = __val;
        __cat_ = &__cat;
    }

    template <class _E>
        _LIBCPP_ALWAYS_INLINE
        typename enable_if
        <
            is_error_code_enum<_E>::value,
            error_code&
        >::type
        operator=(_E __e)
            {*this = make_error_code(__e); return *this;}

    _LIBCPP_ALWAYS_INLINE
    void clear()
    {
        __val_ = 0;
        __cat_ = &system_category();
    }

    _LIBCPP_ALWAYS_INLINE
    int value() const {return __val_;}

    _LIBCPP_ALWAYS_INLINE
    const error_category& category() const {return *__cat_;}

    _LIBCPP_ALWAYS_INLINE
    error_condition default_error_condition() const
        {return __cat_->default_error_condition(__val_);}

    string message() const;

    _LIBCPP_ALWAYS_INLINE
    //explicit
        operator bool() const {return __val_ != 0;}
};

inline _LIBCPP_INLINE_VISIBILITY
error_code
make_error_code(errc __e)
{
    return error_code(static_cast<int>(__e), generic_category());
}

inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const error_code& __x, const error_code& __y)
{
    return __x.category() < __y.category()
        || __x.category() == __y.category() && __x.value() < __y.value();
}

inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const error_code& __x, const error_code& __y)
{
    return __x.category() == __y.category() && __x.value() == __y.value();
}

inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const error_code& __x, const error_condition& __y)
{
    return __x.category().equivalent(__x.value(), __y)
        || __y.category().equivalent(__x, __y.value());
}

inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const error_condition& __x, const error_code& __y)
{
    return __y == __x;
}

inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const error_condition& __x, const error_condition& __y)
{
    return __x.category() == __y.category() && __x.value() == __y.value();
}

inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const error_code& __x, const error_code& __y) {return !(__x == __y);}

inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const error_code& __x, const error_condition& __y) {return !(__x == __y);}

inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const error_condition& __x, const error_code& __y) {return !(__x == __y);}

inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const error_condition& __x, const error_condition& __y) {return !(__x == __y);}

template <>
struct hash<error_code>
    : public unary_function<error_code, size_t>
{
    size_t operator()(const error_code& __ec) const
    {
        return static_cast<size_t>(__ec.value());
    }
};

// system_error

class system_error
    : public runtime_error
{
    error_code __ec_;
public:
    system_error(error_code __ec, const string& __what_arg);
    system_error(error_code __ec, const char* __what_arg);
    system_error(error_code __ec);
    system_error(int __ev, const error_category& __ecat, const string& __what_arg);
    system_error(int __ev, const error_category& __ecat, const char* __what_arg);
    system_error(int __ev, const error_category& __ecat);
    ~system_error() throw();

    _LIBCPP_ALWAYS_INLINE
    const error_code& code() const throw() {return __ec_;}

private:
    static string __init(const error_code&, string);
};

void __throw_system_error(int ev, const char* what_arg);

_LIBCPP_END_NAMESPACE_STD

#endif  // _LIBCPP_SYSTEM_ERROR
