Skip to content

Commit 49b746f

Browse files
committed
Update to the latest oatpp API.
1 parent 25f7eb5 commit 49b746f

35 files changed

+51
-164
lines changed

async-server-rooms/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ add_library(${project_name}-lib
2121

2222
## link libs
2323

24-
find_package(oatpp 1.0.0 REQUIRED)
25-
find_package(oatpp-websocket 1.0.0 REQUIRED)
24+
find_package(oatpp 1.1.0 REQUIRED)
25+
find_package(oatpp-websocket 1.1.0 REQUIRED)
2626

2727
target_link_libraries(${project_name}-lib
2828
PUBLIC oatpp::oatpp

async-server-rooms/src/controller/RoomsController.hpp

+5-10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#include "oatpp/core/macro/codegen.hpp"
1212
#include "oatpp/core/macro/component.hpp"
1313

14+
15+
#include OATPP_CODEGEN_BEGIN(ApiController) //<-- codegen begin
16+
1417
/**
1518
* Controller with WebSocket-connect endpoint.
1619
*/
@@ -25,11 +28,6 @@ class RoomsController : public oatpp::web::server::api::ApiController {
2528
{}
2629
public:
2730

28-
/**
29-
* Begin ENDPOINTs generation ('ApiController' codegen)
30-
*/
31-
#include OATPP_CODEGEN_BEGIN(ApiController)
32-
3331
ENDPOINT_ASYNC("GET", "/", Root) {
3432

3533
ENDPOINT_ASYNC_INIT(Root)
@@ -82,11 +80,8 @@ class RoomsController : public oatpp::web::server::api::ApiController {
8280

8381
// TODO Insert Your endpoints here !!!
8482

85-
/**
86-
* Finish ENDPOINTs generation ('ApiController' codegen)
87-
*/
88-
#include OATPP_CODEGEN_END(ApiController)
89-
9083
};
9184

85+
#include OATPP_CODEGEN_END(ApiController) //<-- codegen end
86+
9287
#endif /* RoomsController_hpp */

async-server-rooms/test/WSTest.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-03-25.
3-
//
41

52
#ifndef MY_PROJECT_WEBSOCKETTEST_HPP
63
#define MY_PROJECT_WEBSOCKETTEST_HPP

async-server/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ add_library(${project_name}-lib
1717

1818
## link libs
1919

20-
find_package(oatpp 1.0.0 REQUIRED)
21-
find_package(oatpp-websocket 1.0.0 REQUIRED)
20+
find_package(oatpp 1.1.0 REQUIRED)
21+
find_package(oatpp-websocket 1.1.0 REQUIRED)
2222

2323
target_link_libraries(${project_name}-lib
2424
PUBLIC oatpp::oatpp

async-server/src/controller/MyController.hpp

+5-18
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// MyController.hpp
3-
// web-starter-project
4-
//
5-
// Created by Leonid on 2/12/18.
6-
// Copyright © 2018 oatpp. All rights reserved.
7-
//
81

92
#ifndef MyController_hpp
103
#define MyController_hpp
@@ -18,6 +11,8 @@
1811
#include "oatpp/core/macro/codegen.hpp"
1912
#include "oatpp/core/macro/component.hpp"
2013

14+
#include OATPP_CODEGEN_BEGIN(ApiController) //<-- codegen begin
15+
2116
/**
2217
* Controller with WebSocket-connect endpoint.
2318
*/
@@ -32,11 +27,6 @@ class MyController : public oatpp::web::server::api::ApiController {
3227
{}
3328
public:
3429

35-
/**
36-
* Begin ENDPOINTs generation ('ApiController' codegen)
37-
*/
38-
#include OATPP_CODEGEN_BEGIN(ApiController)
39-
4030
ENDPOINT_ASYNC("GET", "/", Root) {
4131

4232
ENDPOINT_ASYNC_INIT(Root)
@@ -72,12 +62,9 @@ class MyController : public oatpp::web::server::api::ApiController {
7262
};
7363

7464
// TODO Insert Your endpoints here !!!
75-
76-
/**
77-
* Finish ENDPOINTs generation ('ApiController' codegen)
78-
*/
79-
#include OATPP_CODEGEN_END(ApiController)
80-
65+
8166
};
8267

68+
#include OATPP_CODEGEN_END(ApiController) //<-- codegen end
69+
8370
#endif /* MyController_hpp */

async-server/src/websocket/WSListener.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-07.
3-
//
41

52
#include "WSListener.hpp"
63

async-server/src/websocket/WSListener.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-07.
3-
//
41

52
#ifndef WSListener_hpp
63
#define WSListener_hpp

async-server/test/WSTest.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-03-25.
3-
//
41

52
#include "WSTest.hpp"
63

async-server/test/WSTest.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-03-25.
3-
//
41

52
#ifndef MY_PROJECT_WEBSOCKETTEST_HPP
63
#define MY_PROJECT_WEBSOCKETTEST_HPP

client-binance.com/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake/module") # <--
2525

2626
find_package(mbedtls 2.16.0 REQUIRED)
2727

28-
find_package(oatpp 1.0.0 REQUIRED)
29-
find_package(oatpp-websocket 1.0.0 REQUIRED)
30-
find_package(oatpp-mbedtls 1.0.0 REQUIRED)
28+
find_package(oatpp 1.1.0 REQUIRED)
29+
find_package(oatpp-websocket 1.1.0 REQUIRED)
30+
find_package(oatpp-mbedtls 1.1.0 REQUIRED)
3131

3232
target_link_libraries(${project_name}-lib
3333
PUBLIC oatpp::oatpp

client-binance.com/src/AggregateTradesListener.hpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-12.
3-
//
41

52
#ifndef AggregateTradesListener_hpp
63
#define AggregateTradesListener_hpp
@@ -21,12 +18,12 @@ class AggregateTradesListener : public WSEventListener<AggregateTrade> {
2118
void onEvent(const AggregateTrade::ObjectWrapper& trade) override {
2219

2320
OATPP_LOGI("AggregateTrades", "%s - quantity=%s, price=%s, time=%d / firstTradeId=%d, lastTradeId=%d",
24-
trade->symbol->getData(),
25-
trade->quantity->getData(),
26-
trade->price->getData(),
27-
trade->tradeTime->getValue(),
28-
trade->firstTradeId->getValue(),
29-
trade->lastTradeId->getValue()
21+
trade->symbol->c_str(),
22+
trade->quantity->c_str(),
23+
trade->price->c_str(),
24+
*trade->tradeTime,
25+
*trade->firstTradeId,
26+
*trade->lastTradeId
3027
);
3128

3229
}

client-binance.com/src/KlineCandlestickListener.hpp

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-12.
3-
//
4-
51
#ifndef KlineCandlestickListener_hpp
62
#define KlineCandlestickListener_hpp
73

@@ -21,13 +17,13 @@ class KlineCandlestickListener : public WSEventListener<Candlestick> {
2117
void onEvent(const Candlestick::ObjectWrapper& obj) override {
2218

2319
OATPP_LOGI("Kline/Candlesticks", "%s - startTime=%d, closeTime=%d / openPrice=%s, closePrice=%s, highPrice=%s, lowPrice=%s",
24-
obj->symbol->getData(),
25-
obj->kline->klineStartTime->getValue(),
26-
obj->kline->klineCloseTime->getValue(),
27-
obj->kline->openPrice->getData(),
28-
obj->kline->closePrice->getData(),
29-
obj->kline->highPrice->getData(),
30-
obj->kline->lowPrice->getData()
20+
obj->symbol->c_str(),
21+
*obj->kline->klineStartTime,
22+
*obj->kline->klineCloseTime,
23+
obj->kline->openPrice->c_str(),
24+
obj->kline->closePrice->c_str(),
25+
obj->kline->highPrice->c_str(),
26+
obj->kline->lowPrice->c_str()
3127
);
3228

3329
}

client-binance.com/src/Model.hpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
//
2-
// Created by Leonid on 2019-06-12.
3-
//
41

52
#ifndef Model_hpp
63
#define Model_hpp
74

8-
#include "oatpp/core/data/mapping/type/Object.hpp"
5+
#include "oatpp/core/Types.hpp"
96
#include "oatpp/core/macro/codegen.hpp"
107

118
#include OATPP_CODEGEN_BEGIN(DTO)
@@ -14,7 +11,7 @@
1411
* DTO representing "Aggregate Trade Stream" object from binance-exchange.
1512
* See https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md#aggregate-trade-streams
1613
*/
17-
class AggregateTrade : public oatpp::data::mapping::type::Object {
14+
class AggregateTrade : public oatpp::Object {
1815

1916
DTO_INIT(AggregateTrade, Object)
2017

@@ -36,7 +33,7 @@ class AggregateTrade : public oatpp::data::mapping::type::Object {
3633
* DTO representing "Trade Stream" object from binance-exchange.
3734
* See https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md#trade-streams
3835
*/
39-
class Trade : public oatpp::data::mapping::type::Object {
36+
class Trade : public oatpp::Object {
4037

4138
DTO_INIT(Trade, Object)
4239

@@ -57,7 +54,7 @@ class Trade : public oatpp::data::mapping::type::Object {
5754
/**
5855
* Nested object for Candlestick
5956
*/
60-
class Kline : public oatpp::data::mapping::type::Object {
57+
class Kline : public oatpp::Object {
6158

6259
DTO_INIT(Kline, Object)
6360

@@ -89,7 +86,7 @@ class Kline : public oatpp::data::mapping::type::Object {
8986
* DTO representing "Kline/Candlestick Stream" object from binance-exchange.
9087
* See https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md#klinecandlestick-streams
9188
*/
92-
class Candlestick : public oatpp::data::mapping::type::Object {
89+
class Candlestick : public oatpp::Object {
9390

9491
DTO_INIT(Candlestick, Object)
9592

client-binance.com/src/TradesListener.hpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-12.
3-
//
41

52
#ifndef TradesListener_hpp
63
#define TradesListener_hpp
@@ -21,10 +18,10 @@ class TradesListener : public WSEventListener<Trade> {
2118
void onEvent(const Trade::ObjectWrapper& trade) override {
2219

2320
OATPP_LOGI("Trades", "%s - quantity=%s, price=%s, time=%d",
24-
trade->symbol->getData(),
25-
trade->quantity->getData(),
26-
trade->price->getData(),
27-
trade->tradeTime->getValue()
21+
trade->symbol->c_str(),
22+
trade->quantity->c_str(),
23+
trade->price->c_str(),
24+
*trade->tradeTime
2825
);
2926

3027
}

client-binance.com/src/WSEventListener.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-12.
3-
//
41

52
#ifndef WSEventListener_hpp
63
#define WSEventListener_hpp

client-binance.com/src/WSListener.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-07.
3-
//
41

52
#include "WSListener.hpp"
63

client-binance.com/src/WSListener.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-07.
3-
//
41

52
#ifndef WSListener_hpp
63
#define WSListener_hpp

client-binance.com/test/WSTest.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-03-25.
3-
//
41

52
#include "WSTest.hpp"
63

client-binance.com/test/WSTest.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-03-25.
3-
//
41

52
#ifndef MY_PROJECT_WEBSOCKETTEST_HPP
63
#define MY_PROJECT_WEBSOCKETTEST_HPP

client-mbedtls/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake/module") # <--
2020

2121
find_package(mbedtls 2.16.0 REQUIRED)
2222

23-
find_package(oatpp 1.0.0 REQUIRED)
24-
find_package(oatpp-websocket 1.0.0 REQUIRED)
25-
find_package(oatpp-mbedtls 1.0.0 REQUIRED)
23+
find_package(oatpp 1.1.0 REQUIRED)
24+
find_package(oatpp-websocket 1.1.0 REQUIRED)
25+
find_package(oatpp-mbedtls 1.1.0 REQUIRED)
2626

2727
target_link_libraries(${project_name}-lib
2828
PUBLIC oatpp::oatpp

client-mbedtls/src/WSListener.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-07.
3-
//
41

52
#include "WSListener.hpp"
63

client-mbedtls/src/WSListener.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-07.
3-
//
41

52
#ifndef WSListener_hpp
63
#define WSListener_hpp

client-mbedtls/test/WSTest.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-03-25.
3-
//
41

52
#include "WSTest.hpp"
63

client-mbedtls/test/WSTest.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-03-25.
3-
//
41

52
#ifndef MY_PROJECT_WEBSOCKETTEST_HPP
63
#define MY_PROJECT_WEBSOCKETTEST_HPP

client/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ add_library(${project_name}-lib
1515

1616
## link libs
1717

18-
find_package(oatpp 1.0.0 REQUIRED)
19-
find_package(oatpp-websocket 1.0.0 REQUIRED)
18+
find_package(oatpp 1.1.0 REQUIRED)
19+
find_package(oatpp-websocket 1.1.0 REQUIRED)
2020

2121
target_link_libraries(${project_name}-lib
2222
PUBLIC oatpp::oatpp

client/src/WSListener.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-07.
3-
//
41

52
#include "WSListener.hpp"
63

client/src/WSListener.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-06-07.
3-
//
41

52
#ifndef WSListener_hpp
63
#define WSListener_hpp

client/test/WSTest.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-03-25.
3-
//
41

52
#include "WSTest.hpp"
63

client/test/WSTest.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//
2-
// Created by Leonid on 2019-03-25.
3-
//
41

52
#ifndef MY_PROJECT_WEBSOCKETTEST_HPP
63
#define MY_PROJECT_WEBSOCKETTEST_HPP

0 commit comments

Comments
 (0)