diff --git a/program/Build/RaspberryCloud.sdf b/program/Build/RaspberryCloud.sdf index 28613c32486f63e1c01106413be75fac5204d876..d17f4c5973bf059eed9a5c0c99b263548cb594fe 100644 Binary files a/program/Build/RaspberryCloud.sdf and b/program/Build/RaspberryCloud.sdf differ diff --git a/program/Build/RaspberryCloud.v12.suo b/program/Build/RaspberryCloud.v12.suo index f2a212dbbad7fccd7ef042320b5243b71f8b7537..7341fd9e9d391339e65c55ddcceff280d9167b2b 100644 Binary files a/program/Build/RaspberryCloud.v12.suo and b/program/Build/RaspberryCloud.v12.suo differ diff --git a/program/Source.7z b/program/Source.7z new file mode 100644 index 0000000000000000000000000000000000000000..f2999f7d6028cd6786ba5ff84e3b584d253da211 Binary files /dev/null and b/program/Source.7z differ diff --git a/program/Source/app/Application.cpp b/program/Source/app/Application.cpp index 5d2963a532d163381745b5b7a81ed185b7cf319f..3f2e40445dfcd48616c5572c20ac4f41c8afee96 100644 --- a/program/Source/app/Application.cpp +++ b/program/Source/app/Application.cpp @@ -126,10 +126,10 @@ int main(int argc, char **argv) { else if (command == "getFileList"){ list<FileDescriptor*>* fileTree = application.ui.getFileTree(); cout << "fileTree has " << fileTree->size() << " file(s)." << endl; - for each (FileDescriptor* fileD in *fileTree) + for(FileDescriptor* fileD : *fileTree) { cout << fileD->getFileID() << endl; - for each (Fragment f in fileD->getFragments()){ + for (Fragment f : fileD->getFragments()){ cout << f.getCloudFileID() << endl; cout << f.getCloudId() << endl; } diff --git a/program/Source/cloud/CloudAccessLayer.cpp b/program/Source/cloud/CloudAccessLayer.cpp index 69e5a69e37b17c0c45ee05ed6c0646d89d729821..53c1d42d3057d2f77b900af6bce82bcb812ec186 100644 --- a/program/Source/cloud/CloudAccessLayer.cpp +++ b/program/Source/cloud/CloudAccessLayer.cpp @@ -31,7 +31,7 @@ bool CloudAccessLayer::upload(const FileDescriptor& fileDescriptor) const }*/ bool succesful = true; - for each (Fragment f in fragments) + for (Fragment f : fragments) { if (!app->cm.getCloudAdapter(f.getCloudId())->upload(f)){ succesful = false; @@ -65,7 +65,7 @@ FileDescriptor* CloudAccessLayer::download(FileDescriptor fileDescriptor) { } FileDescriptor* fd = new FileDescriptor(fileDescriptor.getFileID()); - for each (Fragment f in fragments) + for (Fragment f : fragments) { CloudFile clf = CloudFile(f.getCloudId(), f.getCloudFileID()); fd->addFragment(*(app->cm.getCloudAdapter(f.getCloudId())->download(clf))); @@ -96,7 +96,7 @@ bool CloudAccessLayer::deleteFile(FileDescriptor fileDescriptor) { return false; } - for each (Fragment f in fragments) + for (Fragment f : fragments) { CloudFile clf = CloudFile(f.getCloudId(), f.getCloudFileID()); app->cm.getCloudAdapter(f.getCloudId())->deleteFile(clf); @@ -118,7 +118,7 @@ bool CloudAccessLayer::deleteFile(fileModel::LockFile lockFile) { long CloudAccessLayer::getSize(FileDescriptor fileDescriptor) { LOG_ENTER_EXIT; long size = 0; - for each (Fragment f in fileDescriptor.getFragments()) + for (Fragment f : fileDescriptor.getFragments()) { CloudFile clf = CloudFile(f.getCloudId(), f.getCloudFileID()); size += (app->cm.getCloudAdapter(f.getCloudId())->getSize(clf)); @@ -129,7 +129,7 @@ long CloudAccessLayer::getSize(FileDescriptor fileDescriptor) { bool CloudAccessLayer::checkExists(FileDescriptor fileDescriptor) { LOG_ENTER_EXIT; bool exists = true; - for each (Fragment f in fileDescriptor.getFragments()) + for (Fragment f : fileDescriptor.getFragments()) { if (!(app->cm.getCloudAdapter(f.getCloudId())->checkExists(f))) { diff --git a/program/Source/cloud/CloudException.h b/program/Source/cloud/CloudException.h index 322fa80cee51afdf7fd807f8eb136ef1647b4a5d..1ad60e6b2e39c529130e6d295dbf80312dd93631 100644 --- a/program/Source/cloud/CloudException.h +++ b/program/Source/cloud/CloudException.h @@ -5,13 +5,13 @@ class CloudException : std::exception { private: - char* message; + std::string message; public: - CloudException(char* _m) : message(_m){} + CloudException(std::string message) : message(message){} const char* what() const throw() override { - return message; + return message.c_str(); } }; diff --git a/program/Source/cloud/CloudManager.cpp b/program/Source/cloud/CloudManager.cpp index 5f8ae5e6087569b16d65334ce5224b9a58befe63..7360f0040f723e58f3cd14c223b28486f42d0b34 100644 --- a/program/Source/cloud/CloudManager.cpp +++ b/program/Source/cloud/CloudManager.cpp @@ -20,7 +20,7 @@ void CloudManager::getCloudInfo(string cloudID) { shared_ptr<CloudAdapter> CloudManager::getCloudAdapter(string cloudID) const { LOG_ENTER_EXIT; - for each (auto adapter in cloudList) + for (auto adapter : cloudList) { if (adapter->cloudID == cloudID){ return adapter; diff --git a/program/Source/cloud/DropboxAdapter.cpp b/program/Source/cloud/DropboxAdapter.cpp index 45530d3ed0a5d31bfe3aa109eabe246eadb93069..ceb3f74ae45766227664dd90ce4096f30478e1ba 100644 --- a/program/Source/cloud/DropboxAdapter.cpp +++ b/program/Source/cloud/DropboxAdapter.cpp @@ -1,16 +1,16 @@ #include "DropboxAdapter.h" #include "../logger/Logger.h" #include <fstream> -#include "Poco/Net/FTPClientSession.h" -#include "Poco/Net/HTTPSClientSession.h" -#include "Poco/Net/HTTPResponse.h" -#include "Poco/Net/OAuth20Credentials.h" -#include "Poco/JSON/Parser.h" -#include "Poco/JSON/Object.h" -#include "Poco/Net/Context.h" -#include "Poco/Dynamic/Var.h" -#include "Poco/Exception.h" -#include "Poco/StreamCopier.h" +#include <Poco/Net/FTPClientSession.h> +#include <Poco/Net/HTTPSClientSession.h> +#include <Poco/Net/HTTPResponse.h> +#include <Poco/Net/OAuth20Credentials.h> +#include <Poco/JSON/Parser.h> +#include <Poco/JSON/Object.h> +#include <Poco/Net/Context.h> +#include <Poco/Dynamic/Var.h> +#include <Poco/Exception.h> +#include <Poco/StreamCopier.h> #include <iostream> #include <memory> #include "boost/filesystem.hpp" diff --git a/program/Source/cloud/DropboxAdapter.h b/program/Source/cloud/DropboxAdapter.h index 61e75eb7804ef0648e77d453ef92473004443d92..498a151c58e04f296d2bf58e8c8bae8ff2907e8b 100644 --- a/program/Source/cloud/DropboxAdapter.h +++ b/program/Source/cloud/DropboxAdapter.h @@ -5,7 +5,7 @@ #include "../fileModel/CloudFile.h" #include "../cloud/CloudAdapter.h" #include "../fileModel/Fragment.h" -#include "Poco/Net/HTTPRequest.h" +#include <Poco/Net/HTTPRequest.h> #include <Poco/Net/Context.h> /** diff --git a/program/Source/cloud/FTPAdapter.cpp b/program/Source/cloud/FTPAdapter.cpp index 44951929ab08fe092769693802db002613584688..c932a6ffc429dcacc70e0ba64c3648add3233e68 100644 --- a/program/Source/cloud/FTPAdapter.cpp +++ b/program/Source/cloud/FTPAdapter.cpp @@ -1,10 +1,10 @@ #include "FTPAdapter.h" #include "../logger/Logger.h" #include <fstream> -#include "Poco/Net/FTPClientSession.h" -#include "Poco/Net/NetException.h" -#include "Poco/Exception.h" -#include "Poco/StreamCopier.h" +#include <Poco/Net/FTPClientSession.h> +#include <Poco/Net/NetException.h> +#include <Poco/Exception.h> +#include <Poco/StreamCopier.h> #include <iostream> #include <memory> #include "boost/filesystem.hpp" diff --git a/program/Source/dataAccess/CloudFileList.cpp b/program/Source/dataAccess/CloudFileList.cpp index b189f9491f734016f3d5f171b0d2b4de90679b40..bc06f6c73e9017cac4c8823e1cff83c59c8f71dd 100644 --- a/program/Source/dataAccess/CloudFileList.cpp +++ b/program/Source/dataAccess/CloudFileList.cpp @@ -11,7 +11,7 @@ void CloudFileList::save() out << fileTree.size(); out << separator; - for each (FileDescriptor* fd in fileTree){ + for (FileDescriptor* fd : fileTree){ string fileID = fd->getFileID(); out << fileID; out << separator; @@ -27,7 +27,7 @@ void CloudFileList::save() out << frags.size(); out << separator; - for each (Fragment frag in frags){ + for (Fragment frag : frags){ string cloudFileID = frag.getCloudFileID(); out << cloudFileID; out << separator; diff --git a/program/Source/dataAccess/CloudFileSystem.cpp b/program/Source/dataAccess/CloudFileSystem.cpp index 95078d18e3bbdfad15d976eab96f9e3aa91a494b..419e2f0dae7faa2e61007f345640aa01bda2ae06 100644 --- a/program/Source/dataAccess/CloudFileSystem.cpp +++ b/program/Source/dataAccess/CloudFileSystem.cpp @@ -118,7 +118,7 @@ void CloudFileSystem::lock(FileDescriptor fileDescriptor) { string lockFileName(fileDescriptor.getFileID() + ".lck"); - for each (string cloudId in fileDescriptor.getUniqueClouds()) + for (string cloudId : fileDescriptor.getUniqueClouds()) { ofstream lockFileTmp(fragFolder + lockFileName, std::ios::binary); @@ -134,7 +134,7 @@ void CloudFileSystem::lock(FileDescriptor fileDescriptor) { void CloudFileSystem::unlock(FileDescriptor fileDescriptor) { LOG_ENTER_EXIT; - for each (string cloudId in fileDescriptor.getUniqueClouds()) + for (string cloudId : fileDescriptor.getUniqueClouds()) { fileModel::LockFile lockFile(cloudId, fileDescriptor); application.cal.deleteFile(lockFile); @@ -146,7 +146,7 @@ bool CloudFileSystem::isLocked(FileDescriptor fileDescriptor) { bool isLockedResult = false; - for each (string cloudId in fileDescriptor.getUniqueClouds()) + for (string cloudId : fileDescriptor.getUniqueClouds()) { fileModel::LockFile lockFile(cloudId, fileDescriptor); @@ -198,7 +198,7 @@ bool CloudFileSystem::addToFileTreeByID(FileDescriptor* fileDescriptor) { LOG_ENTER_EXIT; list<FileDescriptor*>* fileList = cfl.getFileTree(); - for each (FileDescriptor* fileDesc in *(fileList)) + for (FileDescriptor* fileDesc : *(fileList)) { if (fileDesc->getFileID() == fileDescriptor->getFileID()){ return false; @@ -211,7 +211,7 @@ bool CloudFileSystem::addToFileTreeByID(FileDescriptor* fileDescriptor) { bool CloudFileSystem::delFromFileTreeByID(FileDescriptor* fileDescriptor) { LOG_ENTER_EXIT; list<FileDescriptor*>* fileList = cfl.getFileTree(); - for each (FileDescriptor* fileDesc in *(fileList)) + for (FileDescriptor* fileDesc : *(fileList)) { if (fileDesc->getFileID() == fileDescriptor->getFileID()){ fileList->remove(fileDesc); @@ -224,7 +224,7 @@ bool CloudFileSystem::delFromFileTreeByID(FileDescriptor* fileDescriptor) { FileDescriptor* CloudFileSystem::findByID(FileDescriptor* fileDescriptor) { LOG_ENTER_EXIT; list<FileDescriptor*>* fileList = cfl.getFileTree(); - for each (FileDescriptor* fileDesc in *(fileList)) + for (FileDescriptor* fileDesc : *(fileList)) { if (fileDesc->getFileID() == fileDescriptor->getFileID()){ return fileDesc; diff --git a/program/Source/dataAccess/Decoder.cpp b/program/Source/dataAccess/Decoder.cpp index 0cfbc396c08b6cbda6c255950e9b7680a321c72a..27ecadd5d27e7cfbf915ddc3eaf6a126a4995e9c 100644 --- a/program/Source/dataAccess/Decoder.cpp +++ b/program/Source/dataAccess/Decoder.cpp @@ -69,7 +69,7 @@ string Decoder::decode(FileDescriptor* fileDescriptor) // Not removed in previous loop, because that doesn't necessarily // iterate through every fragment - for each (Fragment fragment in fragments) + for (Fragment fragment : fragments) { remove((fragFolder + fragment.getCloudFileID()).c_str()); } diff --git a/program/Source/dataAccess/Distributor.cpp b/program/Source/dataAccess/Distributor.cpp index 560d75d90f7819e4b51028d585eb9fe00f061d56..224d337e588a6ec5fbfa724c910261029792e516 100644 --- a/program/Source/dataAccess/Distributor.cpp +++ b/program/Source/dataAccess/Distributor.cpp @@ -13,7 +13,7 @@ Distributor::Distributor(CloudManager &cloudManager) : cloudManager(cloudManager throw CloudException("Nincs cloudAdapter a cloudManager-ben"); } /*else { - for each (auto cla in cloudManager.getCloudList()){ + for (auto cla : cloudManager.getCloudList()){ cloudIDs.push_back(cla->cloudID); } }*/ diff --git a/program/Source/fileModel/FileDescriptor.cpp b/program/Source/fileModel/FileDescriptor.cpp index 3e315442fa354f212ce04d4ead252ea44006447d..b3ad05d4a8e089f4409d78ce7b3c72137b2e3d1f 100644 --- a/program/Source/fileModel/FileDescriptor.cpp +++ b/program/Source/fileModel/FileDescriptor.cpp @@ -57,7 +57,7 @@ std::set<std::string> FileDescriptor::getUniqueClouds() { set<string> clouds; - for each (Fragment fragment in getFragments()) + for (Fragment fragment : getFragments()) { clouds.insert(fragment.getCloudId()); } diff --git a/program/Source/networking/HomeNetworkCommunications.cpp b/program/Source/networking/HomeNetworkCommunications.cpp index 0a0136300ad69204ccd89343d94cc05690f73154..eab97c7e1441843c99509aa0f11ede67ebee5234 100644 --- a/program/Source/networking/HomeNetworkCommunications.cpp +++ b/program/Source/networking/HomeNetworkCommunications.cpp @@ -3,9 +3,9 @@ #include "FileServerConnection.h" #include "NetworkHelperMethods.h" #include "IPServer.h" -#include "Poco/Thread.h" -#include "Poco/Net/TCPServerConnectionFactory.h" -#include "Poco/Net/TCPServer.h" +#include <Poco/Thread.h> +#include <Poco/Net/TCPServerConnectionFactory.h> +#include <Poco/Net/TCPServer.h> #include <Poco/Net/DatagramSocket.h> using namespace std; diff --git a/program/Source/networking/NetworkHelperMethods.h b/program/Source/networking/NetworkHelperMethods.h index 73872a2098369ea4791c7316b15687009c7ad720..686c91fecd2e4c3363b594211c903b09bccc396c 100644 --- a/program/Source/networking/NetworkHelperMethods.h +++ b/program/Source/networking/NetworkHelperMethods.h @@ -20,7 +20,7 @@ inline long getFileSize(std::ifstream& file) auto begin = file.tellg(); file.seekg(0, file.end); auto end = file.tellg(); - file.seekg(0, currPos); + file.seekg(currPos); return end - begin; }