From 7351e3be10569f81fd21c6cb73b22aaf73168001 Mon Sep 17 00:00:00 2001 From: rexy712 Date: Mon, 6 Apr 2020 16:51:38 -0700 Subject: [PATCH] Reorganize file structure again. Fix confusing issue dealing with null terminators with static_string using an array for initialization --- CMakeLists.txt | 8 ++++---- {rexy/include => include/rexy}/binary.hpp | 0 .../rexy}/detail/binary_string_conv.hpp | 0 .../include => include/rexy}/detail/default_allocator.hpp | 0 {rexy/include => include/rexy}/detail/util.hpp | 0 {rexy/include => include/rexy}/filerd.hpp | 0 {rexy/include => include/rexy}/string.hpp | 0 {rexy/include => include/rexy}/string_base.hpp | 2 -- {rexy/include => include/rexy}/string_base.tpp | 3 --- {rexy/src => src}/binary.cpp | 2 +- {rexy/src => src}/filerd.cpp | 2 +- {rexy/src => src}/string_base.cpp | 2 +- 12 files changed, 7 insertions(+), 12 deletions(-) rename {rexy/include => include/rexy}/binary.hpp (100%) rename {rexy/include => include/rexy}/detail/binary_string_conv.hpp (100%) rename {rexy/include => include/rexy}/detail/default_allocator.hpp (100%) rename {rexy/include => include/rexy}/detail/util.hpp (100%) rename {rexy/include => include/rexy}/filerd.hpp (100%) rename {rexy/include => include/rexy}/string.hpp (100%) rename {rexy/include => include/rexy}/string_base.hpp (99%) rename {rexy/include => include/rexy}/string_base.tpp (98%) rename {rexy/src => src}/binary.cpp (96%) rename {rexy/src => src}/filerd.cpp (98%) rename {rexy/src => src}/string_base.cpp (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10ef559..4ece25e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,8 @@ project(librexy) set(librexy_VERSION_MAJOR 0) set(librexy_VERSION_MINOR 1) set(librexy_VERSION_REVISION 0) -set(INCLUDE_PATH ${CMAKE_SOURCE_DIR}) -include_directories("${INCLUDE_PATH}") +set(INCLUDE_PATH ${CMAKE_SOURCE_DIR}/include) +include_directories(BEFORE SYSTEM "${INCLUDE_PATH}") set(LIBREXY_LIBFLAGS "-lrexy") @@ -14,7 +14,7 @@ option(ENABLE_SHARED "Build shared library" ON) option(ENABLE_PROFILING "Enable asan" OFF) mark_as_advanced(ENABLE_PROFILING) -set(SOURCE_LIST "rexy/src/binary.cpp" "rexy/src/string_base.cpp" "rexy/src/filerd.cpp") +set(SOURCE_LIST "src/binary.cpp" "src/string_base.cpp" "src/filerd.cpp") if(ENABLE_SHARED) add_library(rexy SHARED ${SOURCE_LIST}) set_target_properties(rexy PROPERTIES SOVERSION "${librexy_VERSION_MAJOR}.${librexy_VERSION_MINOR}.${librexy_VERSION_REVISION}") @@ -27,7 +27,7 @@ if(ENABLE_PROFILING) target_link_options(rexy PRIVATE -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls) endif() -set(LIBREXY_PUBLIC_HEADERS "rexy/include/binary.hpp" "rexy/include/string_base.hpp" "rexy/include/string.hpp" "rexy/include/filerd.hpp" "rexy/include/string_base.tpp" "rexy/include/detail/binary_string_conv.hpp" "rexy/include/detail/default_allocator.hpp" "rexy/include/detail/util.hpp") +set(LIBREXY_PUBLIC_HEADERS "include/rexy/binary.hpp" "include/rexy/string_base.hpp" "include/rexy/string.hpp" "include/rexy/filerd.hpp" "include/rexy/string_base.tpp" "include/rexy/detail/binary_string_conv.hpp" "include/rexy/detail/default_allocator.hpp" "include/rexy/detail/util.hpp") target_compile_options(rexy PRIVATE -Wall -Wextra -pedantic -std=c++17) install(TARGETS rexy diff --git a/rexy/include/binary.hpp b/include/rexy/binary.hpp similarity index 100% rename from rexy/include/binary.hpp rename to include/rexy/binary.hpp diff --git a/rexy/include/detail/binary_string_conv.hpp b/include/rexy/detail/binary_string_conv.hpp similarity index 100% rename from rexy/include/detail/binary_string_conv.hpp rename to include/rexy/detail/binary_string_conv.hpp diff --git a/rexy/include/detail/default_allocator.hpp b/include/rexy/detail/default_allocator.hpp similarity index 100% rename from rexy/include/detail/default_allocator.hpp rename to include/rexy/detail/default_allocator.hpp diff --git a/rexy/include/detail/util.hpp b/include/rexy/detail/util.hpp similarity index 100% rename from rexy/include/detail/util.hpp rename to include/rexy/detail/util.hpp diff --git a/rexy/include/filerd.hpp b/include/rexy/filerd.hpp similarity index 100% rename from rexy/include/filerd.hpp rename to include/rexy/filerd.hpp diff --git a/rexy/include/string.hpp b/include/rexy/string.hpp similarity index 100% rename from rexy/include/string.hpp rename to include/rexy/string.hpp diff --git a/rexy/include/string_base.hpp b/include/rexy/string_base.hpp similarity index 99% rename from rexy/include/string_base.hpp rename to include/rexy/string_base.hpp index ef11bb3..a6674d9 100644 --- a/rexy/include/string_base.hpp +++ b/include/rexy/string_base.hpp @@ -137,8 +137,6 @@ namespace rexy{ { public: constexpr static_string(void) = default; - template - constexpr static_string(const char(&str)[N]); constexpr static_string(const char* str, size_t len); static_string(const char* c); constexpr static_string(const static_string& s); diff --git a/rexy/include/string_base.tpp b/include/rexy/string_base.tpp similarity index 98% rename from rexy/include/string_base.tpp rename to include/rexy/string_base.tpp index f68836f..3de578b 100644 --- a/rexy/include/string_base.tpp +++ b/include/rexy/string_base.tpp @@ -218,9 +218,6 @@ namespace rexy{ } - template - constexpr static_string::static_string(const char(&str)[N]): - string_base(const_cast(str), N, N){} constexpr static_string::static_string(const char* str, size_t len): string_base(const_cast(str), len, len){} constexpr static_string::static_string(const static_string& s): diff --git a/rexy/src/binary.cpp b/src/binary.cpp similarity index 96% rename from rexy/src/binary.cpp rename to src/binary.cpp index c55b0e0..523c07a 100644 --- a/rexy/src/binary.cpp +++ b/src/binary.cpp @@ -16,7 +16,7 @@ along with this program. If not, see . */ -#include "rexy/include/binary.hpp" +#include "rexy/binary.hpp" namespace rexy{ diff --git a/rexy/src/filerd.cpp b/src/filerd.cpp similarity index 98% rename from rexy/src/filerd.cpp rename to src/filerd.cpp index 6f1e56e..fb79649 100644 --- a/rexy/src/filerd.cpp +++ b/src/filerd.cpp @@ -16,7 +16,7 @@ along with this program. If not, see . */ -#include "rexy/include/filerd.hpp" +#include "rexy/filerd.hpp" #include //fopen, fclose #include //exchange, swap diff --git a/rexy/src/string_base.cpp b/src/string_base.cpp similarity index 97% rename from rexy/src/string_base.cpp rename to src/string_base.cpp index 5d0375d..2925d0f 100644 --- a/rexy/src/string_base.cpp +++ b/src/string_base.cpp @@ -16,7 +16,7 @@ along with this program. If not, see . */ -#include "rexy/include/string_base.hpp" +#include "rexy/string_base.hpp" #include //exchange, swap #include //memcpy