added c++ doc and replaced ifndef with pragma once

This commit is contained in:
2019-08-01 21:19:02 +02:00
parent 904cd2e96a
commit 52cc5f204b
13 changed files with 104 additions and 77 deletions

View File

@ -1,20 +0,0 @@
//
// Created by lukas on 05.05.19.
//
#ifndef IPREFRESHER_LOGGER_H
#define IPREFRESHER_LOGGER_H
class Logger {
public:
void logToLogfile(std::string text);
void safeip(std::string ip);
std::string readip();
};
#endif //IPREFRESHER_LOGGER_H

View File

@ -2,8 +2,8 @@
// Created by lukas on 06.04.19.
//
#include "API.h"
#include "Hashmap.h"
#include "api/API.h"
#include "api/Hashmap.h"
#include <string>
#include <iostream>

View File

@ -1,23 +0,0 @@
//
// Created by lukas on 06.04.19.
//
#ifndef IPREFRESHER_API_H
#define IPREFRESHER_API_H
#include <string>
#include "Hashmap.h"
class API {
public:
std::string request(std::string myurl);
std::string request(std::string myurl, bool post, Hashmap<std::string, std::string> &map, std::vector<std::string> &headers);
private:
static size_t write_data(void *buffer, size_t size, size_t buffersize, FILE *stream);
};
#endif //IPREFRESHER_API_H

View File

@ -2,7 +2,7 @@
// Created by lukas on 18.06.19.
//
#include "DynuAPI.h"
#include "api/DynuAPI.h"
int DynuAPI::refreshIp(std:: string ip) {

View File

@ -1,22 +0,0 @@
//
// Created by lukas on 18.06.19.
//
#ifndef IPREFRESHER_DYNUAPI_H
#define IPREFRESHER_DYNUAPI_H
#include "API.h"
class DynuAPI : API{
public:
int refreshIp(std::string ip);
private:
const std::string dynuapikey = "88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg";
const std::string domainid = "8506047"; //id of the dynu domain
const std::string domainname = "luki.dynu.net";
};
#endif //IPREFRESHER_DYNUAPI_H

View File

@ -1,50 +0,0 @@
//
// Created by lukas on 07.04.19.
//
#ifndef QT5PROJECT_HASHMAP_H
#define QT5PROJECT_HASHMAP_H
#include <iostream>
#include <vector>
template<class keytype, class valuetype>
class Hashmap {
public:
void add(keytype key, keytype value);
keytype getKey(int position);
valuetype getValue(int position);
int size();
private:
std::vector<keytype> keys;
std::vector<valuetype> values;
};
template<class keytype, class valuetype>
void Hashmap<keytype, valuetype>::add(keytype key, keytype value) {
keys.push_back(key);
values.push_back(value);
}
template<class keytype, class valuetype>
keytype Hashmap<keytype, valuetype>::getKey(int position) {
return keys.at(position);
}
template<class keytype, class valuetype>
valuetype Hashmap<keytype, valuetype>::getValue(int position) {
return values.at(position);
}
template<class keytype, class valuetype>
int Hashmap<keytype, valuetype>::size() {
return (int) (keys.size());
}
#endif //QT5PROJECT_HASHMAP_H

View File

@ -2,7 +2,7 @@
// Created by lukas on 18.06.19.
//
#include "IPAPI.h"
#include "api/IPAPI.h"
std::string IPAPI::getGlobalIp() {
return request("https://api.ipify.org");

View File

@ -1,18 +0,0 @@
//
// Created by lukas on 18.06.19.
//
#ifndef IPREFRESHER_IPAPI_H
#define IPREFRESHER_IPAPI_H
#include <string>
#include "API.h"
class IPAPI : API{
public:
std::string getGlobalIp();
};
#endif //IPREFRESHER_IPAPI_H

View File

@ -2,7 +2,7 @@
// Created by lukas on 08.05.19.
//
#include "TelegramAPI.h"
#include "api/TelegramAPI.h"
void TelegramAPI::sendMessage(std::string text) {
Hashmap<std::string, std::string> args;

View File

@ -1,22 +0,0 @@
//
// Created by lukas on 08.05.19.
//
#ifndef IPREFRESHER_TELEGRAMAPI_H
#define IPREFRESHER_TELEGRAMAPI_H
#include <string>
#include "API.h"
class TelegramAPI : API {
public:
void sendMessage(std::string text);
private:
const std::string apikey = "717213769:AAHan1nSXhUsxLJAN1Dv8Oc0z8wqwDdYPn4";
const std::string chatid = "618154204";
};
#endif //IPREFRESHER_TELEGRAMAPI_H