Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Remove std::format pt. 2
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekjaszczak committed Nov 11, 2023
1 parent d13350c commit a495af1
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ jobs:
with:
submodules: false

- name: Install GCC 13, ninja, lcov, dependencies (Poco + GTest)
- name: Install ninja, lcov, dependencies (Poco + GTest)
shell: bash
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt install gcc-13 g++-13 ninja-build lcov libpoco-dev libgtest-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-13
sudo update-alternatives --set gcc /usr/bin/gcc-13
run: sudo apt install ninja-build lcov libpoco-dev libgtest-dev

- name: Configure CMake for Debug build
shell: cmake -P {0}
Expand Down
66 changes: 0 additions & 66 deletions .github/workflows/linux_gcc_13_static_analysis.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/linux_gcc_static_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: linux static analysis

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: false

- name: Install ninja, dependencies (Poco), clang
shell: bash
run: sudo apt install ninja-build libpoco-dev

- name: Configure CMake for static analysis
shell: cmake -P {0}
run: |
execute_process(
COMMAND cmake
-S ${{ github.workspace }}
-B build
-D CMAKE_BUILD_TYPE=Debug
-D CMAKE_CXX_COMPILER=g++
-G Ninja
-D STATIC_ANALYSIS=ON
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Failed to build project")
endif()
- name: Build + run static analysis
shell: bash
run: cmake --build build
3 changes: 2 additions & 1 deletion src/https_websocket_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ auto Https_websocket_client::send_message(std::string_view message) -> bool
{
if (m_websocket)
{
m_websocket->sendFrame(message.data(), static_cast<int>(message.size()), WebSocket::FRAME_TEXT);
m_websocket->sendFrame(
message.data(), static_cast<int>(message.size()), WebSocket::FRAME_TEXT);
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion src/lcu_process_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

namespace rito {

Lcu_process_handler::Lcu_process_handler(std::filesystem::path proc_dir) : m_pimpl{std::make_unique<Lcu_process_handler_impl>(std::move(proc_dir))}
Lcu_process_handler::Lcu_process_handler(std::filesystem::path proc_dir)
: m_pimpl{std::make_unique<Lcu_process_handler_impl>(std::move(proc_dir))}
{
}

Expand Down
15 changes: 9 additions & 6 deletions src/lcu_wamp_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,16 @@ void Lcu_wamp_handler::stop() noexcept

auto Lcu_wamp_handler::subscribe(const std::string& event) noexcept -> bool
{
return m_lcu_websocket_handler.send_message(
std::format("[{}, \"{}\"]", static_cast<int>(Wamp_message_type::subscribe), event));
std::string message{"["s + std::to_string(static_cast<int>(Wamp_message_type::subscribe)) +
", \"" + event + "\""};
return m_lcu_websocket_handler.send_message(message);
}

auto Lcu_wamp_handler::unsubscribe(const std::string& event) noexcept -> bool
{
return m_lcu_websocket_handler.send_message(
std::format("[{}, \"{}\"]", static_cast<int>(Wamp_message_type::unsubscribe), event));
std::string message{"["s + std::to_string(static_cast<int>(Wamp_message_type::unsubscribe)) +
", \"" + event + "\""};
return m_lcu_websocket_handler.send_message(message);
}

void Lcu_wamp_handler::on_connected()
Expand Down Expand Up @@ -197,7 +199,8 @@ void Lcu_wamp_handler::on_call_error(const std::string& identifier,
auto Lcu_wamp_handler::call(const std::string& identifier, const std::string& function) noexcept
-> bool
{
return m_lcu_websocket_handler.send_message(std::format(
R"([{}, "{}", "{}"])", static_cast<int>(Wamp_message_type::call), identifier, function));
std::string message{"["s + std::to_string(static_cast<int>(Wamp_message_type::subscribe)) +
", \"" + identifier + "\", \"" + function + "\"]"};
return m_lcu_websocket_handler.send_message(message);
}
} // namespace rito
6 changes: 4 additions & 2 deletions src/lcu_websocket_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ void Lcu_websocket_handler::register_message_callback(Message_callback on_messag
m_on_message_received = std::move(on_message_received);
}

void Lcu_websocket_handler::register_on_connected_callback(Connection_callback on_connected) noexcept
void Lcu_websocket_handler::register_on_connected_callback(
Connection_callback on_connected) noexcept
{
m_on_connected = std::move(on_connected);
}

void Lcu_websocket_handler::register_on_disconnected_callback(Connection_callback on_disconnected) noexcept
void Lcu_websocket_handler::register_on_disconnected_callback(
Connection_callback on_disconnected) noexcept
{
m_on_disconnected = std::move(on_disconnected);
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/linux/include/lcu_process_handler_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "lcu_process_handler.h"

#include <string>
#include <filesystem>
#include <string>

namespace rito {

Expand Down

0 comments on commit a495af1

Please sign in to comment.