Skip to content

Commit 5d259b9

Browse files
authored
Extract constants header (#56)
1 parent b875098 commit 5d259b9

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.0)
22

3-
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/countly.hpp COUNTLY_HPP_CONTENTS)
3+
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/countly/constants.hpp COUNTLY_HPP_CONTENTS)
44
string(REGEX MATCH "#define COUNTLY_SDK_VERSION \"[^\"]+\"" COUNTLY_SDK_VERSION ${COUNTLY_HPP_CONTENTS})
55
string(REGEX REPLACE "#define COUNTLY_SDK_VERSION \"([^\"]+)\"" "\\1" COUNTLY_SDK_VERSION ${COUNTLY_SDK_VERSION})
66

include/countly.hpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef COUNTLY_HPP_
22
#define COUNTLY_HPP_
33

4+
#include "countly/constants.hpp"
5+
46
#include <iterator>
57
#include <chrono>
68
#include <string>
@@ -19,13 +21,6 @@ using json = nlohmann::json;
1921
#undef ERROR
2022
#endif
2123

22-
#define COUNTLY_SDK_NAME "cpp-native-unknown"
23-
#define COUNTLY_SDK_VERSION "0.1.0"
24-
#define COUNTLY_API_VERSION "21.11.2"
25-
#define COUNTLY_POST_THRESHOLD 2000
26-
#define COUNTLY_KEEPALIVE_INTERVAL 3000
27-
#define COUNTLY_MAX_EVENTS_DEFAULT 200
28-
2924
class Countly {
3025
public:
3126
Countly();

include/countly/constants.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef COUNTLY_CONSTANTS_HPP_
2+
#define COUNTLY_CONSTANTS_HPP_
3+
4+
#define COUNTLY_SDK_NAME "cpp-native-unknown"
5+
#define COUNTLY_SDK_VERSION "0.1.0"
6+
#define COUNTLY_API_VERSION "21.11.2"
7+
#define COUNTLY_POST_THRESHOLD 2000
8+
#define COUNTLY_KEEPALIVE_INTERVAL 3000
9+
#define COUNTLY_MAX_EVENTS_DEFAULT 200
10+
11+
#endif

0 commit comments

Comments
 (0)