From 7c9afd5226167ddb0e2aa9e9a3ecf5cece59ca24 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Wed, 20 Nov 2024 18:45:02 +0000 Subject: [PATCH] Update to 1.0.4 (#1) --- CMakeLists.txt | 33 ++++++++++++------- README.md | 1 - examples/ledger_with_csv_encoding.cpp | 8 +++++ examples/minimal.cpp | 1 + examples/minimal_query.cpp | 3 +- examples/transactions_transfer_basic.cpp | 1 + .../transactions_transfer_read_replica.cpp | 1 + 7 files changed, 34 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 871fb02..6df0e28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,18 +5,27 @@ project(couchbase_cxx_client_demo CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -include(cmake/CPM.cmake) +find_package(fmt REQUIRED) +find_package(couchbase_cxx_client) -cpmaddpackage( - NAME - couchbase_cxx_client - GIT_TAG - 1.0.1 - VERSION - 1.0.1 - GITHUB_REPOSITORY - "couchbase/couchbase-cxx-client" - OPTIONS - "COUCHBASE_CXX_CLIENT_STATIC_BORINGSSL ON") +if (couchbase_cxx_client_FOUND) + find_package(taocpp-json REQUIRED) +else() + set(LATEST_COUCHBASE_CXX_CLIENT 1.0.4) + + include(cmake/CPM.cmake) + + cpmaddpackage( + NAME + couchbase_cxx_client + GIT_TAG + ${LATEST_COUCHBASE_CXX_CLIENT} + VERSION + ${LATEST_COUCHBASE_CXX_CLIENT} + GITHUB_REPOSITORY + "couchbase/couchbase-cxx-client" + OPTIONS + "COUCHBASE_CXX_CLIENT_STATIC_BORINGSSL ON") +endif() add_subdirectory(examples) diff --git a/README.md b/README.md index 7a4c2bc..f940406 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ Demo applications for Couchbase C++ SDK. More info at https://github.com/couchbase/couchbase-cxx-client. ```bash -mkdir -p build cmake -S . -B build cmake --build build ``` diff --git a/examples/ledger_with_csv_encoding.cpp b/examples/ledger_with_csv_encoding.cpp index f109522..4aeeb56 100644 --- a/examples/ledger_with_csv_encoding.cpp +++ b/examples/ledger_with_csv_encoding.cpp @@ -43,6 +43,14 @@ class byte_appender { } + constexpr byte_appender(const byte_appender&) = default; + byte_appender(byte_appender&&) = default; + auto operator=(const byte_appender& other) -> byte_appender& + { + output_ = other.output_; + return *this; + } + auto operator=(char ch) -> byte_appender& { output_.push_back(static_cast(ch)); diff --git a/examples/minimal.cpp b/examples/minimal.cpp index 4756437..89986a1 100644 --- a/examples/minimal.cpp +++ b/examples/minimal.cpp @@ -1,4 +1,5 @@ #include +#include #include #include diff --git a/examples/minimal_query.cpp b/examples/minimal_query.cpp index 63aec58..db865a4 100644 --- a/examples/minimal_query.cpp +++ b/examples/minimal_query.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -98,7 +99,7 @@ main() } std::cout << "--- Iterating as JSON objects:\n"; - for (auto row : resp.rows_as_json()) { + for (auto row : resp.rows_as()) { std::cout << "Airline(id: " << row["airline"]["id"] << ", name: \"" << row["airline"]["name"] << "\")\n"; } diff --git a/examples/transactions_transfer_basic.cpp b/examples/transactions_transfer_basic.cpp index 6730c94..aed2fc7 100644 --- a/examples/transactions_transfer_basic.cpp +++ b/examples/transactions_transfer_basic.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/examples/transactions_transfer_read_replica.cpp b/examples/transactions_transfer_read_replica.cpp index 60c221f..b901300 100644 --- a/examples/transactions_transfer_read_replica.cpp +++ b/examples/transactions_transfer_read_replica.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include