C++11 compatible
This commit is contained in:
@ -2,6 +2,17 @@
|
||||
# Author: Benjamin Sergeant
|
||||
# Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
|
||||
#
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
check_c_source_compiles("#include <regex>
|
||||
int main()
|
||||
{
|
||||
const std::regex dsnRegex;
|
||||
std::smatch group;
|
||||
std::regex_match(std::string(), group, dsnRegex);
|
||||
return 0;
|
||||
}"
|
||||
HAVE_STD_REGEX)
|
||||
|
||||
set (IXSENTRY_SOURCES
|
||||
ixsentry/IXSentryClient.cpp
|
||||
@ -28,3 +39,7 @@ set(IXSENTRY_INCLUDE_DIRS
|
||||
${JSONCPP_INCLUDE_DIRS})
|
||||
|
||||
target_include_directories( ixsentry PUBLIC ${IXSENTRY_INCLUDE_DIRS} )
|
||||
|
||||
if (HAVE_STD_REGEX)
|
||||
target_compile_definitions( ixsentry PUBLIC HAVE_STD_REGEX=1 )
|
||||
endif()
|
||||
|
@ -20,9 +20,12 @@ namespace ix
|
||||
SentryClient::SentryClient(const std::string& dsn)
|
||||
: _dsn(dsn)
|
||||
, _validDsn(false)
|
||||
#ifdef HAVE_STD_REGEX
|
||||
, _luaFrameRegex("\t([^/]+):([0-9]+): in function ['<]([^/]+)['>]")
|
||||
#endif
|
||||
, _httpClient(std::make_shared<HttpClient>(true))
|
||||
{
|
||||
#ifdef HAVE_STD_REGEX
|
||||
const std::regex dsnRegex("(http[s]?)://([^:]+):([^@]+)@([^/]+)/([0-9]+)");
|
||||
std::smatch group;
|
||||
|
||||
@ -38,6 +41,7 @@ namespace ix
|
||||
_publicKey = group.str(2);
|
||||
_secretKey = group.str(3);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SentryClient::setTLSOptions(const SocketTLSOptions& tlsOptions)
|
||||
@ -77,6 +81,7 @@ namespace ix
|
||||
{
|
||||
Json::Value frames;
|
||||
|
||||
#ifdef HAVE_STD_REGEX
|
||||
// Split by lines
|
||||
std::string line;
|
||||
std::stringstream tokenStream(stack);
|
||||
@ -107,6 +112,7 @@ namespace ix
|
||||
}
|
||||
|
||||
std::reverse(frames.begin(), frames.end());
|
||||
#endif
|
||||
|
||||
return frames;
|
||||
}
|
||||
|
@ -11,7 +11,9 @@
|
||||
#include <ixwebsocket/IXSocketTLSOptions.h>
|
||||
#include <json/json.h>
|
||||
#include <memory>
|
||||
#ifdef HAVE_STD_REGEX
|
||||
#include <regex>
|
||||
#endif
|
||||
|
||||
namespace ix
|
||||
{
|
||||
@ -62,7 +64,9 @@ namespace ix
|
||||
|
||||
Json::FastWriter _jsonWriter;
|
||||
|
||||
#ifdef HAVE_STD_REGEX
|
||||
std::regex _luaFrameRegex;
|
||||
#endif
|
||||
|
||||
std::shared_ptr<HttpClient> _httpClient;
|
||||
};
|
||||
|
Reference in New Issue
Block a user