diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ec50af..689f61e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,4 +49,4 @@ if(${IS_TOPLEVEL_PROJECT}) endif() endif() -# TODO: add install target \ No newline at end of file +# TODO: add install target diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 0000000..7ee04d8 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.5) + +project(kf) + +add_library(${PROJECT_NAME} INTERFACE) +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} + INTERFACE + $ + $ +) + +set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) + +# Add a pseudo-project to make kf headers visible in IDE +file(GLOB_RECURSE ${PROJECT_NAME}_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/kf/*) + +# Organize files into filters matching their relative paths +foreach(header ${${PROJECT_NAME}_HEADERS}) + file(RELATIVE_PATH rel_path "${CMAKE_CURRENT_SOURCE_DIR}" "${header}") + get_filename_component(rel_dir "${rel_path}" DIRECTORY) + if(rel_dir) + string(REPLACE "/" "\\" filter "${rel_dir}") + source_group("${filter}" FILES "${header}") + endif() +endforeach() + +add_custom_target(${PROJECT_NAME}-headers SOURCES ${${PROJECT_NAME}_HEADERS}) \ No newline at end of file diff --git a/include/kf/ArrayUtils.h b/include/kf/containers/ArrayUtils.h similarity index 100% rename from include/kf/ArrayUtils.h rename to include/kf/containers/ArrayUtils.h diff --git a/include/kf/DoubleLinkedList.h b/include/kf/containers/DoubleLinkedList.h similarity index 100% rename from include/kf/DoubleLinkedList.h rename to include/kf/containers/DoubleLinkedList.h diff --git a/include/kf/DoubleLinkedListConstIterator.h b/include/kf/containers/DoubleLinkedListConstIterator.h similarity index 97% rename from include/kf/DoubleLinkedListConstIterator.h rename to include/kf/containers/DoubleLinkedListConstIterator.h index 1d13f32..69fa1fc 100644 --- a/include/kf/DoubleLinkedListConstIterator.h +++ b/include/kf/containers/DoubleLinkedListConstIterator.h @@ -1,4 +1,5 @@ #pragma once +#include "DoubleLinkedListEntry.h" namespace kf { diff --git a/include/kf/DoubleLinkedListDescendingIterator.h b/include/kf/containers/DoubleLinkedListDescendingIterator.h similarity index 97% rename from include/kf/DoubleLinkedListDescendingIterator.h rename to include/kf/containers/DoubleLinkedListDescendingIterator.h index c28bc0a..8bfd732 100644 --- a/include/kf/DoubleLinkedListDescendingIterator.h +++ b/include/kf/containers/DoubleLinkedListDescendingIterator.h @@ -1,4 +1,5 @@ #pragma once +#include "DoubleLinkedListEntry.h" namespace kf { diff --git a/include/kf/DoubleLinkedListDestroyer.h b/include/kf/containers/DoubleLinkedListDestroyer.h similarity index 91% rename from include/kf/DoubleLinkedListDestroyer.h rename to include/kf/containers/DoubleLinkedListDestroyer.h index 780e69f..aa4a462 100644 --- a/include/kf/DoubleLinkedListDestroyer.h +++ b/include/kf/containers/DoubleLinkedListDestroyer.h @@ -3,6 +3,8 @@ namespace kf { + // TODO: move to DoubleLinkedList + class DoubleLinkedListDestroyer { public: diff --git a/include/kf/DoubleLinkedListEntry.h b/include/kf/containers/DoubleLinkedListEntry.h similarity index 100% rename from include/kf/DoubleLinkedListEntry.h rename to include/kf/containers/DoubleLinkedListEntry.h diff --git a/include/kf/DoubleLinkedListIterator.h b/include/kf/containers/DoubleLinkedListIterator.h similarity index 97% rename from include/kf/DoubleLinkedListIterator.h rename to include/kf/containers/DoubleLinkedListIterator.h index 73e5961..5ba9f0a 100644 --- a/include/kf/DoubleLinkedListIterator.h +++ b/include/kf/containers/DoubleLinkedListIterator.h @@ -1,4 +1,5 @@ #pragma once +#include "DoubleLinkedListEntry.h" namespace kf { diff --git a/include/kf/GenericTableAvl.h b/include/kf/containers/GenericTableAvl.h similarity index 100% rename from include/kf/GenericTableAvl.h rename to include/kf/containers/GenericTableAvl.h diff --git a/include/kf/LinkedTreeMap.h b/include/kf/containers/LinkedTreeMap.h similarity index 100% rename from include/kf/LinkedTreeMap.h rename to include/kf/containers/LinkedTreeMap.h index 020af32..efe2b07 100644 --- a/include/kf/LinkedTreeMap.h +++ b/include/kf/containers/LinkedTreeMap.h @@ -1,7 +1,7 @@ #pragma once -#include "GenericTableAvl.h" #include #include +#include "GenericTableAvl.h" #include "DoubleLinkedList.h" namespace kf diff --git a/include/kf/SpanUtils.h b/include/kf/containers/SpanUtils.h similarity index 100% rename from include/kf/SpanUtils.h rename to include/kf/containers/SpanUtils.h diff --git a/include/kf/TreeMap.h b/include/kf/containers/TreeMap.h similarity index 100% rename from include/kf/TreeMap.h rename to include/kf/containers/TreeMap.h diff --git a/include/kf/TreeSet.h b/include/kf/containers/TreeSet.h similarity index 100% rename from include/kf/TreeSet.h rename to include/kf/containers/TreeSet.h diff --git a/include/kf/TreeSetIterator.h b/include/kf/containers/TreeSetIterator.h similarity index 100% rename from include/kf/TreeSetIterator.h rename to include/kf/containers/TreeSetIterator.h diff --git a/include/kf/Base64.h b/include/kf/encoding/Base64.h similarity index 98% rename from include/kf/Base64.h rename to include/kf/encoding/Base64.h index 2fe4d7d..95ffc59 100644 --- a/include/kf/Base64.h +++ b/include/kf/encoding/Base64.h @@ -1,5 +1,5 @@ #pragma once -#include "USimpleString.h" +#include "kf/string/USimpleString.h" #include namespace kf diff --git a/include/kf/EncodingDetector.h b/include/kf/encoding/EncodingDetector.h similarity index 100% rename from include/kf/EncodingDetector.h rename to include/kf/encoding/EncodingDetector.h diff --git a/include/kf/Hex.h b/include/kf/encoding/Hex.h similarity index 97% rename from include/kf/Hex.h rename to include/kf/encoding/Hex.h index f7c4c07..31c696a 100644 --- a/include/kf/Hex.h +++ b/include/kf/encoding/Hex.h @@ -1,6 +1,6 @@ #pragma once -#include "USimpleString.h" -#include "ASimpleString.h" +#include "kf/string/USimpleString.h" +#include "kf/string/ASimpleString.h" #include #include diff --git a/include/kf/TextDetector.h b/include/kf/encoding/TextDetector.h similarity index 98% rename from include/kf/TextDetector.h rename to include/kf/encoding/TextDetector.h index d278187..75624fd 100644 --- a/include/kf/TextDetector.h +++ b/include/kf/encoding/TextDetector.h @@ -3,7 +3,7 @@ #include #include #include "EncodingDetector.h" -#include "SpanUtils.h" +#include "kf/containers/SpanUtils.h" namespace kf { diff --git a/include/kf/FilenameUtils.h b/include/kf/filesystem/FilenameUtils.h similarity index 98% rename from include/kf/FilenameUtils.h rename to include/kf/filesystem/FilenameUtils.h index 0ad5690..a5964a1 100644 --- a/include/kf/FilenameUtils.h +++ b/include/kf/filesystem/FilenameUtils.h @@ -1,9 +1,10 @@ #pragma once -#include "USimpleString.h" #include +#include "kf/string/USimpleString.h" namespace kf { + // TODO: Implement a Path type instead of utils /////////////////////////////////////////////////////////////////////////////////////////////////// // FilenameUtils - inspired by http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FilenameUtils.html diff --git a/include/kf/AttachProcess.h b/include/kf/guard/AttachProcess.h similarity index 100% rename from include/kf/AttachProcess.h rename to include/kf/guard/AttachProcess.h diff --git a/include/kf/FltWorkItem.h b/include/kf/guard/FltWorkItem.h similarity index 96% rename from include/kf/FltWorkItem.h rename to include/kf/guard/FltWorkItem.h index ed40c50..878197e 100644 --- a/include/kf/FltWorkItem.h +++ b/include/kf/guard/FltWorkItem.h @@ -1,6 +1,6 @@ #pragma once -#include "ScopeFailure.h" -#include "stl/memory" +#include "kf/stl/memory" +#include "kf/guard/ScopeFailure.h" namespace kf { diff --git a/include/kf/Guard.h b/include/kf/guard/Guard.h similarity index 100% rename from include/kf/Guard.h rename to include/kf/guard/Guard.h diff --git a/include/kf/ObjectAttributes.h b/include/kf/guard/ObjectAttributes.h similarity index 100% rename from include/kf/ObjectAttributes.h rename to include/kf/guard/ObjectAttributes.h diff --git a/include/kf/ScopeExit.h b/include/kf/guard/ScopeExit.h similarity index 100% rename from include/kf/ScopeExit.h rename to include/kf/guard/ScopeExit.h diff --git a/include/kf/ScopeFailure.h b/include/kf/guard/ScopeFailure.h similarity index 100% rename from include/kf/ScopeFailure.h rename to include/kf/guard/ScopeFailure.h diff --git a/include/kf/ScopedBuffer.h b/include/kf/guard/ScopedBuffer.h similarity index 100% rename from include/kf/ScopedBuffer.h rename to include/kf/guard/ScopedBuffer.h diff --git a/include/kf/VariableSizeStruct.h b/include/kf/guard/VariableSizeStruct.h similarity index 100% rename from include/kf/VariableSizeStruct.h rename to include/kf/guard/VariableSizeStruct.h diff --git a/include/kf/Singleton.h b/include/kf/patterns/Singleton.h similarity index 100% rename from include/kf/Singleton.h rename to include/kf/patterns/Singleton.h diff --git a/include/kf/EarlyAllocator.h b/include/kf/stl/EarlyAllocator.h similarity index 100% rename from include/kf/EarlyAllocator.h rename to include/kf/stl/EarlyAllocator.h diff --git a/include/kf/ASimpleString.h b/include/kf/string/ASimpleString.h similarity index 100% rename from include/kf/ASimpleString.h rename to include/kf/string/ASimpleString.h diff --git a/include/kf/Scanner.h b/include/kf/string/Scanner.h similarity index 96% rename from include/kf/Scanner.h rename to include/kf/string/Scanner.h index ce4ff39..1c77a78 100644 --- a/include/kf/Scanner.h +++ b/include/kf/string/Scanner.h @@ -1,7 +1,5 @@ #pragma once -#include "USimpleString.h" -#include -#include "SpanUtils.h" +#include "kf/containers/SpanUtils.h" namespace kf { diff --git a/include/kf/USimpleString.h b/include/kf/string/USimpleString.h similarity index 100% rename from include/kf/USimpleString.h rename to include/kf/string/USimpleString.h diff --git a/include/kf/UString.h b/include/kf/string/UString.h similarity index 100% rename from include/kf/UString.h rename to include/kf/string/UString.h diff --git a/include/kf/UStringBuilder.h b/include/kf/string/UStringBuilder.h similarity index 100% rename from include/kf/UStringBuilder.h rename to include/kf/string/UStringBuilder.h diff --git a/include/kf/AutoSpinLock.h b/include/kf/sync/AutoSpinLock.h similarity index 100% rename from include/kf/AutoSpinLock.h rename to include/kf/sync/AutoSpinLock.h diff --git a/include/kf/ConditionVariable.h b/include/kf/sync/ConditionVariable.h similarity index 99% rename from include/kf/ConditionVariable.h rename to include/kf/sync/ConditionVariable.h index 0e79e20..e23676d 100644 --- a/include/kf/ConditionVariable.h +++ b/include/kf/sync/ConditionVariable.h @@ -1,5 +1,4 @@ #pragma once - #include "EResource.h" #include "Semaphore.h" diff --git a/include/kf/EResource.h b/include/kf/sync/EResource.h similarity index 100% rename from include/kf/EResource.h rename to include/kf/sync/EResource.h diff --git a/include/kf/EResourceExclusiveLock.h b/include/kf/sync/EResourceExclusiveLock.h similarity index 100% rename from include/kf/EResourceExclusiveLock.h rename to include/kf/sync/EResourceExclusiveLock.h diff --git a/include/kf/EResourceSharedLock.h b/include/kf/sync/EResourceSharedLock.h similarity index 100% rename from include/kf/EResourceSharedLock.h rename to include/kf/sync/EResourceSharedLock.h diff --git a/include/kf/Event.h b/include/kf/sync/Event.h similarity index 100% rename from include/kf/Event.h rename to include/kf/sync/Event.h diff --git a/include/kf/FltResource.h b/include/kf/sync/FltResource.h similarity index 100% rename from include/kf/FltResource.h rename to include/kf/sync/FltResource.h diff --git a/include/kf/FltResourceExclusiveLock.h b/include/kf/sync/FltResourceExclusiveLock.h similarity index 100% rename from include/kf/FltResourceExclusiveLock.h rename to include/kf/sync/FltResourceExclusiveLock.h diff --git a/include/kf/FltResourceSharedLock.h b/include/kf/sync/FltResourceSharedLock.h similarity index 100% rename from include/kf/FltResourceSharedLock.h rename to include/kf/sync/FltResourceSharedLock.h diff --git a/include/kf/RecursiveAutoSpinLock.h b/include/kf/sync/RecursiveAutoSpinLock.h similarity index 100% rename from include/kf/RecursiveAutoSpinLock.h rename to include/kf/sync/RecursiveAutoSpinLock.h diff --git a/include/kf/RecursiveSpinLock.h b/include/kf/sync/RecursiveSpinLock.h similarity index 100% rename from include/kf/RecursiveSpinLock.h rename to include/kf/sync/RecursiveSpinLock.h diff --git a/include/kf/Semaphore.h b/include/kf/sync/Semaphore.h similarity index 100% rename from include/kf/Semaphore.h rename to include/kf/sync/Semaphore.h diff --git a/include/kf/SpinLock.h b/include/kf/sync/SpinLock.h similarity index 100% rename from include/kf/SpinLock.h rename to include/kf/sync/SpinLock.h diff --git a/include/kf/WdfWaitAutoLock.h b/include/kf/sync/WdfWaitAutoLock.h similarity index 100% rename from include/kf/WdfWaitAutoLock.h rename to include/kf/sync/WdfWaitAutoLock.h diff --git a/include/kf/WdfWaitLock.h b/include/kf/sync/WdfWaitLock.h similarity index 100% rename from include/kf/WdfWaitLock.h rename to include/kf/sync/WdfWaitLock.h diff --git a/include/kf/Thread.h b/include/kf/thread/Thread.h similarity index 96% rename from include/kf/Thread.h rename to include/kf/thread/Thread.h index abb222c..7004ce1 100644 --- a/include/kf/Thread.h +++ b/include/kf/thread/Thread.h @@ -1,6 +1,6 @@ #pragma once -#include "ObjectAttributes.h" -#include "Guard.h" +#include "kf/guard/ObjectAttributes.h" +#include "kf/guard/Guard.h" namespace kf { diff --git a/include/kf/ThreadPool.h b/include/kf/thread/ThreadPool.h similarity index 100% rename from include/kf/ThreadPool.h rename to include/kf/thread/ThreadPool.h diff --git a/include/kf/TimerThread.h b/include/kf/thread/TimerThread.h similarity index 100% rename from include/kf/TimerThread.h rename to include/kf/thread/TimerThread.h diff --git a/include/kf/FltCommunicationPort.h b/include/kf/transport/FltCommunicationPort.h similarity index 98% rename from include/kf/FltCommunicationPort.h rename to include/kf/transport/FltCommunicationPort.h index 793e27e..093ba3f 100644 --- a/include/kf/FltCommunicationPort.h +++ b/include/kf/transport/FltCommunicationPort.h @@ -1,7 +1,7 @@ #pragma once -#include "ObjectAttributes.h" -#include "ScopeExit.h" -#include "VariableSizeStruct.h" +#include "kf/guard/ObjectAttributes.h" +#include "kf/guard/ScopeExit.h" +#include "kf/guard/VariableSizeStruct.h" namespace kf { diff --git a/test/HexTest.cpp b/test/HexTest.cpp index 0b53123..6183137 100644 --- a/test/HexTest.cpp +++ b/test/HexTest.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include +#include SCENARIO("TODO: implement") { REQUIRE(true); -} \ No newline at end of file +}