Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:29

0001 //
0002 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/url
0008 //
0009 
0010 #ifndef BOOST_URL_ERROR_TYPES_HPP
0011 #define BOOST_URL_ERROR_TYPES_HPP
0012 
0013 #include <boost/url/detail/config.hpp>
0014 #include <boost/system/error_code.hpp>
0015 #include <boost/system/system_error.hpp>
0016 #include <boost/system/result.hpp>
0017 
0018 namespace boost {
0019 namespace urls {
0020 
0021 #ifndef BOOST_URL_DOCS
0022 namespace error_types {
0023 #endif
0024 
0025 /** The type of error category used by the library
0026 
0027     @note This alias is no longer supported and
0028     should not be used in new code. Please use
0029     `system::error_category` instead.
0030 
0031     This alias is included for backwards
0032     compatibility with earlier versions of the
0033     library.
0034 
0035     However, it will be removed in future releases,
0036     and using it in new code is not recommended.
0037 
0038     Please use the updated version instead to
0039     ensure compatibility with future versions of
0040     the library.
0041 
0042  */
0043 using error_category
0044     BOOST_URL_DEPRECATED("Use system::error_category instead") =
0045     boost::system::error_category;
0046 
0047 /** The type of error code used by the library
0048 
0049     @note This alias is no longer supported and
0050     should not be used in new code. Please use
0051     `system::error_code` instead.
0052 
0053     This alias is included for backwards
0054     compatibility with earlier versions of the
0055     library.
0056 
0057     However, it will be removed in future releases,
0058     and using it in new code is not recommended.
0059 
0060     Please use the updated version instead to
0061     ensure compatibility with future versions of
0062     the library.
0063 
0064  */
0065 using error_code
0066     BOOST_URL_DEPRECATED("Use system::error_code instead") =
0067     boost::system::error_code;
0068 
0069 /** The type of error condition used by the library
0070 
0071     @note This alias is no longer supported and
0072     should not be used in new code. Please use
0073     `system::error_condition` instead.
0074 
0075     This alias is included for backwards
0076     compatibility with earlier versions of the
0077     library.
0078 
0079     However, it will be removed in future releases,
0080     and using it in new code is not recommended.
0081 
0082     Please use the updated version instead to
0083     ensure compatibility with future versions of
0084     the library.
0085 
0086  */
0087 using error_condition
0088     BOOST_URL_DEPRECATED("Use system::error_condition instead") =
0089     boost::system::error_condition;
0090 
0091 /** The type of system error thrown by the library
0092 
0093     @note This alias is no longer supported and
0094     should not be used in new code. Please use
0095     `system::system_error` instead.
0096 
0097     This alias is included for backwards
0098     compatibility with earlier versions of the
0099     library.
0100 
0101     However, it will be removed in future releases,
0102     and using it in new code is not recommended.
0103 
0104     Please use the updated version instead to
0105     ensure compatibility with future versions of
0106     the library.
0107 
0108  */
0109 using system_error
0110     BOOST_URL_DEPRECATED("Use system::system_error instead") =
0111     boost::system::system_error;
0112 
0113 /** A function to return the generic error category used by the library
0114 
0115     @note This alias is no longer supported and
0116     should not be used in new code. Please use
0117     `core::string_view` instead.
0118 
0119     This alias is included for backwards
0120     compatibility with earlier versions of the
0121     library.
0122 
0123     However, it will be removed in future releases,
0124     and using it in new code is not recommended.
0125 
0126     Please use the updated version instead to
0127     ensure compatibility with future versions of
0128     the library.
0129 
0130  */
0131 #ifdef BOOST_URL_DOCS
0132 error_category const& generic_category();
0133 #else
0134 using boost::system::generic_category;
0135 #endif
0136 
0137 /** A function to return the system error category used by the library
0138 
0139     @note This alias is no longer supported and
0140     should not be used in new code. Please use
0141     `core::string_view` instead.
0142 
0143     This alias is included for backwards
0144     compatibility with earlier versions of the
0145     library.
0146 
0147     However, it will be removed in future releases,
0148     and using it in new code is not recommended.
0149 
0150     Please use the updated version instead to
0151     ensure compatibility with future versions of
0152     the library.
0153 
0154  */
0155 #ifdef BOOST_URL_DOCS
0156 error_category const& system_category();
0157 #else
0158 using boost::system::system_category;
0159 #endif
0160 
0161 /** The set of constants used for cross-platform error codes
0162 
0163     @note This alias is no longer supported and
0164     should not be used in new code. Please use
0165     `core::string_view` instead.
0166 
0167     This alias is included for backwards
0168     compatibility with earlier versions of the
0169     library.
0170 
0171     However, it will be removed in future releases,
0172     and using it in new code is not recommended.
0173 
0174     Please use the updated version instead to
0175     ensure compatibility with future versions of
0176     the library.
0177 
0178  */
0179 #ifdef BOOST_URL_DOCS
0180 enum errc
0181 {
0182     __see_below__
0183 };
0184 #else
0185 namespace errc = boost::system::errc;
0186 #endif
0187 
0188 /** The type of result returned by library functions
0189 
0190     @note This alias is no longer supported and
0191     should not be used in new code. Please use
0192     `system::result` instead.
0193 
0194     This alias is included for backwards
0195     compatibility with earlier versions of the
0196     library.
0197 
0198     However, it will be removed in future releases,
0199     and using it in new code is not recommended.
0200 
0201     Please use the updated version instead to
0202     ensure compatibility with future versions of
0203     the library.
0204 
0205     @details This is an alias template used as the return type
0206     for functions that can either return a container,
0207     or fail with an error code. This is a brief
0208     synopsis of the type:
0209 
0210     @par Declaration
0211     @code
0212     template< class T >
0213     class result
0214     {
0215     public:
0216         //
0217         // Return true if the result contains an error
0218         //
0219         constexpr bool has_error() const noexcept;
0220 
0221         //
0222         // Return the error
0223         //
0224         constexpr system::error_code error() const noexcept;
0225 
0226         //
0227         // Return true if the result contains a value
0228         //
0229         constexpr bool has_value() const noexcept;
0230         constexpr explicit operator bool() const noexcept;
0231 
0232         //
0233         // Return the value, or throw an exception
0234         //
0235         constexpr T& value();
0236         constexpr T const& value() const;
0237 
0238         // Return the value.
0239         // Precondition: has_value()==true
0240         //
0241         constexpr T& operator*() noexcept;
0242         constexpr T* operator->() noexcept;
0243         constexpr T const& operator*() const noexcept;
0244         constexpr T const* operator->() const noexcept;
0245 
0246         ...more
0247     @endcode
0248 
0249     @par Usage
0250     Given the function @ref parse_uri with this signature:
0251     @code
0252     system::result< url_view > parse_uri( core::string_view s ) noexcept;
0253     @endcode
0254 
0255     The following statement captures the value in a
0256     variable upon success, otherwise throws:
0257     @code
0258     url_view u = parse_uri( "http://example.com/path/to/file.txt" ).value();
0259     @endcode
0260 
0261     This statement captures the result in a local
0262     variable and inspects the error condition:
0263     @code
0264     system::result< url_view > rv = parse_uri( "http://example.com/path/to/file.txt" );
0265 
0266     if(! rv )
0267         std::cout << rv.error();
0268     else
0269         std::cout << *rv;
0270     @endcode
0271 
0272     @tparam T The type of value held by the result.
0273 
0274     @see
0275         @li <a href="https://boost.org/libs/system/doc/html/system.html#ref_resultt_e"
0276             >`boost::system::result`</a>
0277 
0278 */
0279 template<class T>
0280 using result
0281     BOOST_URL_DEPRECATED("Use system::result<T> instead") =
0282     boost::system::result<T, system::error_code>;
0283 
0284 #ifndef BOOST_URL_DOCS
0285 } // error_types
0286 
0287 using namespace error_types;
0288 #endif
0289 
0290 } // urls
0291 } // boost
0292 
0293 #endif