olp-cpp-sdk  1.21.0
Static Public Member Functions | List of all members
olp::http::NetworkUtils Class Reference

Network internal utilities. More...

#include <NetworkUtils.h>

Static Public Member Functions

static char SimpleToUpper (char c)
 Changes the specified character to uppercase. More...
 
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. More...
 
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. More...
 
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. More...
 
static std::string ExtractUserAgent (Headers &headers)
 Extracts the user agent from the headers. More...
 

Detailed Description

Network internal utilities.

Member Function Documentation

◆ CaseInsensitiveCompare()

static bool olp::http::NetworkUtils::CaseInsensitiveCompare ( const std::string &  str1,
const std::string &  str2,
size_t  offset = 0 
)
static

Checks whether the source string matches the specified string disregarding the case.

Parameters
str1The source string.
str2The string to which the source string is compared.
offsetThe offset for the source string from which the comparison should start. Defaults to 0.
Returns
True if the source string matches the specified string; false otherwise.

◆ CaseInsensitiveFind()

static size_t olp::http::NetworkUtils::CaseInsensitiveFind ( const std::string &  str1,
const std::string &  str2,
size_t  offset = 0 
)
static

Checks whether the source string contains characters of the specified string ignoring the case.

Parameters
str1The source string.
str2The string to which the source string is compared.
offsetThe offset for the source string from which the comparison should start. Defaults to 0.
Returns
True if the source string contains characters of the specified string ignoring the case; false otherwise.

◆ CaseInsensitiveStartsWith()

static bool olp::http::NetworkUtils::CaseInsensitiveStartsWith ( const std::string &  str1,
const std::string &  str2,
size_t  offset = 0 
)
static

Checks whether the source string begins with the characters of the specified string ignoring the case.

Parameters
str1The source string.
str2The string to which the source string is compared.
offsetThe offset for the source string from which the comparison should start. Defaults to 0.
Returns
True if the source string starts with the specified value; false otherwise.

◆ ExtractUserAgent()

static std::string olp::http::NetworkUtils::ExtractUserAgent ( Headers headers)
static

Extracts the user agent from the headers.

The user agent is removed from the headers.

Parameters
headersThe input headers.
Returns
The user agent or an empty string if there is no user agent.

◆ SimpleToUpper()

static char olp::http::NetworkUtils::SimpleToUpper ( char  c)
static

Changes the specified character to uppercase.

If the character is already uppercase or non-alphabetical, it is not changed.

Parameters
cThe character that should be changed.
Returns
The uppercase character.

The documentation for this class was generated from the following file: