From f5b8091ee91b8323b8e2b1044ba8be676f2bfaf4 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 19 Mar 2024 22:56:52 +0100 Subject: Definition Parser now consumes from the new Reader Next steps are to move ParseUtils functionality to DefinitinoEx, sort things into the namespaces in this library, and then prepare it to handle overloading like nlohmann_json does. On the other side, it's time for starshatter::data. --- FoundationEx/CMakeLists.txt | 3 ++- FoundationEx/include/Reader.h | 44 ---------------------------------- FoundationEx/src/Reader_.cpp | 55 ------------------------------------------- 3 files changed, 2 insertions(+), 100 deletions(-) delete mode 100644 FoundationEx/include/Reader.h delete mode 100644 FoundationEx/src/Reader_.cpp (limited to 'FoundationEx') diff --git a/FoundationEx/CMakeLists.txt b/FoundationEx/CMakeLists.txt index 972a242..d7d6ffa 100644 --- a/FoundationEx/CMakeLists.txt +++ b/FoundationEx/CMakeLists.txt @@ -1,7 +1,7 @@ project(FoundationEx) + add_library( ${PROJECT_NAME} STATIC - src/Reader_.cpp src/Text.cpp src/Utils.cpp src/reader.cpp @@ -9,6 +9,7 @@ add_library( src/reader/file.cpp ) target_include_directories(${PROJECT_NAME} PUBLIC include) + add_executable(${PROJECT_NAME}_test test/Text.cpp test/reader.cpp test/data.cpp) target_link_libraries(${PROJECT_NAME}_test PRIVATE ${PROJECT_NAME} GTest::gtest_main) generate_emulator(${PROJECT_NAME}_test) diff --git a/FoundationEx/include/Reader.h b/FoundationEx/include/Reader.h deleted file mode 100644 index 2226366..0000000 --- a/FoundationEx/include/Reader.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Starshatter: The Open Source Project - Copyright (c) 2021-2024, Starshatter: The Open Source Project Contributors - Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors - Copyright (c) 1997-2006, Destroyer Studios LLC. - - AUTHOR: John DiCamillo - - - OVERVIEW - ======== - Declaration of the Reader class -*/ - -#ifndef Reader_h -#define Reader_h - -#include "Text.h" - - -class Reader -{ -public: - Reader() { } - virtual ~Reader() { } - - virtual Text more() = 0; -}; - - -class BlockReader : public Reader -{ -public: - BlockReader(const char* block); - BlockReader(const char* block, int len); - virtual Text more(); - -private: - char* data; - int done; - int length; -}; - - -#endif // Reader_h diff --git a/FoundationEx/src/Reader_.cpp b/FoundationEx/src/Reader_.cpp deleted file mode 100644 index 7efdc6a..0000000 --- a/FoundationEx/src/Reader_.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* Starshatter: The Open Source Project - Copyright (c) 2021-2024, Starshatter: The Open Source Project Contributors - Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors - Copyright (c) 1997-2006, Destroyer Studios LLC. - - AUTHOR: John DiCamillo - - - OVERVIEW - ======== - Implementation of the Reader class -*/ - -#include - -#include - -#include - - -BlockReader::BlockReader(const char* block) : - data((char*) block), - done(0), - length(0) -{ -} - - -BlockReader::BlockReader(const char* block, int len) : - data((char*) block), - done(0), - length(len) -{ -} - - -Text -BlockReader::more() -{ - if (done) return Text(); - - if (length) { - Text result(data, length); - done = 1; - return result; - } - else if (data) { - Text result(data); - done = 1; - return result; - } - - done = 1; - return Text(); -} -- cgit v1.1