From 84a628671b91e26d618765a9f2135e5fe619bd96 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 10 Feb 2020 13:58:21 +0100 Subject: [PATCH] net: add the necessary files for an HTTP client class. --- src/Makefile.am | 5 +++ src/lol-core.vcxproj | 3 ++ src/lol-core.vcxproj.filters | 15 ++++++++ src/lol/net/all.h | 16 +++++++++ src/lol/net/http.h | 47 ++++++++++++++++++++++++ src/lol/public.h | 1 + src/net/http.cpp | 70 ++++++++++++++++++++++++++++++++++++ 7 files changed, 157 insertions(+) create mode 100644 src/lol/net/all.h create mode 100644 src/lol/net/http.h create mode 100644 src/net/http.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 1d348505..e0e18984 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -60,6 +60,9 @@ liblol_core_headers = \ lol/image/pixel.h lol/image/color.h lol/image/image.h \ lol/image/resource.h lol/image/movie.h \ \ + lol/net/all.h \ + lol/net/http.h \ + \ lol/gpu/all.h \ lol/gpu/shader.h lol/gpu/indexbuffer.h lol/gpu/vertexbuffer.h \ lol/gpu/framebuffer.h lol/gpu/texture.h lol/gpu/lolfx.h \ @@ -130,6 +133,8 @@ liblol_core_sources = \ image/filter/dilate.cpp image/filter/median.cpp image/filter/yuv.cpp \ image/movie.cpp \ \ + net/http.cpp \ + \ engine/tickable.cpp engine/ticker.cpp engine/ticker.h \ engine/entity.cpp engine/entity.h \ engine/world.cpp engine/world.h \ diff --git a/src/lol-core.vcxproj b/src/lol-core.vcxproj index 173e41b7..74f0fc21 100644 --- a/src/lol-core.vcxproj +++ b/src/lol-core.vcxproj @@ -184,6 +184,7 @@ + true @@ -303,6 +304,8 @@ + + diff --git a/src/lol-core.vcxproj.filters b/src/lol-core.vcxproj.filters index df86ab05..3f37d0d7 100644 --- a/src/lol-core.vcxproj.filters +++ b/src/lol-core.vcxproj.filters @@ -226,6 +226,9 @@ mesh + + net + @@ -494,6 +497,12 @@ lol\math + + lol\net + + + lol\net + lol @@ -671,6 +680,9 @@ {1eaa8df5-7a31-4358-a1e9-0e265de6ed49} + + {0db6de04-6778-43ed-81c6-0ac49c0481f4} + {e17b998c-d494-480b-ae29-5d1564f73327} @@ -692,6 +704,9 @@ {01285b11-c6c7-4a9e-8dee-daa2c63901e4} + + {59f31039-b311-4ebf-a900-e0f7567eb636} + {a11c55f8-8e10-4270-be24-38e8d4fcf589} diff --git a/src/lol/net/all.h b/src/lol/net/all.h new file mode 100644 index 00000000..922f3b4d --- /dev/null +++ b/src/lol/net/all.h @@ -0,0 +1,16 @@ +// +// Lol Engine +// +// Copyright © 2010—2020 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. +// + +#pragma once + +#include + diff --git a/src/lol/net/http.h b/src/lol/net/http.h new file mode 100644 index 00000000..3a6e1dc8 --- /dev/null +++ b/src/lol/net/http.h @@ -0,0 +1,47 @@ +// +// Lol Engine +// +// Copyright © 2010—2020 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. +// + +#pragma once + +#include + +namespace lol +{ + +namespace net +{ + +namespace http +{ + +class client_impl; + +class client +{ +public: + client(); + ~client(); + + void get(std::string const &url); + bool is_ready() const; + std::tuple result(); + +private: + std::unique_ptr impl; +}; + +} // namespace http + +} // namespace net + +} // namespace lol + diff --git a/src/lol/public.h b/src/lol/public.h index 183135eb..7a0ef42d 100644 --- a/src/lol/public.h +++ b/src/lol/public.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/src/net/http.cpp b/src/net/http.cpp new file mode 100644 index 00000000..189ee1f3 --- /dev/null +++ b/src/net/http.cpp @@ -0,0 +1,70 @@ +// +// Lol Engine +// +// Copyright © 2010—2020 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. +// + +#pragma once + +#include + +namespace lol +{ + +namespace net +{ + +namespace http +{ + +#if __EMSCRIPTEN__ +class client_impl +{ + // FIXME +}; +#else +class client_impl +{ +public: + void get(std::string const& url) + { + + } +}; +#endif + +client::client() + : impl(std::make_unique()) +{ +} + +client::~client() +{ +} + +void client::get(std::string const &url) +{ +} + +bool client::is_ready() const +{ + return false; +} + +std::tuple client::result() +{ + return std::make_tuple(404, std::string()); +} + +} // namespace http + +} // namespace net + +} // namespace lol +