mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-16 22:16:53 +07:00
remove network and curly modules
This commit is contained in:
@@ -1,11 +1,15 @@
|
|||||||
-Iheaders
|
-Iheaders
|
||||||
-Iheaders/3rdparty
|
-Iheaders/3rdparty
|
||||||
-Iheaders/3rdparty/lua
|
-Iheaders/3rdparty/lua
|
||||||
|
-Iheaders/3rdparty/imgui
|
||||||
|
-Iheaders/3rdparty/pugixml
|
||||||
|
|
||||||
-Isources
|
-Isources
|
||||||
|
-Isources/3rdparty
|
||||||
|
|
||||||
-Imodules/ecs.hpp/headers
|
-Imodules/ecs.hpp/headers
|
||||||
|
-Imodules/enum.hpp/headers
|
||||||
-Imodules/flat.hpp/headers
|
-Imodules/flat.hpp/headers
|
||||||
-Imodules/curly.hpp/headers
|
|
||||||
-Imodules/promise.hpp/headers
|
-Imodules/promise.hpp/headers
|
||||||
|
|
||||||
-Imodules/glew/include
|
-Imodules/glew/include
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -34,9 +34,6 @@
|
|||||||
[submodule "modules/flat.hpp"]
|
[submodule "modules/flat.hpp"]
|
||||||
path = modules/flat.hpp
|
path = modules/flat.hpp
|
||||||
url = https://github.com/BlackMATov/flat.hpp
|
url = https://github.com/BlackMATov/flat.hpp
|
||||||
[submodule "modules/curly.hpp"]
|
|
||||||
path = modules/curly.hpp
|
|
||||||
url = https://github.com/BlackMATov/curly.hpp
|
|
||||||
[submodule "modules/spine"]
|
[submodule "modules/spine"]
|
||||||
path = modules/spine
|
path = modules/spine
|
||||||
url = https://github.com/EsotericSoftware/spine-runtimes.git
|
url = https://github.com/EsotericSoftware/spine-runtimes.git
|
||||||
|
|||||||
@@ -116,13 +116,6 @@ file(GLOB_RECURSE E2D_3RDPARTY
|
|||||||
# e2d external 3rd party
|
# e2d external 3rd party
|
||||||
#
|
#
|
||||||
|
|
||||||
set(USE_STATIC_CRT ${E2D_BUILD_WITH_STATIC_CRT} CACHE INTERNAL "" FORCE)
|
|
||||||
set(USE_SYSTEM_CURL OFF CACHE INTERNAL "" FORCE)
|
|
||||||
set(USE_EMBEDDED_CURL ON CACHE INTERNAL "" FORCE)
|
|
||||||
|
|
||||||
add_subdirectory(modules/curly.hpp)
|
|
||||||
set_target_properties(curly.hpp libcurl PROPERTIES FOLDER modules)
|
|
||||||
|
|
||||||
add_subdirectory(modules/ecs.hpp)
|
add_subdirectory(modules/ecs.hpp)
|
||||||
add_subdirectory(modules/enum.hpp)
|
add_subdirectory(modules/enum.hpp)
|
||||||
add_subdirectory(modules/flat.hpp)
|
add_subdirectory(modules/flat.hpp)
|
||||||
@@ -227,7 +220,6 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES
|
|||||||
${E2D_3RDPARTY})
|
${E2D_3RDPARTY})
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
PUBLIC curly.hpp
|
|
||||||
PUBLIC ecs.hpp
|
PUBLIC ecs.hpp
|
||||||
PUBLIC enum.hpp
|
PUBLIC enum.hpp
|
||||||
PUBLIC flat.hpp
|
PUBLIC flat.hpp
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
#include "deferrer.hpp"
|
#include "deferrer.hpp"
|
||||||
#include "engine.hpp"
|
#include "engine.hpp"
|
||||||
#include "input.hpp"
|
#include "input.hpp"
|
||||||
#include "network.hpp"
|
|
||||||
#include "platform.hpp"
|
#include "platform.hpp"
|
||||||
#include "profiler.hpp"
|
#include "profiler.hpp"
|
||||||
#include "render.hpp"
|
#include "render.hpp"
|
||||||
|
|||||||
@@ -10,19 +10,12 @@
|
|||||||
#include "../math/_all.hpp"
|
#include "../math/_all.hpp"
|
||||||
#include "../utils/_all.hpp"
|
#include "../utils/_all.hpp"
|
||||||
|
|
||||||
#include <curly.hpp/curly.hpp>
|
|
||||||
|
|
||||||
#include <promise.hpp/jobber.hpp>
|
#include <promise.hpp/jobber.hpp>
|
||||||
#include <promise.hpp/promise.hpp>
|
#include <promise.hpp/promise.hpp>
|
||||||
#include <promise.hpp/scheduler.hpp>
|
#include <promise.hpp/scheduler.hpp>
|
||||||
|
|
||||||
namespace e2d
|
namespace e2d
|
||||||
{
|
{
|
||||||
namespace net
|
|
||||||
{
|
|
||||||
using namespace curly_hpp;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace stdex
|
namespace stdex
|
||||||
{
|
{
|
||||||
using namespace jobber_hpp;
|
using namespace jobber_hpp;
|
||||||
@@ -40,7 +33,6 @@ namespace e2d
|
|||||||
class mouse;
|
class mouse;
|
||||||
class keyboard;
|
class keyboard;
|
||||||
class input;
|
class input;
|
||||||
class network;
|
|
||||||
class platform;
|
class platform;
|
||||||
class profiler;
|
class profiler;
|
||||||
class render;
|
class render;
|
||||||
|
|||||||
@@ -128,7 +128,6 @@ namespace e2d
|
|||||||
parameters& game_name(str value) noexcept;
|
parameters& game_name(str value) noexcept;
|
||||||
parameters& company_name(str value) noexcept;
|
parameters& company_name(str value) noexcept;
|
||||||
parameters& without_audio(bool value);
|
parameters& without_audio(bool value);
|
||||||
parameters& without_network(bool value);
|
|
||||||
parameters& without_graphics(bool value);
|
parameters& without_graphics(bool value);
|
||||||
parameters& debug_params(debug_parameters value) noexcept;
|
parameters& debug_params(debug_parameters value) noexcept;
|
||||||
parameters& window_params(window_parameters value) noexcept;
|
parameters& window_params(window_parameters value) noexcept;
|
||||||
@@ -137,7 +136,6 @@ namespace e2d
|
|||||||
str& game_name() noexcept;
|
str& game_name() noexcept;
|
||||||
str& company_name() noexcept;
|
str& company_name() noexcept;
|
||||||
bool& without_audio() noexcept;
|
bool& without_audio() noexcept;
|
||||||
bool& without_network() noexcept;
|
|
||||||
bool& without_graphics() noexcept;
|
bool& without_graphics() noexcept;
|
||||||
debug_parameters& debug_params() noexcept;
|
debug_parameters& debug_params() noexcept;
|
||||||
window_parameters& window_params() noexcept;
|
window_parameters& window_params() noexcept;
|
||||||
@@ -146,7 +144,6 @@ namespace e2d
|
|||||||
const str& game_name() const noexcept;
|
const str& game_name() const noexcept;
|
||||||
const str& company_name() const noexcept;
|
const str& company_name() const noexcept;
|
||||||
bool without_audio() const noexcept;
|
bool without_audio() const noexcept;
|
||||||
bool without_network() const noexcept;
|
|
||||||
bool without_graphics() const noexcept;
|
bool without_graphics() const noexcept;
|
||||||
const debug_parameters& debug_params() const noexcept;
|
const debug_parameters& debug_params() const noexcept;
|
||||||
const window_parameters& window_params() const noexcept;
|
const window_parameters& window_params() const noexcept;
|
||||||
@@ -155,7 +152,6 @@ namespace e2d
|
|||||||
str game_name_{"noname"};
|
str game_name_{"noname"};
|
||||||
str company_name_{"noname"};
|
str company_name_{"noname"};
|
||||||
bool without_audio_{false};
|
bool without_audio_{false};
|
||||||
bool without_network_{false};
|
|
||||||
bool without_graphics_{false};
|
bool without_graphics_{false};
|
||||||
debug_parameters debug_params_;
|
debug_parameters debug_params_;
|
||||||
window_parameters window_params_;
|
window_parameters window_params_;
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* This file is part of the "Enduro2D"
|
|
||||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
|
||||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "_core.hpp"
|
|
||||||
|
|
||||||
namespace e2d
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// bad_network_operation
|
|
||||||
//
|
|
||||||
|
|
||||||
class bad_network_operation final : public exception {
|
|
||||||
public:
|
|
||||||
const char* what() const noexcept final {
|
|
||||||
return "bad network operation";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// request_network_error
|
|
||||||
//
|
|
||||||
|
|
||||||
class request_network_error final : public exception {
|
|
||||||
public:
|
|
||||||
request_network_error() = default;
|
|
||||||
|
|
||||||
request_network_error(str error)
|
|
||||||
: error_(std::move(error)) {}
|
|
||||||
|
|
||||||
const char* what() const noexcept final {
|
|
||||||
return error_.empty()
|
|
||||||
? "request network error"
|
|
||||||
: error_.c_str();
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
str error_;
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// request_cancelled_exception
|
|
||||||
//
|
|
||||||
|
|
||||||
class request_cancelled_exception : public exception {
|
|
||||||
public:
|
|
||||||
const char* what() const noexcept override {
|
|
||||||
return "request cancelled exception";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// network_request
|
|
||||||
//
|
|
||||||
|
|
||||||
struct network_request final {
|
|
||||||
net::request request;
|
|
||||||
stdex::promise<net::response> promise;
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// network
|
|
||||||
//
|
|
||||||
|
|
||||||
class network final : public module<network> {
|
|
||||||
public:
|
|
||||||
network();
|
|
||||||
~network() noexcept;
|
|
||||||
|
|
||||||
network_request request(net::request_builder& rb);
|
|
||||||
network_request request(net::request_builder&& rb);
|
|
||||||
private:
|
|
||||||
class internal_state;
|
|
||||||
std::unique_ptr<internal_state> state_;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Submodule modules/curly.hpp deleted from 5bd5603def
@@ -7,9 +7,6 @@ cloc \
|
|||||||
$SCRIPT_DIR/../samples/sources \
|
$SCRIPT_DIR/../samples/sources \
|
||||||
$SCRIPT_DIR/../untests/bin \
|
$SCRIPT_DIR/../untests/bin \
|
||||||
$SCRIPT_DIR/../untests/sources \
|
$SCRIPT_DIR/../untests/sources \
|
||||||
$SCRIPT_DIR/../modules/curly.hpp/headers \
|
|
||||||
$SCRIPT_DIR/../modules/curly.hpp/sources \
|
|
||||||
$SCRIPT_DIR/../modules/curly.hpp/untests \
|
|
||||||
$SCRIPT_DIR/../modules/ecs.hpp/headers \
|
$SCRIPT_DIR/../modules/ecs.hpp/headers \
|
||||||
$SCRIPT_DIR/../modules/ecs.hpp/untests \
|
$SCRIPT_DIR/../modules/ecs.hpp/untests \
|
||||||
$SCRIPT_DIR/../modules/enum.hpp/headers \
|
$SCRIPT_DIR/../modules/enum.hpp/headers \
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ SCRIPT_DIR=`dirname "$BASH_SOURCE"`
|
|||||||
cloc \
|
cloc \
|
||||||
$SCRIPT_DIR/../headers/enduro2d \
|
$SCRIPT_DIR/../headers/enduro2d \
|
||||||
$SCRIPT_DIR/../sources/enduro2d \
|
$SCRIPT_DIR/../sources/enduro2d \
|
||||||
$SCRIPT_DIR/../modules/curly.hpp/headers \
|
|
||||||
$SCRIPT_DIR/../modules/curly.hpp/sources \
|
|
||||||
$SCRIPT_DIR/../modules/ecs.hpp/headers \
|
$SCRIPT_DIR/../modules/ecs.hpp/headers \
|
||||||
$SCRIPT_DIR/../modules/enum.hpp/headers \
|
$SCRIPT_DIR/../modules/enum.hpp/headers \
|
||||||
$SCRIPT_DIR/../modules/flat.hpp/headers \
|
$SCRIPT_DIR/../modules/flat.hpp/headers \
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
SCRIPT_DIR=`dirname "$BASH_SOURCE"`
|
SCRIPT_DIR=`dirname "$BASH_SOURCE"`
|
||||||
cloc \
|
cloc \
|
||||||
$SCRIPT_DIR/../modules/curly.hpp/headers \
|
|
||||||
$SCRIPT_DIR/../modules/curly.hpp/sources \
|
|
||||||
$SCRIPT_DIR/../modules/curly.hpp/untests \
|
|
||||||
$SCRIPT_DIR/../modules/ecs.hpp/headers \
|
$SCRIPT_DIR/../modules/ecs.hpp/headers \
|
||||||
$SCRIPT_DIR/../modules/ecs.hpp/untests \
|
$SCRIPT_DIR/../modules/ecs.hpp/untests \
|
||||||
$SCRIPT_DIR/../modules/enum.hpp/headers \
|
$SCRIPT_DIR/../modules/enum.hpp/headers \
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include <enduro2d/core/debug.hpp>
|
#include <enduro2d/core/debug.hpp>
|
||||||
#include <enduro2d/core/deferrer.hpp>
|
#include <enduro2d/core/deferrer.hpp>
|
||||||
#include <enduro2d/core/input.hpp>
|
#include <enduro2d/core/input.hpp>
|
||||||
#include <enduro2d/core/network.hpp>
|
|
||||||
#include <enduro2d/core/platform.hpp>
|
#include <enduro2d/core/platform.hpp>
|
||||||
#include <enduro2d/core/profiler.hpp>
|
#include <enduro2d/core/profiler.hpp>
|
||||||
#include <enduro2d/core/render.hpp>
|
#include <enduro2d/core/render.hpp>
|
||||||
@@ -189,11 +188,6 @@ namespace e2d
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
engine::parameters& engine::parameters::without_network(bool value) {
|
|
||||||
without_network_ = value;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
engine::parameters& engine::parameters::without_graphics(bool value) {
|
engine::parameters& engine::parameters::without_graphics(bool value) {
|
||||||
without_graphics_ = value;
|
without_graphics_ = value;
|
||||||
return *this;
|
return *this;
|
||||||
@@ -226,10 +220,6 @@ namespace e2d
|
|||||||
return without_audio_;
|
return without_audio_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool& engine::parameters::without_network() noexcept {
|
|
||||||
return without_network_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool& engine::parameters::without_graphics() noexcept {
|
bool& engine::parameters::without_graphics() noexcept {
|
||||||
return without_graphics_;
|
return without_graphics_;
|
||||||
}
|
}
|
||||||
@@ -258,10 +248,6 @@ namespace e2d
|
|||||||
return without_audio_;
|
return without_audio_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool engine::parameters::without_network() const noexcept {
|
|
||||||
return without_network_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool engine::parameters::without_graphics() const noexcept {
|
bool engine::parameters::without_graphics() const noexcept {
|
||||||
return without_graphics_;
|
return without_graphics_;
|
||||||
}
|
}
|
||||||
@@ -435,12 +421,6 @@ namespace e2d
|
|||||||
the<debug>());
|
the<debug>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup network
|
|
||||||
|
|
||||||
if ( !params.without_network() ) {
|
|
||||||
safe_module_initialize<network>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// setup graphics
|
// setup graphics
|
||||||
|
|
||||||
const bool without_graphics =
|
const bool without_graphics =
|
||||||
@@ -481,7 +461,6 @@ namespace e2d
|
|||||||
dbgui,
|
dbgui,
|
||||||
render,
|
render,
|
||||||
window,
|
window,
|
||||||
network,
|
|
||||||
audio,
|
audio,
|
||||||
input,
|
input,
|
||||||
vfs,
|
vfs,
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* This file is part of the "Enduro2D"
|
|
||||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
|
||||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
#include <enduro2d/core/network.hpp>
|
|
||||||
|
|
||||||
namespace e2d
|
|
||||||
{
|
|
||||||
class network::internal_state final : private e2d::noncopyable {
|
|
||||||
public:
|
|
||||||
internal_state() = default;
|
|
||||||
~internal_state() noexcept = default;
|
|
||||||
private:
|
|
||||||
net::performer performer_;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace e2d
|
|
||||||
{
|
|
||||||
network::network()
|
|
||||||
: state_(new internal_state()) {}
|
|
||||||
network::~network() noexcept = default;
|
|
||||||
|
|
||||||
network_request network::request(net::request_builder& rb) {
|
|
||||||
return request(std::move(rb));
|
|
||||||
}
|
|
||||||
|
|
||||||
network_request network::request(net::request_builder&& rb) {
|
|
||||||
if ( rb.callback() ) {
|
|
||||||
throw bad_network_operation();
|
|
||||||
}
|
|
||||||
stdex::promise<net::response> promise;
|
|
||||||
rb.callback([promise](net::request request) mutable {
|
|
||||||
if ( request.is_done() ) {
|
|
||||||
promise.resolve(request.take());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( request.status() == net::req_status::cancelled ) {
|
|
||||||
promise.reject(request_cancelled_exception());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
promise.reject(request_network_error(request.get_error()));
|
|
||||||
} catch (...) {
|
|
||||||
promise.reject(request_network_error());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {rb.send(), std::move(promise)};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* This file is part of the "Enduro2D"
|
|
||||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
|
||||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
#include "_core.hpp"
|
|
||||||
using namespace e2d;
|
|
||||||
|
|
||||||
TEST_CASE("network"){
|
|
||||||
network n;
|
|
||||||
|
|
||||||
SECTION("request"){
|
|
||||||
{
|
|
||||||
auto nreq = n.request(net::request_builder()
|
|
||||||
.url("http://httpbin.org/status/201"));
|
|
||||||
|
|
||||||
nreq.promise.then([](const net::response& response){
|
|
||||||
REQUIRE(response.http_code() == 201u);
|
|
||||||
}).except([](std::exception_ptr){
|
|
||||||
REQUIRE(false);
|
|
||||||
}).wait();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
auto nreq = n.request(net::request_builder()
|
|
||||||
.url("http://httpbin.org/delay/2"));
|
|
||||||
|
|
||||||
REQUIRE(nreq.request.cancel());
|
|
||||||
|
|
||||||
nreq.promise.then([](const net::response&){
|
|
||||||
REQUIRE(false);
|
|
||||||
}).except([](std::exception_ptr e){
|
|
||||||
try {
|
|
||||||
std::rethrow_exception(e);
|
|
||||||
} catch (const request_cancelled_exception&) {
|
|
||||||
REQUIRE(true);
|
|
||||||
} catch (...) {
|
|
||||||
REQUIRE(false);
|
|
||||||
}
|
|
||||||
}).wait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user