Merge remote-tracking branch 'github/main'

v1
Brett 2023-07-21 03:56:11 -04:00
commit f5069859c5
48 changed files with 68 additions and 3 deletions

4
CMakeLists.txt Normal file → Executable file
View File

@ -15,6 +15,8 @@ option(BLT_ENABLE_WARN "Enable blt::logging BLT_WARN macro" ON)
option(BLT_ENABLE_ERROR "Enable blt::logging BLT_ERROR macro" ON)
option(BLT_ENABLE_FATAL "Enable blt::logging BLT_FATAL macro" ON)
configure_file(include/blt/config.h.in config/blt/config.h @ONLY)
if(${BUILD_STD} OR ${BUILD_PROFILING})
file(GLOB_RECURSE STD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/blt/std/*.cpp")
else()
@ -50,8 +52,6 @@ message("Profiler Files ${PROFILING_FILES}")
message("Source: ${CMAKE_SOURCE_DIR}")
message("Current Source: ${CMAKE_CURRENT_SOURCE_DIR}")
configure_file(include/blt/config.h.in config/blt/config.h @ONLY)
add_library(BLT ${STD_FILES} ${PROFILING_FILES} ${NBT_FILES})
target_include_directories(BLT PUBLIC include/)

0
CMakeSettings.json Normal file → Executable file
View File

0
LICENSE Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
design.txt Normal file → Executable file
View File

0
icon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

0
icon_large.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

0
icon_small.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
include/blt/config.h.in Normal file → Executable file
View File

0
include/blt/math/averages.h Normal file → Executable file
View File

0
include/blt/math/log_util.h Normal file → Executable file
View File

0
include/blt/math/math.h Normal file → Executable file
View File

2
include/blt/math/matrix.h Normal file → Executable file
View File

@ -96,7 +96,7 @@ namespace blt {
m00(m00() * x);
m11(m11() * y);
m22(m11() * z);
m22(m22() * z);
*this = *this * scale_mat;

0
include/blt/math/vectors.h Normal file → Executable file
View File

0
include/blt/nbt/nbt.h Normal file → Executable file
View File

0
include/blt/nbt/nbt_block.h Normal file → Executable file
View File

0
include/blt/profiling/profiler.h Normal file → Executable file
View File

0
include/blt/std/binary_tree.h Normal file → Executable file
View File

0
include/blt/std/filesystem.h Normal file → Executable file
View File

0
include/blt/std/format.h Normal file → Executable file
View File

0
include/blt/std/hash_map.h Normal file → Executable file
View File

0
include/blt/std/loader.h Normal file → Executable file
View File

0
include/blt/std/logging.h Normal file → Executable file
View File

0
include/blt/std/map.h Normal file → Executable file
View File

0
include/blt/std/memory.h Normal file → Executable file
View File

0
include/blt/std/queue.h Normal file → Executable file
View File

0
include/blt/std/random.h Normal file → Executable file
View File

36
include/blt/std/string.h Normal file → Executable file
View File

@ -16,6 +16,41 @@
namespace blt::string {
class StringBuffer {
private:
const size_t BLOCK_SIZE = 4096;
size_t front = 0;
size_t size = 0;
char* characterBuffer = nullptr;
void expand();
public:
void trim();
std::string str();
StringBuffer(){
characterBuffer = static_cast<char*>(malloc(BLOCK_SIZE));
size = BLOCK_SIZE;
}
StringBuffer& operator<<(char c);
StringBuffer& operator<<(const std::string& str) {
for (char c : str)
*this << c;
return *this;
}
template<typename T>
inline StringBuffer& operator<<(T t) {
*this << std::to_string(t);
return *this;
}
~StringBuffer() {
free(characterBuffer);
}
};
static inline bool starts_with(const std::string& string, const std::string& search){
if (search.length() > string.length())
return false;
@ -153,6 +188,7 @@ namespace blt::string {
trim(s);
return s;
}
}
#endif //BLT_STRING_H

0
include/blt/std/system.h Normal file → Executable file
View File

0
include/blt/std/time.h Normal file → Executable file
View File

0
include/blt/window/window.h Normal file → Executable file
View File

0
src/blt/nbt/nbt.cpp Normal file → Executable file
View File

0
src/blt/nbt/nbt_block.cpp Normal file → Executable file
View File

0
src/blt/profiling/profiler.cpp Normal file → Executable file
View File

0
src/blt/std/filesystem.cpp Normal file → Executable file
View File

0
src/blt/std/format.cpp Normal file → Executable file
View File

0
src/blt/std/loader.cpp Normal file → Executable file
View File

0
src/blt/std/logging.cpp Normal file → Executable file
View File

29
src/blt/std/string.cpp Executable file
View File

@ -0,0 +1,29 @@
//
// Created by brett on 7/9/23.
//
#include <blt/std/string.h>
void blt::string::StringBuffer::expand() {
size_t multiplier = size / BLOCK_SIZE;
auto newSize = BLOCK_SIZE * (multiplier * 2);
characterBuffer = static_cast<char*>(realloc(characterBuffer, newSize));
size = newSize;
}
void blt::string::StringBuffer::trim() {
characterBuffer = static_cast<char*>(realloc(characterBuffer, front+1));
size = front+1;
characterBuffer[front] = '\0';
}
blt::string::StringBuffer& blt::string::StringBuffer::operator<<(char c) {
characterBuffer[front++] = c;
if (front > size)
expand();
return *this;
}
std::string blt::string::StringBuffer::str() {
trim();
return std::string{characterBuffer};
}

0
src/blt/std/system.cpp Normal file → Executable file
View File

0
src/blt/window/window.cpp Normal file → Executable file
View File

0
src/tests/binary_trees.h Normal file → Executable file
View File

0
src/tests/hashmap_tests.h Normal file → Executable file
View File

0
src/tests/logging.h Normal file → Executable file
View File

0
src/tests/main.cpp Normal file → Executable file
View File

0
src/tests/nbt_tests.h Normal file → Executable file
View File

0
src/tests/profiling_tests.h Normal file → Executable file
View File

0
src/tests/queue_tests.h Normal file → Executable file
View File