1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
/*
* Copyright (C) 2008-2012 Geometer Plus <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef __NETWORKLINK_H__
#define __NETWORKLINK_H__
#include <string>
#include <vector>
#include <map>
#include <shared_ptr.h>
#include <ZLOptions.h>
#include "NetworkItems.h"
#include "atom/ATOMMetadata.h"
class ZLNetworkRequest;
class NetworkOperationData;
class NetworkAuthenticationManager;
class NetworkLink {
public:
static const std::string URL_MAIN;
static const std::string URL_SEARCH;
static const std::string URL_SIGN_IN;
static const std::string URL_SIGN_OUT;
static const std::string URL_SIGN_UP;
static const std::string URL_TOPUP;
static const std::string URL_RECOVER_PASSWORD;
protected:
NetworkLink(
const std::string &siteName
);
public:
virtual ~NetworkLink();
std::string url(const std::string &urlId) const;
void setTitle(const std::string& title);
void setSummary(const std::string& summary);
void setLanguage(const std::string& language);
void setIcon(const std::string& icon);
void setLinks(const std::map<std::string,std::string>& links);
void setPredefinedId(const std::string& id);
void setEnabled(bool enabled);
void setUpdated(shared_ptr<ATOMUpdated> u);
std::string getSiteName() const;
std::string getTitle() const;
std::string getSummary() const;
std::string getLanguage() const;
std::string getIcon() const;
const std::map<std::string,std::string>& getLinks() const;
std::string getPredefinedId() const;
bool isEnabled() const;
shared_ptr<ATOMUpdated> getUpdated() const;
bool isPredefined() const;
void loadFrom(const NetworkLink & link);
void loadLinksFrom(const NetworkLink & link);
void loadSummaryFrom(const NetworkLink & link);
public:
virtual shared_ptr<ZLNetworkRequest> simpleSearchData(NetworkOperationData &data, const std::string &pattern) const = 0;
virtual shared_ptr<ZLNetworkRequest> advancedSearchData(NetworkOperationData &data, const std::string &titleAndSeries, const std::string &author, const std::string &tag, const std::string &annotation) const = 0;
virtual shared_ptr<ZLNetworkRequest> resume(NetworkOperationData &data) const;
virtual shared_ptr<NetworkAuthenticationManager> authenticationManager() const = 0;
virtual shared_ptr<NetworkItem> libraryItem() const = 0;
virtual void rewriteUrl(std::string &url, bool isUrlExternal = false) const = 0;
private:
const std::string mySiteName;
std::string myTitle;
std::string myIcon;
std::string mySummary;
std::string myLanguage;
std::map<std::string,std::string> myLinks;
std::string myPredefinedId;
bool myEnabled;
shared_ptr<ATOMUpdated> myUpdated;
private: // disable copying
NetworkLink(const NetworkLink &);
const NetworkLink &operator = (const NetworkLink &);
};
#endif /* __NETWORKLINK_H__ */
|