Fixes for ConstString
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
517f95bfc5
commit
84b08f66e5
|
@ -4,18 +4,18 @@ project(Arbutils)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
|
|
||||||
if (SHARED)
|
|
||||||
add_library(Arbutils SHARED ${SRC_FILES})
|
|
||||||
else()
|
|
||||||
add_library(Arbutils STATIC ${SRC_FILES})
|
|
||||||
endif(SHARED)
|
|
||||||
set_target_properties(Arbutils PROPERTIES LINKER_LANGUAGE CXX)
|
|
||||||
|
|
||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
ADD_DEFINITIONS(-D WINDOWS=1)
|
ADD_DEFINITIONS(-D WINDOWS=1)
|
||||||
endif (WINDOWS)
|
endif (WINDOWS)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
|
||||||
|
set(LIBTYPE STATIC)
|
||||||
|
if (SHARED)
|
||||||
|
set(LIBTYPE SHARED)
|
||||||
|
endif(SHARED)
|
||||||
|
add_library(Arbutils ${LIBTYPE} ${SRC_FILES})
|
||||||
|
|
||||||
|
|
||||||
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
|
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
|
||||||
if (NOT DEFINED CONAN_EXPORTED)
|
if (NOT DEFINED CONAN_EXPORTED)
|
||||||
add_executable(ArbutilsTests ${TEST_FILES} extern/catch.hpp)
|
add_executable(ArbutilsTests ${TEST_FILES} extern/catch.hpp)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "ConstString.hpp"
|
#include "ConstString.hpp"
|
||||||
|
|
||||||
Arbutils::__ConstStringCharHolder* Arbutils::CaseInsensitiveConstString::__emptyString = nullptr;
|
Arbutils::__ConstStringCharHolder* Arbutils::CaseInsensitiveConstString::__emptyString = new __ConstStringCharHolder("", 0);;
|
||||||
Arbutils::__ConstStringCharHolder* Arbutils::ConstString::__emptyString = nullptr;
|
Arbutils::__ConstStringCharHolder* Arbutils::ConstString::__emptyString = new __ConstStringCharHolder("", 0);;
|
|
@ -17,11 +17,7 @@
|
||||||
hashFunction; \
|
hashFunction; \
|
||||||
\
|
\
|
||||||
static __ConstStringCharHolder* __emptyString; \
|
static __ConstStringCharHolder* __emptyString; \
|
||||||
static inline __ConstStringCharHolder* GetEmptyString() { \
|
static inline __ConstStringCharHolder* GetEmptyString() { return __emptyString; } \
|
||||||
if (__emptyString == nullptr) \
|
|
||||||
__emptyString = new __ConstStringCharHolder("", 0); \
|
|
||||||
return __emptyString; \
|
|
||||||
} \
|
|
||||||
\
|
\
|
||||||
inline static int constexpr Length(const char* str) { return *str ? 1 + Length(str + 1) : 0; } \
|
inline static int constexpr Length(const char* str) { return *str ? 1 + Length(str + 1) : 0; } \
|
||||||
inline __ConstStringCharHolder* CloneHolder() const noexcept { \
|
inline __ConstStringCharHolder* CloneHolder() const noexcept { \
|
||||||
|
|
Loading…
Reference in New Issue