Skip to content

Commit

Permalink
Move gameFile and gameDetails classes to their own files
Browse files Browse the repository at this point in the history
  • Loading branch information
Sude- committed Sep 19, 2014
1 parent 4d404fc commit 7a00b59
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 45 deletions.
16 changes: 14 additions & 2 deletions Makefile
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
27 changes: 1 addition & 26 deletions include/api.h
Expand Up @@ -8,6 +8,7 @@
#define API_H

#include "globalconstants.h"
#include "gamedetails.h"

#include <iostream>
#include <vector>
Expand All @@ -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;
Expand Down
25 changes: 25 additions & 0 deletions include/gamedetails.h
@@ -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 changes: 26 additions & 0 deletions include/gamefile.h
@@ -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
6 changes: 6 additions & 0 deletions lgogdownloader.cbp
Expand Up @@ -14,6 +14,7 @@
<Compiler>
<Add option="-g" />
<Add option="-DDEBUG" />
<Add directory="include" />
</Compiler>
</Target>
<Target title="Release">
Expand All @@ -23,6 +24,7 @@
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
<Add directory="include" />
</Compiler>
<Linker>
<Add option="-s" />
Expand Down Expand Up @@ -52,13 +54,17 @@
<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" />
<Unit filename="main.cpp" />
<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>
Expand Down
18 changes: 1 addition & 17 deletions src/api.cpp
Expand Up @@ -5,6 +5,7 @@
* http://www.wtfpl.net/ for more details. */

#include "api.h"
#include "gamefile.h"

#include <cstdio>
#include <cstdlib>
Expand All @@ -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();
Expand Down
11 changes: 11 additions & 0 deletions src/gamedetails.cpp
@@ -0,0 +1,11 @@
#include "gamedetails.h"

/*gameDetails::gameDetails()
{
//ctor
}
gameDetails::~gameDetails()
{
//dtor
}*/
18 changes: 18 additions & 0 deletions src/gamefile.cpp
@@ -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
}

0 comments on commit 7a00b59

Please sign in to comment.