-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72b8344
commit f2743b5
Showing
17 changed files
with
261 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
source/core/test/src/io/compress/compression_provider_test.cpp
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
project(tactile-zlib-compression CXX) | ||
|
||
add_library(tactile-zlib-compression SHARED EXCLUDE_FROM_ALL) | ||
add_library(tactile::zlib_compression ALIAS tactile-zlib-compression) | ||
|
||
target_sources(tactile-zlib-compression | ||
PRIVATE | ||
"${PROJECT_SOURCE_DIR}/inc/tactile/zlib_compression/api.hpp" | ||
"${PROJECT_SOURCE_DIR}/inc/tactile/zlib_compression/zlib_compression_plugin.hpp" | ||
"${PROJECT_SOURCE_DIR}/src/tactile/zlib_compression/zlib_compression_plugin.cpp" | ||
"${PROJECT_SOURCE_DIR}/inc/tactile/zlib_compression/zlib_compressor.hpp" | ||
"${PROJECT_SOURCE_DIR}/src/tactile/zlib_compression/zlib_compressor.cpp" | ||
) | ||
|
||
tactile_prepare_target(tactile-zlib-compression) | ||
|
||
target_include_directories(tactile-zlib-compression PUBLIC "${PROJECT_SOURCE_DIR}/inc") | ||
|
||
target_compile_definitions(tactile-zlib-compression PRIVATE "TACTILE_BUILDING_ZLIB_COMPRESSION") | ||
|
||
target_link_libraries(tactile-zlib-compression | ||
PUBLIC | ||
tactile::base | ||
tactile::runtime | ||
|
||
PRIVATE | ||
ZLIB::ZLIB | ||
) | ||
|
||
if (TACTILE_BUILD_TESTS MATCHES "ON") | ||
add_subdirectory(test) | ||
endif () |
11 changes: 11 additions & 0 deletions
11
source/zlib_compression/inc/tactile/zlib_compression/api.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) | ||
|
||
#pragma once | ||
|
||
#include "tactile/base/prelude.hpp" | ||
|
||
#ifdef TACTILE_BUILDING_ZLIB_COMPRESSION | ||
#define TACTILE_ZLIB_API TACTILE_DLL_EXPORT | ||
#else | ||
#define TACTILE_ZLIB_API TACTILE_DLL_IMPORT | ||
#endif |
33 changes: 33 additions & 0 deletions
33
source/zlib_compression/inc/tactile/zlib_compression/zlib_compression_plugin.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) | ||
|
||
#pragma once | ||
|
||
#include "tactile/base/container/smart_ptr.hpp" | ||
#include "tactile/base/prelude.hpp" | ||
#include "tactile/runtime/plugin.hpp" | ||
#include "tactile/zlib_compression/api.hpp" | ||
#include "tactile/zlib_compression/zlib_compressor.hpp" | ||
|
||
namespace tactile { | ||
|
||
/** | ||
* Manages the Zlib compression plugin. | ||
*/ | ||
class TACTILE_ZLIB_API ZlibCompressionPlugin final : public IPlugin | ||
{ | ||
public: | ||
void load(Runtime& runtime) override; | ||
|
||
void unload(Runtime& runtime) override; | ||
|
||
private: | ||
Unique<ZlibCompressor> mCompressor {}; | ||
}; | ||
|
||
extern "C" | ||
{ | ||
TACTILE_ZLIB_API auto tactile_make_plugin() -> IPlugin*; | ||
TACTILE_ZLIB_API void tactile_free_plugin(IPlugin* plugin); | ||
} | ||
|
||
} // namespace tactile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
source/zlib_compression/src/tactile/zlib_compression/zlib_compression_plugin.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) | ||
|
||
#include "tactile/zlib_compression/zlib_compression_plugin.hpp" | ||
|
||
#include <new> // nothrow | ||
|
||
#include "tactile/runtime/runtime.hpp" | ||
|
||
namespace tactile { | ||
|
||
void ZlibCompressionPlugin::load(Runtime& runtime) | ||
{ | ||
mCompressor = std::make_unique<ZlibCompressor>(); | ||
runtime.set_compression_provider(CompressionType::kZlib, mCompressor.get()); | ||
} | ||
|
||
void ZlibCompressionPlugin::unload(Runtime& runtime) | ||
{ | ||
runtime.set_compression_provider(CompressionType::kZlib, nullptr); | ||
mCompressor.reset(); | ||
} | ||
|
||
auto tactile_make_plugin() -> IPlugin* | ||
{ | ||
return new (std::nothrow) ZlibCompressionPlugin {}; | ||
} | ||
|
||
void tactile_free_plugin(IPlugin* plugin) | ||
{ | ||
delete plugin; | ||
} | ||
|
||
} // namespace tactile |
Oops, something went wrong.