cleanup: Remove dependency on quickfix for string to_lower
We shouldn't depend on external libs for trivial things like converting strings to lower case.
This commit is contained in:
1 parent
70fae06a30
commit
bb25eab078
2 files changed
+24
-4
No files matched your search
@@ -21,7 +21,9 @@
|
||||
#include "lib/orderman/orderman_utils/orderman_common.h"
|
||||
#include "lib/utils/Uuid.h"
|
||||
#include "lib/utils/bts_assert.h"
|
||||
#include "lib/utils/string_utils.h"
|
||||
#include "lib/utils/thread_manager.h"
|
||||
|
||||
#include <OnixS/FIXEngine/FIX/Exception.h>
|
||||
#include <OnixS/FIXEngine/FIX/FIX42.h>
|
||||
#include <OnixS/FIXEngine/FIX/Message.h>
|
||||
@@ -40,8 +42,6 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <optional>
|
||||
#include <quickfix/FixFields.h>
|
||||
#include <quickfix/Utility.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include <unordered_map>
|
||||
@@ -50,6 +50,8 @@ using json = nlohmann::json;
|
||||
|
||||
namespace bts::orderman {
|
||||
|
||||
using bts::system::string_utils::copy_to_lower;
|
||||
|
||||
OkxExecutionGateway::OkxExecutionGateway(md::SecurityOracle o)
|
||||
: me_(std::make_unique<PImpl>(o)) {
|
||||
LOG(OrderMan, Info, "OkxExecutionAdapter::constructor ");
|
||||
@@ -777,8 +779,8 @@ void OkxExecutionGateway::launch_new_order(const CreateOrderMsg &msg) {
|
||||
order_type = "fok";
|
||||
break;
|
||||
default:
|
||||
order_type =
|
||||
FIX::string_toLower(ord_full_name.substr(pos + suffix.size()));
|
||||
order_type = copy_to_lower(ord_full_name.substr(pos + suffix.size()));
|
||||
break;
|
||||
}
|
||||
const std::string ord_type = order_type;
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ bool parse_uint(Iter first, Iter last, UIntType &i);
|
||||
template <class UIntType>
|
||||
bool parse_uint(const std::string &s, UIntType &i);
|
||||
|
||||
void to_lower(std::string &str);
|
||||
std::string copy_to_lower(const std::string &str);
|
||||
|
||||
void to_upper(std::string &str);
|
||||
std::string copy_to_upper(const std::string &str);
|
||||
|
||||
@@ -63,6 +66,21 @@ inline bool parse_uint(Iter first, Iter last, UIntType &i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void to_lower(std::string &str) {
|
||||
for (char &c : str) {
|
||||
c = tolower(c);
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string copy_to_lower(const std::string &str) {
|
||||
std::string s;
|
||||
s.reserve(str.size());
|
||||
for (char c : str) {
|
||||
s.push_back(tolower(c));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
inline void to_upper(std::string &str) {
|
||||
for (char &c : str) {
|
||||
c = toupper(c);
|
||||
|
||||
Reference in new issue
Block a user