diff --git a/Arena.cc b/Arena.cc index 978cc11..1c4dd6b 100644 --- a/Arena.cc +++ b/Arena.cc @@ -21,7 +21,7 @@ #include "Arena.h" -namespace klib { +namespace scsl { Arena::Arena() @@ -280,7 +280,7 @@ Arena::Destroy() std::ostream & operator<<(std::ostream &os, Arena &arena) { - auto cursor = arena.NewCursor(); + auto cursor = arena.Start(); char cursorString[33] = {0}; snprintf(cursorString, 32, "%#016llx", (long long unsigned int) cursor); @@ -346,7 +346,7 @@ uint8_t & Arena::operator[](size_t index) { if (index > this->size) { -#if defined(KLIB_DESKTOP_BUILD) and !defined(KLIB_NO_ASSERT) +#if defined(SCSL_DESKTOP_BUILD) and !defined(SCSL_NO_ASSERT) throw std::range_error("index out of range"); #else abort(); @@ -356,4 +356,4 @@ Arena::operator[](size_t index) } -} // namespace klib +} // namespace scsl diff --git a/Arena.h b/Arena.h index 07e507a..97b16c9 100644 --- a/Arena.h +++ b/Arena.h @@ -33,7 +33,7 @@ #endif -namespace klib { +namespace scsl { /// \enum ArenaType @@ -55,7 +55,7 @@ enum class ArenaType /// Arena is the class that implements a memory arena. /// /// The Arena uses the concept of a cursor to point to memory in the arena. The -/// #NewCursor and #End methods return pointers to the start and end of the +/// #Start and #End methods return pointers to the start and end of the /// arena memory. /// /// The arena should be initialized with one of the Set methods (SetStatic, @@ -130,10 +130,10 @@ public: /// \return Returns 0 on success and -1 on error. int Open(const char *path); - /// NewCursor returns a pointer to the start of the memory in the arena. + /// Start returns a pointer to the start of the memory in the arena. /// /// \return A pointer to the start of the arena memory. - uint8_t *NewCursor() const + uint8_t *Start() const { return this->store; } /// End returns a pointer to the end of the arena memory. @@ -216,7 +216,7 @@ private: std::ostream &operator<<(std::ostream &os, Arena &arena); -} // namespace klib +} // namespace scsl #endif diff --git a/Buffer.cc b/Buffer.cc index 2e58738..230f6f2 100644 --- a/Buffer.cc +++ b/Buffer.cc @@ -13,7 +13,7 @@ #include "Buffer.h" -namespace klib { +namespace scsl { /// The defaultCapacity for a new Buffer is a reasonably arbitrary starting @@ -330,7 +330,7 @@ uint8_t & Buffer::operator[](size_t index) { if (index > this->length) { -#if defined(KLIB_DESKTOP_BUILD) and !defined(KLIB_NO_ASSERT) +#if defined(SCSL_DESKTOP_BUILD) and !defined(SCSL_NO_ASSERT) throw std::range_error("array index out of bounds"); #else abort(); @@ -360,4 +360,4 @@ operator<<(std::ostream &os, const Buffer &buf) } -} // namespace klib +} // namespace scsl diff --git a/Buffer.h b/Buffer.h index 1827c83..ba3c3b4 100644 --- a/Buffer.h +++ b/Buffer.h @@ -16,7 +16,7 @@ #include -namespace klib { +namespace scsl { /// Buffer is a basic line buffer. /// @@ -211,7 +211,7 @@ std::ostream &operator<<(std::ostream &os, const Buffer &buf); /// differ. inline bool operator!=(const Buffer &lhs, const Buffer &rhs) { return !(lhs == rhs); }; -} // namespace klib +} // namespace scsl #endif // KGE_BUFFER_H diff --git a/CMakeDocs.txt b/CMakeDocs.txt index 8c23df7..62bc8e4 100644 --- a/CMakeDocs.txt +++ b/CMakeDocs.txt @@ -1,4 +1,4 @@ -# Doxygen support for klib. +# Doxygen support for scsl. find_package(Doxygen) if (${DOXYGEN_FOUND}) @@ -6,11 +6,11 @@ set(DOXYGEN_GENERATE_MAN YES) set(DOXYGEN_GENERATE_LATEX YES) #set(DOXYGEN_EXTRACT_ALL YES) -doxygen_add_docs(klib_docs +doxygen_add_docs(scsl_docs ${HEADER_FILES} ${SOURCE_FILES} USE_STAMP_FILE) -add_dependencies(klib klib_docs) -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/klib) +add_dependencies(scsl scsl_docs) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/scsl) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man DESTINATION share) endif () diff --git a/CMakeLists.txt b/CMakeLists.txt index fd534f3..da726b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.25) -project(klib LANGUAGES CXX +project(scsl LANGUAGES CXX VERSION 0.1.0 - DESCRIPTION "Kyle's C++ library") + DESCRIPTION "Shimmering Clarity Standard Library") set(CMAKE_CXX_STANDARD 14) set(CMAKE_VERBOSE_MAKEFILES TRUE) @@ -25,10 +25,10 @@ else () # nothing special for gcc at the moment endif () endif () -add_compile_definitions(DKLIB_DESKTOP_BUILD) -add_compile_definitions(KLIB_VERSION=${PROJECT_VERSION}) +add_compile_definitions(SCSL_DESKTOP_BUILD) +add_compile_definitions(SCSL_VERSION=${PROJECT_VERSION}) -set(HEADER_FILES klib.h +set(HEADER_FILES scsl.h Arena.h Buffer.h Dictionary.h @@ -51,55 +51,59 @@ set(SOURCE_FILES WinHelpers.cc) if (APPLE) -add_library(klib +add_library(scsl STATIC ${SOURCE_FILES} ${HEADER_FILES}) else () -add_library(klib +add_library(scsl STATIC ${SOURCE_FILES} ${HEADER_FILES}) endif() add_executable(phonebook phonebook.cc) -target_link_libraries(phonebook klib) +target_link_libraries(phonebook scsl) include(CTest) enable_testing() add_executable(tlv_test tlvTest.cc) -target_link_libraries(tlv_test klib) +target_link_libraries(tlv_test scsl) add_test(tlvTest tlv_test) add_executable(dictionary_test dictionaryTest.cc) -target_link_libraries(dictionary_test klib) +target_link_libraries(dictionary_test scsl) add_test(dictionaryTest dictionary_test) add_executable(buffer_test bufferTest.cc) -target_link_libraries(buffer_test klib) +target_link_libraries(buffer_test scsl) add_test(bufferTest buffer_test) add_executable(stringutil_test stringutil_test.cc) -target_link_libraries(stringutil_test klib) +target_link_libraries(stringutil_test scsl) add_test(stringutilTest stringutil_test) include(CMakePackageConfigHelpers) write_basic_package_version_file( - klibConfig.cmake + scslConfig.cmake VERSION ${PACKAGE_VERSION} COMPATIBILITY AnyNewerVersion ) -if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) +if (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) add_custom_target(cloc COMMAND cloc ${SOURCE_FILES} ${HEADER_FILES} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) +add_custom_target(deploy-docs + COMMAND rsync --progress -auvz ${CMAKE_CURRENT_BINARY_DIR}/html/* docs.shimmering-clarity.net:sites/cc/ + DEPENDS scsl_docs +) -configure_file(klib.pc.in klib.pc @ONLY) -install(TARGETS klib LIBRARY DESTINATION lib) +configure_file(scsl.pc.in scsl.pc @ONLY) +install(TARGETS scsl LIBRARY DESTINATION lib) install(TARGETS phonebook RUNTIME DESTINATION bin) -install(FILES ${HEADER_FILES} DESTINATION include/klib) -install(FILES klibConfig.cmake DESTINATION share/klib/cmake) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/klib.pc DESTINATION lib/pkgconfig) +install(FILES ${HEADER_FILES} DESTINATION include/scsl) +install(FILES scslConfig.cmake DESTINATION share/scsl/cmake) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/scsl.pc DESTINATION lib/pkgconfig) include(CMakePack.txt) include(CMakeDocs.txt) diff --git a/CMakePack.txt b/CMakePack.txt index 9c46fba..1a41700 100644 --- a/CMakePack.txt +++ b/CMakePack.txt @@ -2,17 +2,17 @@ include(InstallRequiredSystemLibraries) set(CPACK_PACKAGE_VENDOR "Shimmering Clarity") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Common C++ functionality.") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Shimmering Clarity standard C++ library.") set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) # Debian settings -set(CPACK_DEBIAN_PACKAGE_MAINTAINER "K. Isom") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Shimmering Clarity C++ library") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Shimmering Clarity") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Shimmering Clarity standard C++ library") set(CPACK_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION}) -set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc++1 (>= 3.7.0-1)") set(CPACK_DEBIAN_PACKAGE_SECTION devel) +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) if(LINUX) set(CPACK_GENERATOR "DEB;STGZ;TGZ") @@ -32,5 +32,5 @@ set(CPACK_SOURCE_IGNORE_FILES /.*build.*) include (CPack) -add_custom_target(package_docs DEPENDS klib_docs package package_source) +add_custom_target(package_docs DEPENDS SCSL_docs package package_source) diff --git a/Commander.cc b/Commander.cc index e475290..dce29d9 100644 --- a/Commander.cc +++ b/Commander.cc @@ -1,5 +1,5 @@ /// -/// \file Commander.cpp +/// \file Commander.cc /// \author kyle /// \date 2023-10-10 /// @@ -7,7 +7,7 @@ #include #include "Commander.h" -namespace klib { +namespace scsl { Subcommand::Status @@ -57,4 +57,4 @@ Commander::Run(std::string command, int argc, char **argv) } -} // klib \ No newline at end of file +} // scsl \ No newline at end of file diff --git a/Commander.h b/Commander.h index 6826a25..4bfa7c0 100644 --- a/Commander.h +++ b/Commander.h @@ -19,10 +19,10 @@ #include -#ifndef KLIB_COMMANDER_H -#define KLIB_COMMANDER_H +#ifndef SCSL_COMMANDER_H +#define SCSL_COMMANDER_H -namespace klib { +namespace scsl { /// CommanderFunc describes a function that can be run in Commander. @@ -104,7 +104,7 @@ private: std::map cmap; }; -} // klib +} // scsl -#endif //KLIB_COMMANDER_H +#endif //SCSL_COMMANDER_H diff --git a/Dictionary.cc b/Dictionary.cc index c344410..38f6d68 100644 --- a/Dictionary.cc +++ b/Dictionary.cc @@ -2,12 +2,12 @@ #include #include "Dictionary.h" -#if defined(KLIB_DESKTOP_BUILD) +#if defined(SCSL_DESKTOP_BUILD) #include #endif -namespace klib { +namespace scsl { bool @@ -124,7 +124,7 @@ Dictionary::spaceAvailable(uint8_t klen, uint8_t vlen) required += klen + 2; required += vlen + 2; - remaining = (uintptr_t)cursor - (uintptr_t)arena.NewCursor(); + remaining = (uintptr_t)cursor - (uintptr_t) arena.Start(); remaining = arena.Size() - remaining; return ((size_t)remaining >= required); } @@ -133,8 +133,8 @@ Dictionary::spaceAvailable(uint8_t klen, uint8_t vlen) std::ostream & operator<<(std::ostream &os, const Dictionary &dictionary) { -#if defined(KLIB_DESKTOP_BUILD) - uint8_t *cursor = (dictionary.arena).NewCursor(); +#if defined(SCSL_DESKTOP_BUILD) + uint8_t *cursor = (dictionary.arena).Start(); TLV::Record rec; TLV::ReadFromMemory(rec, cursor); @@ -164,4 +164,4 @@ Dictionary::DumpToFile(const char *path) } -} // namespace klib \ No newline at end of file +} // namespace scsl \ No newline at end of file diff --git a/Dictionary.h b/Dictionary.h index 73cd986..d259856 100644 --- a/Dictionary.h +++ b/Dictionary.h @@ -1,12 +1,12 @@ /// -/// \file klib.h +/// \file scsl.h /// \author kyle /// \date 2023-10-06 /// -#ifndef KLIB_DICTIONARY_H -#define KLIB_DICTIONARY_H +#ifndef SCSL_DICTIONARY_H +#define SCSL_DICTIONARY_H #include "Arena.h" @@ -17,7 +17,7 @@ static constexpr uint8_t DICTIONARY_TAG_KEY = 1; static constexpr uint8_t DICTIONARY_TAG_VAL = 2; -namespace klib { +namespace scsl { /* @@ -124,6 +124,6 @@ private: }; -} // namespace klib +} // namespace scsl #endif diff --git a/Exceptions.cc b/Exceptions.cc index 3c04ec1..3903b89 100644 --- a/Exceptions.cc +++ b/Exceptions.cc @@ -5,7 +5,7 @@ #include "Exceptions.h" -namespace klib { +namespace scsl { AssertionFailed::AssertionFailed(std::string message) : msg(message) diff --git a/Exceptions.h b/Exceptions.h index fbeb561..e4c9aaa 100644 --- a/Exceptions.h +++ b/Exceptions.h @@ -2,14 +2,14 @@ // Created by kyle on 2023-10-10. // -#ifndef KLIB_EXCEPTIONS_H -#define KLIB_EXCEPTIONS_H +#ifndef SCSL_EXCEPTIONS_H +#define SCSL_EXCEPTIONS_H #include #include -namespace klib { +namespace scsl { /// NotImplemented is an exception reserved for unsupported platforms. @@ -45,7 +45,7 @@ private: }; -} // namespace klib +} // namespace scsl -#endif //KLIB_EXCEPTIONS_H +#endif //SCSL_EXCEPTIONS_H diff --git a/Makefile b/Makefile index 934b62c..8852cd0 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SOURCES := $(wildcard *.cc) OBJS := Arena.o Dictionary.o TLV.o CXX := clang++ -CXXFLAGS := -g -std=c++14 -Werror -Wall -DKLIB_DESKTOP_BUILD +CXXFLAGS := -g -std=c++14 -Werror -Wall -DSCSL_DESKTOP_BUILD .PHONY: all all: $(TARGET) $(TESTS) tags run-tests diff --git a/StringUtil.cc b/StringUtil.cc index 79b8017..778e444 100644 --- a/StringUtil.cc +++ b/StringUtil.cc @@ -4,7 +4,7 @@ #include "StringUtil.h" -namespace klib { +namespace scsl { /// namespace U contains utilities. namespace U { @@ -162,4 +162,4 @@ VectorToString(const std::vector &svec) } // namespace S } // namespace U -} // namespace klib +} // namespace scsl diff --git a/StringUtil.h b/StringUtil.h index dc205c9..a32b657 100644 --- a/StringUtil.h +++ b/StringUtil.h @@ -31,9 +31,9 @@ #define STRINGUTIL_H -namespace klib { -/// namespace U contains utilities. +namespace scsl { +/// namespace U contains utilities. namespace U { /// namespace S contains string-related functions. @@ -83,21 +83,25 @@ std::vector SplitKeyValuePair(std::string line, std::string delimit /// \return The key and value. std::vector SplitKeyValuePair(std::string line, char delimiter); - -std::vector Split(std::string, std::string delimiter); -std::vector Split(std::string, char delimiter); - +/// Split a string into parts based on the delimiter. +/// +/// \param delimiter The string that delimits the parts of the string. +/// \param maxCount The maximum number of parts to split. If 0, there is no limit +/// to the number of parts. +/// \return A vector containing all the parts of the string. std::vector SplitN(std::string, std::string delimiter, size_t maxCount=0); + //std::vector SplitN(std::string, char delimiter, size_t size_t maxCount=0); +/// Return a string represention of a string vector in the form [size]{"foo", "bar", ...}. std::ostream &VectorToString(std::ostream &os, const std::vector &svec); -std::string VectorToString(const std::vector &svec); +std::string VectorToString(const std::vector &svec); } // namespace S } // namespace U -} // namespace klib +} // namespace scsl #endif // STRINGUTIL_H diff --git a/TLV.cc b/TLV.cc index 4802bb1..44401b1 100644 --- a/TLV.cc +++ b/TLV.cc @@ -1,13 +1,13 @@ #include #include "TLV.h" -using namespace klib; +using namespace scsl; #define REC_SIZE(x) ((std::size_t)x.Len + 2) -namespace klib { +namespace scsl { namespace TLV { @@ -103,7 +103,7 @@ LocateTag(Arena &arena, uint8_t *cursor, Record &rec) uint8_t tag, len; if (cursor == nullptr) { - cursor = arena.NewCursor(); + cursor = arena.Start(); } while ((tag = cursor[0]) != rec.Tag) { @@ -155,7 +155,7 @@ DeleteRecord(Arena &arena, uint8_t *cursor) } uint8_t len = cursor[1] + 2; - uint8_t *stop = arena.NewCursor() + arena.Size(); + uint8_t *stop = arena.Start() + arena.Size(); stop -= len; @@ -173,4 +173,4 @@ DeleteRecord(Arena &arena, uint8_t *cursor) } // namespace TLV -} // namespace klib \ No newline at end of file +} // namespace scsl \ No newline at end of file diff --git a/TLV.h b/TLV.h index 0ffa62d..0821217 100644 --- a/TLV.h +++ b/TLV.h @@ -20,7 +20,7 @@ #include "Arena.h" -namespace klib { +namespace scsl { namespace TLV { #ifndef TLV_MAX_LEN @@ -123,7 +123,7 @@ uint8_t *SkipRecord(Record &rec, uint8_t *cursor); } // namespace TLV -} // namespace klib +} // namespace scsl #endif diff --git a/Test.cc b/Test.cc index e4c0360..828513c 100644 --- a/Test.cc +++ b/Test.cc @@ -10,12 +10,12 @@ #include -namespace klib { +namespace scsl { void TestAssert(bool condition, std::string message) { -#if defined(NDEBUG) || defined(KLIB_NO_ASSERT) +#if defined(NDEBUG) || defined(SCSL_NO_ASSERT) if (!condition) { throw AssertionFailed(message); } @@ -35,7 +35,7 @@ TestAssert(bool condition) if (condition) { return; } -#if defined(KLIB_NO_ASSERT) +#if defined(SCSL_NO_ASSERT) std::cerr << "Assertion failed!\n"; #else std::stringstream msg; @@ -49,4 +49,4 @@ TestAssert(bool condition) } -} // namespace klib +} // namespace scsl diff --git a/Test.h b/Test.h index 04f88f8..d96388a 100644 --- a/Test.h +++ b/Test.h @@ -4,13 +4,13 @@ /// \date 2023-10-09 /// \brief Test.h implements basic testing tools. /// -#ifndef KLIB_TEST_H -#define KLIB_TEST_H +#ifndef SCSL_TEST_H +#define SCSL_TEST_H #include -namespace klib { +namespace scsl { /// TestAssert is a variant on the assert macro. This variant is intended to be @@ -29,7 +29,7 @@ void TestAssert(bool condition); /// If NDEBUG is set, TestAssert will throw an exception if condition is false. /// Otherwise, it calls assert after printing the message. /// -/// In addition to NDEBUG, KLIB_NO_ASSERT will suppress assertions. +/// In addition to NDEBUG, SCSL_NO_ASSERT will suppress assertions. /// /// \throws AssertionFailed /// @@ -38,6 +38,6 @@ void TestAssert(bool condition); void TestAssert(bool condition, std::string message); -} // namespace klib +} // namespace scsl -#endif //KLIB_TEST_H +#endif //SCSL_TEST_H diff --git a/WinHelpers.cc b/WinHelpers.cc index 2236926..7420e12 100644 --- a/WinHelpers.cc +++ b/WinHelpers.cc @@ -7,7 +7,7 @@ #include "WinHelpers.h" -namespace klib { +namespace scsl { namespace Windows { @@ -136,7 +136,7 @@ CreateFixedSizeFile(const char *path, size_t size) } // namespace Windows -} // namespace klib +} // namespace scsl #endif \ No newline at end of file diff --git a/WinHelpers.h b/WinHelpers.h index e1cd98b..e00b98d 100644 --- a/WinHelpers.h +++ b/WinHelpers.h @@ -2,8 +2,8 @@ // Created by kyle on 2023-10-10. // -#ifndef KLIB_WINHELPERS_H -#define KLIB_WINHELPERS_H +#ifndef SCSL_WINHELPERS_H +#define SCSL_WINHELPERS_H #if defined(__WIN64__) || defined(__WIN32__) || defined(WIN32) @@ -12,7 +12,7 @@ #include #include -namespace klib { +namespace scsl { namespace Windows { @@ -32,8 +32,8 @@ int CreateFixedSizeFile(const char *path, size_t size); } // namespace Windows -} // namespace klib +} // namespace scsl #endif // Windows-only guards. -#endif //KLIB_WINHELPERS_H +#endif //SCSL_WINHELPERS_H diff --git a/bufferTest.cc b/bufferTest.cc index 5c22080..aff9a99 100644 --- a/bufferTest.cc +++ b/bufferTest.cc @@ -2,7 +2,7 @@ #include #include "Buffer.h" -using namespace klib; +using namespace scsl; int diff --git a/dictionaryTest.cc b/dictionaryTest.cc index a242c5a..b888a76 100644 --- a/dictionaryTest.cc +++ b/dictionaryTest.cc @@ -6,7 +6,7 @@ #include "testFixtures.h" -using namespace klib; +using namespace scsl; constexpr char TEST_KVSTR1[] = "foo"; diff --git a/klibConfig.cmake b/klibConfig.cmake deleted file mode 100644 index e44d01f..0000000 --- a/klibConfig.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(KLIB_INCLUDE_DIRS include/klib) -set(KLIB_LIBRARIES libklib.a) \ No newline at end of file diff --git a/phonebook.cc b/phonebook.cc index 364f3be..46223ab 100644 --- a/phonebook.cc +++ b/phonebook.cc @@ -9,7 +9,7 @@ using namespace std; #include "Arena.h" #include "Commander.h" #include "Dictionary.h" -using namespace klib; +using namespace scsl; static const char *defaultPhonebook = "pb.dat"; static char *pbFile = (char *)defaultPhonebook; diff --git a/klib.h b/scsl.h similarity index 90% rename from klib.h rename to scsl.h index 2c00588..cb0d763 100644 --- a/klib.h +++ b/scsl.h @@ -1,8 +1,8 @@ /// -/// \file klib.h +/// \file scsl.h /// \author kyle /// \created 2023-10-10 -/// \brief klib is my collection of C++ data structures and code. +/// \brief scsl is my collection of C++ data structures and code. /// /// \section COPYRIGHT /// Copyright 2023 K. Isom @@ -21,8 +21,8 @@ /// SOFTWARE. /// -#ifndef KLIB_KLIB_H -#define KLIB_KLIB_H +#ifndef SCSL_SCSL_H +#define SCSL_SCSL_H #include @@ -33,10 +33,10 @@ #include -/// klib is the top-level namespace containing all the code in this library. -namespace klib { +/// scsl is the top-level namespace containing all the code in this library. +namespace scsl { -/// \mainpage klib documentation +/// \mainpage scsl documentation /// /// \section Introduction /// @@ -71,4 +71,4 @@ namespace klib { } -#endif // KLIB_KLIB_H +#endif // SCSL_SCSL_H diff --git a/klib.pc.in b/scsl.pc.in similarity index 100% rename from klib.pc.in rename to scsl.pc.in diff --git a/scslConfig.cmake b/scslConfig.cmake new file mode 100644 index 0000000..e034431 --- /dev/null +++ b/scslConfig.cmake @@ -0,0 +1,2 @@ +set(SCSL_INCLUDE_DIRS include/scsl) +set(SCSL_LIBRARIES libscsl.a) \ No newline at end of file diff --git a/stringutil_test.cc b/stringutil_test.cc index 945350d..9f7d2ea 100644 --- a/stringutil_test.cc +++ b/stringutil_test.cc @@ -27,7 +27,7 @@ #include "StringUtil.h" #include "Test.h" -using namespace klib; +using namespace scsl; static void @@ -114,4 +114,6 @@ main() std::vector{"abc", "def:ghij:klm"}); TestSplit("abc:def:ghij:klm", ":", 1, std::vector{"abc:def:ghij:klm"}); + TestSplit("abc::def:ghi", ":", 0, + std::vector{"abc", "", "def", "ghi"}); } \ No newline at end of file diff --git a/testFixtures.h b/testFixtures.h index 1fe1176..79c87a5 100644 --- a/testFixtures.h +++ b/testFixtures.h @@ -1,5 +1,5 @@ -#ifndef KLIB_TESTFIXTURES_H -#define KLIB_TESTFIXTURES_H +#ifndef SCSL_TESTFIXTURES_H +#define SCSL_TESTFIXTURES_H #include @@ -22,7 +22,7 @@ #define TEST_STRLEN4 35 -namespace klib { +namespace scsl { static bool @@ -44,7 +44,7 @@ cmpRecord(TLV::Record &a, TLV::Record &b) } -} // namespace klib +} // namespace scsl -#endif // KLIB_TESTFIXTURES_H +#endif // SCSL_TESTFIXTURES_H diff --git a/tlvTest.cc b/tlvTest.cc index 0e0999f..36782ba 100644 --- a/tlvTest.cc +++ b/tlvTest.cc @@ -9,7 +9,7 @@ #include "testFixtures.h" -using namespace klib; +using namespace scsl; static uint8_t arenaBuffer[ARENA_SIZE]; @@ -40,7 +40,7 @@ tlvTestSuite(Arena &backend) std::cout << "\tFindTag 1" << "\n"; cursor = TLV::FindTag(backend, cursor, rec4); assert(cursor != nullptr); - assert(cursor != backend.NewCursor()); + assert(cursor != backend.Start()); assert(cmpRecord(rec1, rec4)); std::cout << "\tFindTag 2" << "\n";