diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-26 01:13:33 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-26 01:13:33 (GMT) |
| commit | 9e1be78bc21d1fb76a19ce12ef36193aea6e2b93 (patch) | |
| tree | 081b67d551bb44fecbf6deb99b6c44ea9789614c /src/search/Save.cpp | |
| parent | b2d3257ae944a3ea3b57dc8ee4171b1b2f85483e (diff) | |
| download | powder-9e1be78bc21d1fb76a19ce12ef36193aea6e2b93.zip powder-9e1be78bc21d1fb76a19ce12ef36193aea6e2b93.tar.gz | |
I've got to a point where I can no longer be bothered to think of a proper commit comment
Diffstat (limited to 'src/search/Save.cpp')
| -rw-r--r-- | src/search/Save.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/search/Save.cpp b/src/search/Save.cpp new file mode 100644 index 0000000..6a5925d --- /dev/null +++ b/src/search/Save.cpp @@ -0,0 +1,87 @@ +/* + * Save.cpp + * + * Created on: Jan 26, 2012 + * Author: Simon + */ + +#include "Save.h" +#include "client/Client.h" + +Save::Save(Save & save) : + userName(save.userName), name(save.name), Description(save.Description), date( + save.date), Published(save.Published), id(save.id), votesUp( + save.votesUp), votesDown(save.votesDown), data(NULL) { + if (save.data) { + std::cout << data << " " << save.data << std::endl; + data = (unsigned char *) malloc(save.dataLength); + memcpy(data, save.data, save.dataLength); + dataLength = save.dataLength; + } +} + +Save::Save(int _id, int _date, int _votesUp, int _votesDown, string _userName, + string _name) : + id(_id), votesUp(_votesUp), votesDown(_votesDown), userName(_userName), name( + _name), Description("No description provided"), date(_date), Published( + true), data(NULL) { +} + +Save::Save(int _id, int date_, int _votesUp, int _votesDown, string _userName, + string _name, string description_, bool published_) : + id(_id), votesUp(_votesUp), votesDown(_votesDown), userName(_userName), name( + _name), Description(description_), date(date_), Published( + published_), data(NULL) { +} + +void Save::SetName(string name) { + this->name = name; +} +string Save::GetName() { + return name; +} + +void Save::SetUserName(string userName) { + this->userName = userName; +} +string Save::GetUserName() { + return userName; +} + +void Save::SetID(int id) { + this->id = id; +} +int Save::GetID() { + return id; +} + +void Save::SetVotesUp(int votesUp) { + this->votesUp = votesUp; +} +int Save::GetVotesUp() { + return votesUp; +} + +void Save::SetVotesDown(int votesDown) { + this->votesDown = votesDown; +} +int Save::GetVotesDown() { + return votesDown; +} + +unsigned char * Save::GetData() { + if (!data) { + data = Client::Ref().GetSaveData(id, date, dataLength); + } + return data; +} +void Save::SetData(unsigned char * data_) { + data = data_; +} + +int Save::GetDataLength() { + if (!data) { + data = Client::Ref().GetSaveData(id, date, dataLength); + } + return dataLength; +} |
