From e4973c13558b12397124d7c9423c5eb641140444 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 15 Jun 2015 22:26:26 +0300 Subject: utils/cxx/ -> cxx/ --- CMakeLists.txt | 2 ++ cxx/CMakeLists.txt | 3 +++ cxx/include/aesnixx/all.hpp | 11 +++++++++ cxx/include/aesnixx/error.hpp | 47 +++++++++++++++++++++++++++++++++++++ utils/CMakeLists.txt | 2 -- utils/cxx/CMakeLists.txt | 3 --- utils/cxx/include/aesnixx/all.hpp | 11 --------- utils/cxx/include/aesnixx/error.hpp | 47 ------------------------------------- 8 files changed, 63 insertions(+), 63 deletions(-) create mode 100644 cxx/CMakeLists.txt create mode 100644 cxx/include/aesnixx/all.hpp create mode 100644 cxx/include/aesnixx/error.hpp delete mode 100644 utils/cxx/CMakeLists.txt delete mode 100644 utils/cxx/include/aesnixx/all.hpp delete mode 100644 utils/cxx/include/aesnixx/error.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 505e823..1301aa7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,8 @@ add_library(libaesni ${libaesni_sources} ${libaesni_headers}) target_include_directories(libaesni PUBLIC include/) target_compile_definitions(libaesni PRIVATE _CRT_SECURE_NO_WARNINGS) +add_subdirectory(cxx) + add_subdirectory(examples) add_subdirectory(test) add_subdirectory(utils) diff --git a/cxx/CMakeLists.txt b/cxx/CMakeLists.txt new file mode 100644 index 0000000..14b7700 --- /dev/null +++ b/cxx/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(libaesnixx INTERFACE) +target_include_directories(libaesnixx INTERFACE include/) +target_link_libraries(libaesnixx INTERFACE libaesni) diff --git a/cxx/include/aesnixx/all.hpp b/cxx/include/aesnixx/all.hpp new file mode 100644 index 0000000..cf00535 --- /dev/null +++ b/cxx/include/aesnixx/all.hpp @@ -0,0 +1,11 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#pragma once + +#include "error.hpp" diff --git a/cxx/include/aesnixx/error.hpp b/cxx/include/aesnixx/error.hpp new file mode 100644 index 0000000..dd908c5 --- /dev/null +++ b/cxx/include/aesnixx/error.hpp @@ -0,0 +1,47 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#pragma once + +#include + +#include + +#include +#include +#include + +namespace aesni +{ + class ErrorDetailsThrowsInDestructor + { + public: + ErrorDetailsThrowsInDestructor() + { + aesni_initialize_error_details(get()); + } + + ~ErrorDetailsThrowsInDestructor() + { + if (aesni_is_error(aesni_get_error_code(get()))) + { + std::vector msg; + msg.resize(aesni_format_error(get(), NULL, 0)); + aesni_format_error(get(), msg.data(), msg.size()); + throw std::runtime_error(std::string(msg.begin(), msg.end())); + } + } + + AesNI_ErrorDetails* get() { return &m_impl; } + + operator AesNI_ErrorDetails*() { return get(); } + + private: + AesNI_ErrorDetails m_impl; + }; +} diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index cd7f340..e1099af 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,5 +1,3 @@ -add_subdirectory(cxx) - macro(util prefix) add_executable(util_${prefix} ${prefix}.cpp) target_link_libraries(util_${prefix} libaesnixx libaesni) diff --git a/utils/cxx/CMakeLists.txt b/utils/cxx/CMakeLists.txt deleted file mode 100644 index 14b7700..0000000 --- a/utils/cxx/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(libaesnixx INTERFACE) -target_include_directories(libaesnixx INTERFACE include/) -target_link_libraries(libaesnixx INTERFACE libaesni) diff --git a/utils/cxx/include/aesnixx/all.hpp b/utils/cxx/include/aesnixx/all.hpp deleted file mode 100644 index cf00535..0000000 --- a/utils/cxx/include/aesnixx/all.hpp +++ /dev/null @@ -1,11 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#pragma once - -#include "error.hpp" diff --git a/utils/cxx/include/aesnixx/error.hpp b/utils/cxx/include/aesnixx/error.hpp deleted file mode 100644 index dd908c5..0000000 --- a/utils/cxx/include/aesnixx/error.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#pragma once - -#include - -#include - -#include -#include -#include - -namespace aesni -{ - class ErrorDetailsThrowsInDestructor - { - public: - ErrorDetailsThrowsInDestructor() - { - aesni_initialize_error_details(get()); - } - - ~ErrorDetailsThrowsInDestructor() - { - if (aesni_is_error(aesni_get_error_code(get()))) - { - std::vector msg; - msg.resize(aesni_format_error(get(), NULL, 0)); - aesni_format_error(get(), msg.data(), msg.size()); - throw std::runtime_error(std::string(msg.begin(), msg.end())); - } - } - - AesNI_ErrorDetails* get() { return &m_impl; } - - operator AesNI_ErrorDetails*() { return get(); } - - private: - AesNI_ErrorDetails m_impl; - }; -} -- cgit v1.2.3