Skip to content

Commit

Permalink
Changed Typos + refactor visibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
FabiTheGuy committed Sep 19, 2024
1 parent e0d6ec5 commit eafbdc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
17 changes: 4 additions & 13 deletions include/docker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
8 changes: 4 additions & 4 deletions src/docker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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,
Expand All @@ -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<char *>(ptr), real_size);
Expand Down

0 comments on commit eafbdc1

Please sign in to comment.