The-Powder-Toy/src/client/Client.h

41 lines
1.0 KiB
C
Raw Normal View History

#ifndef CLIENT_H
#define CLIENT_H
#include <queue>
#include <vector>
2012-01-19 11:59:00 -06:00
#include "Config.h"
#include "HTTP.h"
#include "search/Thumbnail.h"
#include "search/Save.h"
#include "Singleton.h"
2012-01-24 14:19:19 -06:00
enum LoginStatus
{
LoginPasswordInvalid, LoginUsernameInvalid, LoginOkay, LoginBanned, LoginError
};
class Client: public Singleton<Client>
{
private:
std::string lastError;
int thumbnailCacheNextID;
2012-01-19 11:59:00 -06:00
Thumbnail * thumbnailCache[THUMB_CACHE_SIZE];
void * activeThumbRequests[IMGCONNS];
int activeThumbRequestTimes[IMGCONNS];
int activeThumbRequestCompleteTimes[IMGCONNS];
std::string activeThumbRequestIDs[IMGCONNS];
public:
Client();
~Client();
2012-01-24 14:19:19 -06:00
LoginStatus Login(string username, string password);
void ClearThumbnailRequests();
std::vector<Save*> * SearchSaves(int start, int count, string query, string sort, int & resultCount);
Thumbnail * GetPreview(int saveID, int saveDate);
Thumbnail * GetThumbnail(int saveID, int saveDate);
Save * GetSave(int saveID, int saveDate);
std::string GetLastError() { return lastError; }
};
#endif // CLIENT_H