From eafbdc1c497e8bc997782a5019f5fca1e7facc7f Mon Sep 17 00:00:00 2001 From: FabiTheGuy Date: Thu, 19 Sep 2024 21:33:13 +0200 Subject: [PATCH] Changed Typos + refactor visibilities --- include/docker.hpp | 17 ++++------------- src/docker.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/include/docker.hpp b/include/docker.hpp index bb0d1c0..a4f763c 100644 --- a/include/docker.hpp +++ b/include/docker.hpp @@ -9,28 +9,19 @@ namespace dockerxx { class Docker { - /* Member Variables */ private: CURL* m_curl = nullptr; bool m_remote_connection; - std::string m_uri; + std::string m_url; - /* Constructors */ - public: - Docker(); - explicit Docker(std::string& uri); - - /* Member Functions */ - private: std::string request(const std::string& path); + static size_t write_data(CURL* ptr, size_t size, size_t nmemb, std::string* userp); public: + Docker(); + explicit Docker(std::string url); std::string ping(); - /* Static Functions */ - private: - static size_t write_data(void* ptr, size_t size, size_t nmemb, std::string* userp); - }; } /* namespace dockerxx */ diff --git a/src/docker.cpp b/src/docker.cpp index 820a799..713c39d 100644 --- a/src/docker.cpp +++ b/src/docker.cpp @@ -7,9 +7,9 @@ using namespace dockerxx; /* Constructors */ Docker::Docker() { this->m_remote_connection = false; } -Docker::Docker(std::string &uri) { +Docker::Docker(std::string url) { this->m_remote_connection = true; - this->m_uri = std::move(uri); + this->m_url = std::move(url); } /* Member functions */ @@ -24,7 +24,7 @@ std::string Docker::request(const std::string &path) { this->m_curl = curl_easy_init(); if (this->m_remote_connection) { - curl_easy_setopt(this->m_curl, CURLOPT_URL, std::string(this->m_uri + path).c_str()); + curl_easy_setopt(this->m_curl, CURLOPT_URL, std::string(this->m_url + path).c_str()); } else { curl_easy_setopt(this->m_curl, CURLOPT_URL, std::string("http://localhost" + path).c_str()); curl_easy_setopt(this->m_curl, CURLOPT_UNIX_SOCKET_PATH, @@ -49,7 +49,7 @@ std::string Docker::request(const std::string &path) { std::string Docker::ping() { return request("/_ping"); } /* Static functions */ -size_t Docker::write_data(void *ptr, size_t size, size_t nmemb, std::string *userp) { +size_t Docker::write_data(CURL *ptr, size_t size, size_t nmemb, std::string *userp) { size_t real_size = size * nmemb; userp->append(static_cast(ptr), real_size);