Move gameFile and gameDetails classes to their own files

This commit is contained in:
Sude 2014-09-19 20:23:21 +03:00
parent 4d404fc7df
commit 7a00b59345
8 changed files with 102 additions and 45 deletions

View File

@ -49,9 +49,9 @@ OBJDIR_RELEASE = obj/Release
DEP_RELEASE =
OUT_RELEASE = bin/Release/lgogdownloader
OBJ_DEBUG = $(OBJDIR_DEBUG)/main.o $(OBJDIR_DEBUG)/src/api.o $(OBJDIR_DEBUG)/src/downloader.o $(OBJDIR_DEBUG)/src/progressbar.o $(OBJDIR_DEBUG)/src/util.o $(OBJDIR_DEBUG)/src/blacklist.o
OBJ_DEBUG = $(OBJDIR_DEBUG)/main.o $(OBJDIR_DEBUG)/src/api.o $(OBJDIR_DEBUG)/src/downloader.o $(OBJDIR_DEBUG)/src/progressbar.o $(OBJDIR_DEBUG)/src/util.o $(OBJDIR_DEBUG)/src/blacklist.o $(OBJDIR_DEBUG)/src/gamedetails.o $(OBJDIR_DEBUG)/src/gamefile.o
OBJ_RELEASE = $(OBJDIR_RELEASE)/main.o $(OBJDIR_RELEASE)/src/api.o $(OBJDIR_RELEASE)/src/downloader.o $(OBJDIR_RELEASE)/src/progressbar.o $(OBJDIR_RELEASE)/src/util.o $(OBJDIR_RELEASE)/src/blacklist.o
OBJ_RELEASE = $(OBJDIR_RELEASE)/main.o $(OBJDIR_RELEASE)/src/api.o $(OBJDIR_RELEASE)/src/downloader.o $(OBJDIR_RELEASE)/src/progressbar.o $(OBJDIR_RELEASE)/src/util.o $(OBJDIR_RELEASE)/src/blacklist.o $(OBJDIR_RELEASE)/src/gamedetails.o $(OBJDIR_RELEASE)/src/gamefile.o
all: debug release
@ -87,6 +87,12 @@ $(OBJDIR_DEBUG)/src/util.o: src/util.cpp
$(OBJDIR_DEBUG)/src/blacklist.o: src/blacklist.cpp
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/blacklist.cpp -o $(OBJDIR_DEBUG)/src/blacklist.o
$(OBJDIR_DEBUG)/src/gamefile.o: src/gamefile.cpp
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/gamefile.cpp -o $(OBJDIR_DEBUG)/src/gamefile.o
$(OBJDIR_DEBUG)/src/gamedetails.o: src/gamedetails.cpp
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/gamedetails.cpp -o $(OBJDIR_DEBUG)/src/gamedetails.o
clean_debug:
rm -f $(OBJ_DEBUG) $(OUT_DEBUG)
rm -rf bin/Debug
@ -127,6 +133,12 @@ $(OBJDIR_RELEASE)/src/util.o: src/util.cpp
$(OBJDIR_RELEASE)/src/blacklist.o: src/blacklist.cpp
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/blacklist.cpp -o $(OBJDIR_RELEASE)/src/blacklist.o
$(OBJDIR_RELEASE)/src/gamefile.o: src/gamefile.cpp
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/gamefile.cpp -o $(OBJDIR_RELEASE)/src/gamefile.o
$(OBJDIR_RELEASE)/src/gamedetails.o: src/gamedetails.cpp
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/gamedetails.cpp -o $(OBJDIR_RELEASE)/src/gamedetails.o
clean_release:
rm -f $(OBJ_RELEASE) $(OUT_RELEASE)
rm -rf bin/Release

View File

@ -8,6 +8,7 @@
#define API_H
#include "globalconstants.h"
#include "gamedetails.h"
#include <iostream>
#include <vector>
@ -18,32 +19,6 @@ extern "C" {
#include <cstring>
#include <sys/time.h>
class gameFile {
public:
gameFile(const int& t_updated, const std::string& t_id, const std::string& t_name, const std::string& t_path, const std::string& t_size, const unsigned int& t_language = GlobalConstants::LANGUAGE_EN, const unsigned int& t_platform = GlobalConstants::PLATFORM_WINDOWS, const int& t_silent = 0);
int updated;
std::string id;
std::string name;
std::string path;
std::string size;
unsigned int platform;
unsigned int language;
int silent;
virtual ~gameFile();
};
class gameDetails {
public:
std::vector<gameFile> extras;
std::vector<gameFile> installers;
std::vector<gameFile> patches;
std::vector<gameFile> languagepacks;
std::vector<gameDetails> dlcs;
std::string gamename;
std::string title;
std::string icon;
};
class userDetails {
public:
std::string avatar_small;

25
include/gamedetails.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef GAMEDETAILS_H
#define GAMEDETAILS_H
#include "globalconstants.h"
#include "gamefile.h"
#include <iostream>
#include <vector>
class gameDetails
{
public:
std::vector<gameFile> extras;
std::vector<gameFile> installers;
std::vector<gameFile> patches;
std::vector<gameFile> languagepacks;
std::vector<gameDetails> dlcs;
std::string gamename;
std::string title;
std::string icon;;
protected:
private:
};
#endif // GAMEDETAILS_H

26
include/gamefile.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef GAMEFILE_H
#define GAMEFILE_H
#include "globalconstants.h"
#include <iostream>
#include <vector>
class gameFile
{
public:
gameFile(const int& t_updated, const std::string& t_id, const std::string& t_name, const std::string& t_path, const std::string& t_size, const unsigned int& t_language = GlobalConstants::LANGUAGE_EN, const unsigned int& t_platform = GlobalConstants::PLATFORM_WINDOWS, const int& t_silent = 0);
int updated;
std::string id;
std::string name;
std::string path;
std::string size;
unsigned int platform;
unsigned int language;
int silent;
virtual ~gameFile();
protected:
private:
};
#endif // GAMEFILE_H

View File

@ -14,6 +14,7 @@
<Compiler>
<Add option="-g" />
<Add option="-DDEBUG" />
<Add directory="include" />
</Compiler>
</Target>
<Target title="Release">
@ -23,6 +24,7 @@
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
<Add directory="include" />
</Compiler>
<Linker>
<Add option="-s" />
@ -52,6 +54,8 @@
<Unit filename="include/blacklist.h" />
<Unit filename="include/config.h" />
<Unit filename="include/downloader.h" />
<Unit filename="include/gamedetails.h" />
<Unit filename="include/gamefile.h" />
<Unit filename="include/globalconstants.h" />
<Unit filename="include/progressbar.h" />
<Unit filename="include/util.h" />
@ -59,6 +63,8 @@
<Unit filename="src/api.cpp" />
<Unit filename="src/blacklist.cpp" />
<Unit filename="src/downloader.cpp" />
<Unit filename="src/gamedetails.cpp" />
<Unit filename="src/gamefile.cpp" />
<Unit filename="src/progressbar.cpp" />
<Unit filename="src/util.cpp" />
<Extensions>

View File

@ -5,6 +5,7 @@
* http://www.wtfpl.net/ for more details. */
#include "api.h"
#include "gamefile.h"
#include <cstdio>
#include <cstdlib>
@ -26,23 +27,6 @@ size_t writeMemoryCallback(char *ptr, size_t size, size_t nmemb, void *userp) {
return count;
}
gameFile::gameFile(const int& t_updated, const std::string& t_id, const std::string& t_name, const std::string& t_path, const std::string& t_size, const unsigned int& t_language, const unsigned int& t_platform, const int& t_silent)
{
this->updated = t_updated;
this->id = t_id;
this->name = t_name;
this->path = t_path;
this->size = t_size;
this->platform = t_platform;
this->language = t_language;
this->silent = t_silent;
}
gameFile::~gameFile()
{
}
API::API(const std::string& token, const std::string& secret)
{
curlhandle = curl_easy_init();

11
src/gamedetails.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "gamedetails.h"
/*gameDetails::gameDetails()
{
//ctor
}
gameDetails::~gameDetails()
{
//dtor
}*/

18
src/gamefile.cpp Normal file
View File

@ -0,0 +1,18 @@
#include "gamefile.h"
gameFile::gameFile(const int& t_updated, const std::string& t_id, const std::string& t_name, const std::string& t_path, const std::string& t_size, const unsigned int& t_language, const unsigned int& t_platform, const int& t_silent)
{
this->updated = t_updated;
this->id = t_id;
this->name = t_name;
this->path = t_path;
this->size = t_size;
this->platform = t_platform;
this->language = t_language;
this->silent = t_silent;
}
gameFile::~gameFile()
{
//dtor
}