From 75d49ccdb66fa79c89f63d7fa1b60e1a013ce65e Mon Sep 17 00:00:00 2001 From: "HARMEL, Bernard" Date: Thu, 5 Sep 2024 09:19:31 +0200 Subject: [PATCH] reset endpoint --- CMakeLists.txt | 2 +- lib/include/bofstd/bofserviceendpoint.h | 18 +----------------- lib/include/bofstd/bofuri.h | 2 ++ lib/src/bofserviceendpoint.cpp | 8 ++++++++ lib/src/bofuri.cpp | 9 +++++++++ 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ad35ef..5a50bde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ #emrun --browser chrome --port 8080 --serve_after_close --serve_after_exit C:\bld\bofstd-web\binaries\bin #select .html file #compil windows: -#cmake -DCMAKE_TOOLCHAIN_FILE=C:/pro/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBUILD_SHARED_LIBS=OFF -DVCPKG_OVERLAY_PORTS=C:/pro/vcpkg/ports -DCMAKE_INSTALL_PREFIX=C:/tmp/bofstd -SC:/pro/github/bofstd -BC:/bld/bofstd-win +#cmake -DCMAKE_INSTALL_PREFIX=C:/tmp/bofstd -DCMAKE_TOOLCHAIN_FILE=C:/pro/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBUILD_SHARED_LIBS=OFF -DVCPKG_OVERLAY_PORTS=C:/pro/vcpkg/ports -SC:/pro/github/bofstd -BC:/bld/bofstd-win #compil linux: #cmake -DCMAKE_TOOLCHAIN_FILE=/home/bha/pro/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux -DBUILD_SHARED_LIBS=OFF -DVCPKG_OVERLAY_PORTS=/home/bha/pro/vcpkg/ports -DCMAKE_INSTALL_PREFIX=/tmp/bofstd -DRHEL:STRING="el9" -S/home/bha/pro/github/bofstd -B/home/bha/bld/bofstd-lin diff --git a/lib/include/bofstd/bofserviceendpoint.h b/lib/include/bofstd/bofserviceendpoint.h index d2e71ea..5018781 100644 --- a/lib/include/bofstd/bofserviceendpoint.h +++ b/lib/include/bofstd/bofserviceendpoint.h @@ -25,23 +25,6 @@ BEGIN_BOF_NAMESPACE() -struct BOF_SERVICE_ENPOINT_META_DATA -{ - bool UserMaster_B; - std::string UserArg_S; - void *pUser; - - BOF_SERVICE_ENPOINT_META_DATA() - { - Reset(); - } - void Reset() - { - UserMaster_B = false; - UserArg_S = ""; - pUser = nullptr; - } -}; class BOFSTD_EXPORT BofServiceEndpoint { public: @@ -52,6 +35,7 @@ class BOFSTD_EXPORT BofServiceEndpoint ~BofServiceEndpoint(); bool IsValid(); std::string ToString(bool _ShowName_B); + void Reset(); bool SetServiceMetaData(void *_pServiceEndpointMetaData); bool SetServiceName(const std::string &_rServiceName_S); diff --git a/lib/include/bofstd/bofuri.h b/lib/include/bofstd/bofuri.h index 1ff7084..a85c918 100644 --- a/lib/include/bofstd/bofuri.h +++ b/lib/include/bofstd/bofuri.h @@ -173,6 +173,8 @@ class BOFSTD_EXPORT BofUri /// @remarks Different operator. bool operator!=(const BofUri &_rOther_O) const; + void Reset(); + /// @brief Check if the uri instance is well formed. /// @return true if the uri is valid. /// @remarks None diff --git a/lib/src/bofserviceendpoint.cpp b/lib/src/bofserviceendpoint.cpp index 87a5c46..ebd900c 100644 --- a/lib/src/bofserviceendpoint.cpp +++ b/lib/src/bofserviceendpoint.cpp @@ -52,6 +52,14 @@ std::string BofServiceEndpoint::ToString(bool _ShowName_B) Rts += mUri.ToString(); return Rts; } +void BofServiceEndpoint::Reset() +{ + mUri.Reset(); + mServiceName_S=""; + mServiceInstance_S=""; + mServiceTagCollection.clear(); + mpServiceEndpointMetaData = nullptr; +} bool BofServiceEndpoint::SetServiceMetaData(void *_pServiceEndpointMetaData) { mpServiceEndpointMetaData = _pServiceEndpointMetaData; diff --git a/lib/src/bofuri.cpp b/lib/src/bofuri.cpp index bd65218..16a01f5 100644 --- a/lib/src/bofuri.cpp +++ b/lib/src/bofuri.cpp @@ -149,7 +149,16 @@ bool BofUri::operator!=(const BofUri &_rOther_O) const { return !(*this == _rOther_O); } +void BofUri::Reset() +{ + mSchemeAuthority_X.Reset(); + mPath=""; + mQueryParamCollection.clear(); + mFragment_S=""; + mQueryParamDelimiter_c = '&'; + mValid_B = false; +} bool BofUri::IsValid() const { return (mValid_B);