From 28905d301e1e6a1d4d1d02a864b20f4bf7bcb1e3 Mon Sep 17 00:00:00 2001 From: Hartmut Seichter Date: Wed, 16 Jan 2019 11:37:36 +0100 Subject: [PATCH] skeletton for an io system --- src/CMakeLists.txt | 2 ++ src/io/CMakeLists.txt | 27 +++++++++++++++++ src/io/include/pw/io/image_io.hpp | 50 +++++++++++++++++++++++++++++++ src/io/src/image_io.cpp | 18 +++++++++++ 4 files changed, 97 insertions(+) create mode 100644 src/io/CMakeLists.txt create mode 100644 src/io/include/pw/io/image_io.hpp create mode 100644 src/io/src/image_io.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2965454..73942ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,6 +4,8 @@ add_subdirectory(deps) add_subdirectory(core) add_subdirectory(scene) add_subdirectory(system) +add_subdirectory(io) + #add_subdirectory(ui) add_subdirectory(scripting) add_subdirectory(visual) diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt new file mode 100644 index 0000000..3b10b9d --- /dev/null +++ b/src/io/CMakeLists.txt @@ -0,0 +1,27 @@ + +set(hdrs + include/pw/io/image_io.hpp + ) + +set(srcs + src/image_io.cpp + ) + +add_library(pwio + STATIC + ${hdrs} + ${srcs} + ) + +target_include_directories( + pwio + PUBLIC + include + ) + +target_link_libraries(pwio pwcore) + + +#add_subdirectory(src) +#add_subdirectory(tests) + diff --git a/src/io/include/pw/io/image_io.hpp b/src/io/include/pw/io/image_io.hpp new file mode 100644 index 0000000..fce9c0e --- /dev/null +++ b/src/io/include/pw/io/image_io.hpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1999-2019 Hartmut Seichter + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef PW_IO_IMAGE_IO_HPP +#define PW_IO_IMAGE_IO_HPP + +#include + +namespace pw { + +class image_io { +public: + + static image_io& get(); + + image read(std::string const& uri,uint32_t flags = 0); + +protected: + + struct impl; + std::unique_ptr _impl; + + image_io() = default; + ~image_io() = default; + +}; + +} + +#endif diff --git a/src/io/src/image_io.cpp b/src/io/src/image_io.cpp new file mode 100644 index 0000000..2d42865 --- /dev/null +++ b/src/io/src/image_io.cpp @@ -0,0 +1,18 @@ +#include "pw/io/image_io.hpp" + +namespace pw { + + +struct image_io::impl +{ + +}; + + +image_io &image_io::get() +{ + static image_io instance; + return instance; +} + +}