libs/http/include/boost/http/datastore.hpp
100.0% Lines (4/4)
100.0% Functions (2/2)
-% Branches (0/0)
libs/http/include/boost/http/datastore.hpp
| Line | Hits | Source Code |
|---|---|---|
| 1 | // | |
| 2 | // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com) | |
| 3 | // | |
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
| 6 | // | |
| 7 | // Official repository: https://github.com/cppalliance/http | |
| 8 | // | |
| 9 | ||
| 10 | #ifndef BOOST_HTTP_DATASTORE_HPP | |
| 11 | #define BOOST_HTTP_DATASTORE_HPP | |
| 12 | ||
| 13 | #include <boost/http/detail/config.hpp> | |
| 14 | #include <boost/http/core/polystore.hpp> | |
| 15 | ||
| 16 | namespace boost { | |
| 17 | namespace http { | |
| 18 | ||
| 19 | /** A polymorphic data container with clear functionality. | |
| 20 | ||
| 21 | This class extends @ref polystore to provide a container | |
| 22 | for type-erased objects with an explicit clear operation. | |
| 23 | It is commonly used as a service container. | |
| 24 | ||
| 25 | @code | |
| 26 | // Example: Using datastore with services | |
| 27 | boost::http::datastore ctx; | |
| 28 | ||
| 29 | // Install services... | |
| 30 | ||
| 31 | // Clean up all services when done | |
| 32 | ctx.clear(); | |
| 33 | @endcode | |
| 34 | */ | |
| 35 | class datastore : public polystore | |
| 36 | { | |
| 37 | public: | |
| 38 | /** Constructor | |
| 39 | ||
| 40 | Constructs an empty datastore. | |
| 41 | */ | |
| 42 | 1 | datastore() = default; |
| 43 | ||
| 44 | /** Remove and destroy all stored objects. | |
| 45 | ||
| 46 | All stored objects are destroyed in the reverse order | |
| 47 | of construction. The container is left empty. | |
| 48 | */ | |
| 49 | 1 | void clear() noexcept |
| 50 | { | |
| 51 | 1 | polystore::clear(); |
| 52 | 1 | } |
| 53 | }; | |
| 54 | ||
| 55 | } // http | |
| 56 | } // boost | |
| 57 | ||
| 58 | #endif | |
| 59 |