Skip to content

Commit ba2156c

Browse files
authored
Use std::optional if available. (#1628)
Currently, SDK requires C++11 minimum. So, boost::optional type is used for optional values. For C++17 and above more convenient is to use std::optional instead. The task NLAM-23 is about making this type configurable. This commit is a renaming of the initially proposed "optional.hpp" into optional.h to avoid clang-format header sorting issue. Relates-To: NLAM-23 Signed-off-by: sopov <[email protected]>
1 parent 25a4a6b commit ba2156c

40 files changed

+71
-76
lines changed

olp-cpp-sdk-authentication/include/olp/authentication/AuthenticationClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <olp/authentication/Types.h>
3737
#include <olp/core/client/ApiResponse.h>
3838
#include <olp/core/client/CancellationToken.h>
39-
#include <olp/core/porting/optional.hpp>
39+
#include <olp/core/porting/optional.h>
4040

4141
/**
4242
* @brief Rules all the other namespaces.

olp-cpp-sdk-authentication/include/olp/authentication/AuthenticationCredentials.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include <string>
2323

24-
#include <olp/core/porting/optional.hpp>
24+
#include <olp/core/porting/optional.h>
2525
#include "AuthenticationApi.h"
2626

2727
namespace olp {

olp-cpp-sdk-authentication/include/olp/authentication/AuthenticationSettings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <olp/authentication/AuthenticationApi.h>
2626
#include <olp/core/client/RetrySettings.h>
2727
#include <olp/core/http/NetworkProxySettings.h>
28-
#include <olp/core/porting/optional.hpp>
28+
#include <olp/core/porting/optional.h>
2929

3030
namespace olp {
3131
namespace http {

olp-cpp-sdk-authentication/include/olp/authentication/AuthorizeRequest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <vector>
2424

2525
#include <olp/authentication/AuthenticationApi.h>
26-
#include <olp/core/porting/optional.hpp>
26+
#include <olp/core/porting/optional.h>
2727

2828
namespace olp {
2929
namespace authentication {

olp-cpp-sdk-authentication/include/olp/authentication/Settings.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424

2525
#include <olp/core/client/RetrySettings.h>
2626
#include <olp/core/http/NetworkProxySettings.h>
27-
#include <olp/core/porting/optional.hpp>
28-
27+
#include <olp/core/porting/optional.h>
2928
#include "AuthenticationApi.h"
3029
#include "AuthenticationCredentials.h"
3130

olp-cpp-sdk-authentication/include/olp/authentication/TokenResult.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <ctime>
2424
#include <string>
2525

26-
#include <olp/core/porting/optional.hpp>
26+
#include <olp/core/porting/optional.h>
2727
#include "AuthenticationApi.h"
2828
#include "ErrorResponse.h"
2929

olp-cpp-sdk-authentication/src/TokenEndpointImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <olp/authentication/Types.h>
3030
#include <olp/core/client/CancellationContext.h>
3131
#include <olp/core/client/OlpClient.h>
32-
#include <olp/core/porting/optional.hpp>
32+
#include <olp/core/porting/optional.h>
3333
#include "TokenRequest.h"
3434

3535
namespace olp {

olp-cpp-sdk-core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ set(OLP_SDK_PORTING_HEADERS
131131
./include/olp/core/porting/deprecated.h
132132
./include/olp/core/porting/export.h
133133
./include/olp/core/porting/make_unique.h
134-
./include/olp/core/porting/optional.hpp
134+
./include/olp/core/porting/optional.h
135135
./include/olp/core/porting/platform.h
136136
./include/olp/core/porting/shared_mutex.h
137137
./include/olp/core/porting/try_emplace.h

olp-cpp-sdk-core/include/olp/core/cache/CacheSettings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include <olp/core/Config.h>
2626
#include <olp/core/CoreApi.h>
27-
#include <olp/core/porting/optional.hpp>
27+
#include <olp/core/porting/optional.h>
2828

2929
namespace olp {
3030
namespace cache {

olp-cpp-sdk-core/include/olp/core/cache/KeyGenerator.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include <olp/core/CoreApi.h>
2525
#include <olp/core/geo/tiling/TileKey.h>
26-
#include <olp/core/porting/optional.hpp>
26+
#include <olp/core/porting/optional.h>
2727

2828
namespace olp {
2929
namespace cache {
@@ -76,7 +76,8 @@ class CORE_API KeyGenerator {
7676
*/
7777
static std::string CreatePartitionKey(
7878
const std::string& hrn, const std::string& layer_id,
79-
const std::string& partition_id, const porting::optional<int64_t>& version);
79+
const std::string& partition_id,
80+
const porting::optional<int64_t>& version);
8081

8182
/**
8283
* @brief Generates cache key for storing list of partitions.
@@ -113,11 +114,10 @@ class CORE_API KeyGenerator {
113114
*
114115
* @return A key used to store the quadtree in cache.
115116
*/
116-
static std::string CreateQuadTreeKey(const std::string& hrn,
117-
const std::string& layer_id,
118-
olp::geo::TileKey root,
119-
const porting::optional<int64_t>& version,
120-
int32_t depth);
117+
static std::string CreateQuadTreeKey(
118+
const std::string& hrn, const std::string& layer_id,
119+
olp::geo::TileKey root, const porting::optional<int64_t>& version,
120+
int32_t depth);
121121

122122
/**
123123
* @brief Generates cache key for data handle entities.

0 commit comments

Comments
 (0)