Changeset 0d221d2 in mainline


Ignore:
Timestamp:
2018-07-05T21:41:23Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
74b03e3
Parents:
17c41c3
git-author:
Dzejrou <dzejrou@…> (2018-05-08 17:20:10)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:23)
Message:

cpp: added <stdexcept>

Location:
uspace/lib/cpp
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/Makefile

    r17c41c3 r0d221d2  
    4646        src/mutex.cpp \
    4747        src/new.cpp \
     48        src/stdexcept.cpp \
    4849        src/string.cpp \
    4950        src/system_error.cpp \
  • uspace/lib/cpp/include/impl/stdexcept.hpp

    r17c41c3 r0d221d2  
    3030#define LIBCPP_STDEXCEPT
    3131
    32 #error "<stdexcept> is not implemented"
     32#include <exception>
     33#include <iosfwd>
     34#include <internal/stringfwd.hpp>
     35
     36namespace std
     37{
     38    class logic_error: public exception
     39    {
     40        public:
     41            explicit logic_error(const string&);
     42            explicit logic_error(const char*);
     43            logic_error(const logic_error&) noexcept;
     44            logic_error& operator=(const logic_error&);
     45            ~logic_error() override;
     46
     47            const char* what() const noexcept override;
     48
     49        protected:
     50            const char* what_;
     51    };
     52
     53    class domain_error: public logic_error
     54    {
     55        public:
     56            explicit domain_error(const string&);
     57            explicit domain_error(const char*);
     58            domain_error(const domain_error&) noexcept;
     59    };
     60
     61    class invalid_argument: public logic_error
     62    {
     63        public:
     64            explicit invalid_argument(const string&);
     65            explicit invalid_argument(const char*);
     66            invalid_argument(const invalid_argument&) noexcept;
     67    };
     68
     69    class length_error: public logic_error
     70    {
     71        public:
     72            explicit length_error(const string&);
     73            explicit length_error(const char*);
     74            length_error(const length_error&) noexcept;
     75    };
     76
     77    class out_of_range: public logic_error
     78    {
     79        public:
     80            explicit out_of_range(const string&);
     81            explicit out_of_range(const char*);
     82            out_of_range(const out_of_range&) noexcept;
     83    };
     84
     85    class runtime_error: public exception
     86    {
     87        public:
     88            explicit runtime_error(const string&);
     89            explicit runtime_error(const char*);
     90            runtime_error(const runtime_error&) noexcept;
     91            runtime_error& operator=(const runtime_error&);
     92            ~runtime_error() override;
     93
     94            const char* what() const noexcept override;
     95
     96        protected:
     97            const char* what_;
     98    };
     99
     100    class range_error: public runtime_error
     101    {
     102        public:
     103            explicit range_error(const string&);
     104            explicit range_error(const char*);
     105            range_error(const range_error&) noexcept;
     106    };
     107
     108    class overflow_error: public runtime_error
     109    {
     110        public:
     111            explicit overflow_error(const string&);
     112            explicit overflow_error(const char*);
     113            overflow_error(const overflow_error&) noexcept;
     114    };
     115
     116    class underflow_error: public runtime_error
     117    {
     118        public:
     119            explicit underflow_error(const string&);
     120            explicit underflow_error(const char*);
     121            underflow_error(const underflow_error&) noexcept;
     122    };
     123}
    33124
    34125#endif
Note: See TracChangeset for help on using the changeset viewer.