|
| 1 | +/** |
| 2 | + * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) |
| 3 | + * |
| 4 | + * This file is part of libbitcoin. |
| 5 | + * |
| 6 | + * This program is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU Affero General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU Affero General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU Affero General Public License |
| 17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | +#ifndef LIBBITCOIN_BN_EMBEDDED_HPP |
| 20 | +#define LIBBITCOIN_BN_EMBEDDED_HPP |
| 21 | + |
| 22 | +#include "../executor.hpp" |
| 23 | + |
| 24 | +#include <iterator> |
| 25 | +#include <bitcoin/node.hpp> |
| 26 | + |
| 27 | +#define DECLARE_EMBEDDED_PAGE(page) \ |
| 28 | +span_value page() const NOEXCEPT override |
| 29 | + |
| 30 | +#define DECLARE_EMBEDDED_PAGES(container) \ |
| 31 | +struct container : public server::settings::embedded_pages \ |
| 32 | +{ \ |
| 33 | + DECLARE_EMBEDDED_PAGE(css); \ |
| 34 | + DECLARE_EMBEDDED_PAGE(html); \ |
| 35 | + DECLARE_EMBEDDED_PAGE(ecma); \ |
| 36 | + DECLARE_EMBEDDED_PAGE(font); \ |
| 37 | + DECLARE_EMBEDDED_PAGE(icon); \ |
| 38 | +} |
| 39 | + |
| 40 | +#define DEFINE_EMBEDDED_PAGE(container, type, name, ...) \ |
| 41 | +span_value container::name() const NOEXCEPT \ |
| 42 | +{ \ |
| 43 | + static constexpr type name##_[] = __VA_ARGS__; \ |
| 44 | + static const span_value out \ |
| 45 | + ( \ |
| 46 | + const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(&name##_[0])), \ |
| 47 | + literal_length(name##_) \ |
| 48 | + ); \ |
| 49 | + return out; \ |
| 50 | +} |
| 51 | + |
| 52 | +namespace libbitcoin { |
| 53 | +namespace server { |
| 54 | + |
| 55 | +DECLARE_EMBEDDED_PAGES(web_pages); |
| 56 | +DECLARE_EMBEDDED_PAGES(explore_pages); |
| 57 | + |
| 58 | +} // namespace server |
| 59 | +} // namespace libbitcoin |
| 60 | + |
| 61 | +#endif |
0 commit comments