olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
NetworkUtils.h
1/*
2 * Copyright (C) 2019-2020 HERE Europe B.V.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 * License-Filename: LICENSE
18 */
19
20#pragma once
21
22#include <string>
23
24#include <olp/core/http/NetworkTypes.h>
25
26namespace olp {
27namespace http {
31class CORE_API NetworkUtils {
32 public:
43 static char SimpleToUpper(char c);
56 static bool CaseInsensitiveCompare(const std::string& str1,
57 const std::string& str2,
58 size_t offset = 0);
71 static bool CaseInsensitiveStartsWith(const std::string& str1,
72 const std::string& str2,
73 size_t offset = 0);
86 static size_t CaseInsensitiveFind(const std::string& str1,
87 const std::string& str2, size_t offset = 0);
88
98 static std::string ExtractUserAgent(Headers& headers);
99}; // The `NetworkUtils` class.
100
108CORE_API std::string HttpErrorToString(int http_status);
109
110} // namespace http
111} // namespace olp
Network internal utilities.
Definition NetworkUtils.h:31
static bool CaseInsensitiveCompare(const std::string &str1, const std::string &str2, size_t offset=0)
Checks whether the source string matches the specified string disregarding the case.
static char SimpleToUpper(char c)
Changes the specified character to uppercase.
static bool CaseInsensitiveStartsWith(const std::string &str1, const std::string &str2, size_t offset=0)
Checks whether the source string begins with the characters of the specified string ignoring the case...
static size_t CaseInsensitiveFind(const std::string &str1, const std::string &str2, size_t offset=0)
Checks whether the source string contains characters of the specified string ignoring the case.
static std::string ExtractUserAgent(Headers &headers)
Extracts the user agent from the headers.
CORE_API std::string HttpErrorToString(int http_status)
Converts the HTTP error status code to string.
std::vector< Header > Headers
An alias for a vector of the HTTP headers.
Definition NetworkTypes.h:140
Rules all the other namespaces.
Definition AppleSignInProperties.h:24