Skip to content

Commit

Permalink
Update to the latest oatpp API.
Browse files Browse the repository at this point in the history
  • Loading branch information
lganzzzo committed May 17, 2020
1 parent 25f7eb5 commit 49b746f
Show file tree
Hide file tree
Showing 35 changed files with 51 additions and 164 deletions.
4 changes: 2 additions & 2 deletions async-server-rooms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ add_library(${project_name}-lib

## link libs

find_package(oatpp 1.0.0 REQUIRED)
find_package(oatpp-websocket 1.0.0 REQUIRED)
find_package(oatpp 1.1.0 REQUIRED)
find_package(oatpp-websocket 1.1.0 REQUIRED)

target_link_libraries(${project_name}-lib
PUBLIC oatpp::oatpp
Expand Down
15 changes: 5 additions & 10 deletions async-server-rooms/src/controller/RoomsController.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include "oatpp/core/macro/codegen.hpp"
#include "oatpp/core/macro/component.hpp"


#include OATPP_CODEGEN_BEGIN(ApiController) //<-- codegen begin

/**
* Controller with WebSocket-connect endpoint.
*/
Expand All @@ -25,11 +28,6 @@ class RoomsController : public oatpp::web::server::api::ApiController {
{}
public:

/**
* Begin ENDPOINTs generation ('ApiController' codegen)
*/
#include OATPP_CODEGEN_BEGIN(ApiController)

ENDPOINT_ASYNC("GET", "/", Root) {

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

// TODO Insert Your endpoints here !!!

/**
* Finish ENDPOINTs generation ('ApiController' codegen)
*/
#include OATPP_CODEGEN_END(ApiController)

};

#include OATPP_CODEGEN_END(ApiController) //<-- codegen end

#endif /* RoomsController_hpp */
3 changes: 0 additions & 3 deletions async-server-rooms/test/WSTest.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-03-25.
//

#ifndef MY_PROJECT_WEBSOCKETTEST_HPP
#define MY_PROJECT_WEBSOCKETTEST_HPP
Expand Down
4 changes: 2 additions & 2 deletions async-server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ add_library(${project_name}-lib

## link libs

find_package(oatpp 1.0.0 REQUIRED)
find_package(oatpp-websocket 1.0.0 REQUIRED)
find_package(oatpp 1.1.0 REQUIRED)
find_package(oatpp-websocket 1.1.0 REQUIRED)

target_link_libraries(${project_name}-lib
PUBLIC oatpp::oatpp
Expand Down
23 changes: 5 additions & 18 deletions async-server/src/controller/MyController.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// MyController.hpp
// web-starter-project
//
// Created by Leonid on 2/12/18.
// Copyright © 2018 oatpp. All rights reserved.
//

#ifndef MyController_hpp
#define MyController_hpp
Expand All @@ -18,6 +11,8 @@
#include "oatpp/core/macro/codegen.hpp"
#include "oatpp/core/macro/component.hpp"

#include OATPP_CODEGEN_BEGIN(ApiController) //<-- codegen begin

/**
* Controller with WebSocket-connect endpoint.
*/
Expand All @@ -32,11 +27,6 @@ class MyController : public oatpp::web::server::api::ApiController {
{}
public:

/**
* Begin ENDPOINTs generation ('ApiController' codegen)
*/
#include OATPP_CODEGEN_BEGIN(ApiController)

ENDPOINT_ASYNC("GET", "/", Root) {

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

// TODO Insert Your endpoints here !!!

/**
* Finish ENDPOINTs generation ('ApiController' codegen)
*/
#include OATPP_CODEGEN_END(ApiController)


};

#include OATPP_CODEGEN_END(ApiController) //<-- codegen end

#endif /* MyController_hpp */
3 changes: 0 additions & 3 deletions async-server/src/websocket/WSListener.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-07.
//

#include "WSListener.hpp"

Expand Down
3 changes: 0 additions & 3 deletions async-server/src/websocket/WSListener.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-07.
//

#ifndef WSListener_hpp
#define WSListener_hpp
Expand Down
3 changes: 0 additions & 3 deletions async-server/test/WSTest.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-03-25.
//

#include "WSTest.hpp"

Expand Down
3 changes: 0 additions & 3 deletions async-server/test/WSTest.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-03-25.
//

#ifndef MY_PROJECT_WEBSOCKETTEST_HPP
#define MY_PROJECT_WEBSOCKETTEST_HPP
Expand Down
6 changes: 3 additions & 3 deletions client-binance.com/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake/module") # <--

find_package(mbedtls 2.16.0 REQUIRED)

find_package(oatpp 1.0.0 REQUIRED)
find_package(oatpp-websocket 1.0.0 REQUIRED)
find_package(oatpp-mbedtls 1.0.0 REQUIRED)
find_package(oatpp 1.1.0 REQUIRED)
find_package(oatpp-websocket 1.1.0 REQUIRED)
find_package(oatpp-mbedtls 1.1.0 REQUIRED)

target_link_libraries(${project_name}-lib
PUBLIC oatpp::oatpp
Expand Down
15 changes: 6 additions & 9 deletions client-binance.com/src/AggregateTradesListener.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-12.
//

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

OATPP_LOGI("AggregateTrades", "%s - quantity=%s, price=%s, time=%d / firstTradeId=%d, lastTradeId=%d",
trade->symbol->getData(),
trade->quantity->getData(),
trade->price->getData(),
trade->tradeTime->getValue(),
trade->firstTradeId->getValue(),
trade->lastTradeId->getValue()
trade->symbol->c_str(),
trade->quantity->c_str(),
trade->price->c_str(),
*trade->tradeTime,
*trade->firstTradeId,
*trade->lastTradeId
);

}
Expand Down
18 changes: 7 additions & 11 deletions client-binance.com/src/KlineCandlestickListener.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//
// Created by Leonid on 2019-06-12.
//

#ifndef KlineCandlestickListener_hpp
#define KlineCandlestickListener_hpp

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

OATPP_LOGI("Kline/Candlesticks", "%s - startTime=%d, closeTime=%d / openPrice=%s, closePrice=%s, highPrice=%s, lowPrice=%s",
obj->symbol->getData(),
obj->kline->klineStartTime->getValue(),
obj->kline->klineCloseTime->getValue(),
obj->kline->openPrice->getData(),
obj->kline->closePrice->getData(),
obj->kline->highPrice->getData(),
obj->kline->lowPrice->getData()
obj->symbol->c_str(),
*obj->kline->klineStartTime,
*obj->kline->klineCloseTime,
obj->kline->openPrice->c_str(),
obj->kline->closePrice->c_str(),
obj->kline->highPrice->c_str(),
obj->kline->lowPrice->c_str()
);

}
Expand Down
13 changes: 5 additions & 8 deletions client-binance.com/src/Model.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
//
// Created by Leonid on 2019-06-12.
//

#ifndef Model_hpp
#define Model_hpp

#include "oatpp/core/data/mapping/type/Object.hpp"
#include "oatpp/core/Types.hpp"
#include "oatpp/core/macro/codegen.hpp"

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

DTO_INIT(AggregateTrade, Object)

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

DTO_INIT(Trade, Object)

Expand All @@ -57,7 +54,7 @@ class Trade : public oatpp::data::mapping::type::Object {
/**
* Nested object for Candlestick
*/
class Kline : public oatpp::data::mapping::type::Object {
class Kline : public oatpp::Object {

DTO_INIT(Kline, Object)

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

DTO_INIT(Candlestick, Object)

Expand Down
11 changes: 4 additions & 7 deletions client-binance.com/src/TradesListener.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-12.
//

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

OATPP_LOGI("Trades", "%s - quantity=%s, price=%s, time=%d",
trade->symbol->getData(),
trade->quantity->getData(),
trade->price->getData(),
trade->tradeTime->getValue()
trade->symbol->c_str(),
trade->quantity->c_str(),
trade->price->c_str(),
*trade->tradeTime
);

}
Expand Down
3 changes: 0 additions & 3 deletions client-binance.com/src/WSEventListener.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-12.
//

#ifndef WSEventListener_hpp
#define WSEventListener_hpp
Expand Down
3 changes: 0 additions & 3 deletions client-binance.com/src/WSListener.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-07.
//

#include "WSListener.hpp"

Expand Down
3 changes: 0 additions & 3 deletions client-binance.com/src/WSListener.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-07.
//

#ifndef WSListener_hpp
#define WSListener_hpp
Expand Down
3 changes: 0 additions & 3 deletions client-binance.com/test/WSTest.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-03-25.
//

#include "WSTest.hpp"

Expand Down
3 changes: 0 additions & 3 deletions client-binance.com/test/WSTest.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-03-25.
//

#ifndef MY_PROJECT_WEBSOCKETTEST_HPP
#define MY_PROJECT_WEBSOCKETTEST_HPP
Expand Down
6 changes: 3 additions & 3 deletions client-mbedtls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake/module") # <--

find_package(mbedtls 2.16.0 REQUIRED)

find_package(oatpp 1.0.0 REQUIRED)
find_package(oatpp-websocket 1.0.0 REQUIRED)
find_package(oatpp-mbedtls 1.0.0 REQUIRED)
find_package(oatpp 1.1.0 REQUIRED)
find_package(oatpp-websocket 1.1.0 REQUIRED)
find_package(oatpp-mbedtls 1.1.0 REQUIRED)

target_link_libraries(${project_name}-lib
PUBLIC oatpp::oatpp
Expand Down
3 changes: 0 additions & 3 deletions client-mbedtls/src/WSListener.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-07.
//

#include "WSListener.hpp"

Expand Down
3 changes: 0 additions & 3 deletions client-mbedtls/src/WSListener.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-07.
//

#ifndef WSListener_hpp
#define WSListener_hpp
Expand Down
3 changes: 0 additions & 3 deletions client-mbedtls/test/WSTest.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-03-25.
//

#include "WSTest.hpp"

Expand Down
3 changes: 0 additions & 3 deletions client-mbedtls/test/WSTest.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-03-25.
//

#ifndef MY_PROJECT_WEBSOCKETTEST_HPP
#define MY_PROJECT_WEBSOCKETTEST_HPP
Expand Down
4 changes: 2 additions & 2 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ add_library(${project_name}-lib

## link libs

find_package(oatpp 1.0.0 REQUIRED)
find_package(oatpp-websocket 1.0.0 REQUIRED)
find_package(oatpp 1.1.0 REQUIRED)
find_package(oatpp-websocket 1.1.0 REQUIRED)

target_link_libraries(${project_name}-lib
PUBLIC oatpp::oatpp
Expand Down
3 changes: 0 additions & 3 deletions client/src/WSListener.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-07.
//

#include "WSListener.hpp"

Expand Down
3 changes: 0 additions & 3 deletions client/src/WSListener.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-06-07.
//

#ifndef WSListener_hpp
#define WSListener_hpp
Expand Down
3 changes: 0 additions & 3 deletions client/test/WSTest.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-03-25.
//

#include "WSTest.hpp"

Expand Down
3 changes: 0 additions & 3 deletions client/test/WSTest.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//
// Created by Leonid on 2019-03-25.
//

#ifndef MY_PROJECT_WEBSOCKETTEST_HPP
#define MY_PROJECT_WEBSOCKETTEST_HPP
Expand Down
Loading

0 comments on commit 49b746f

Please sign in to comment.