aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/hippoGridManager.h
diff options
context:
space:
mode:
authorJacek Antonelli2009-09-10 02:38:36 -0500
committerJacek Antonelli2009-09-10 02:38:36 -0500
commitb3c39a47e76f595fd953d9ccffc58b0dfb8359db (patch)
treea4bfdb28caf5f42c7ff1878b359aa3fa6a79bc2c /linden/indra/newview/hippoGridManager.h
parentFixed line endings on hippo and grid manager files. (diff)
downloadmeta-impy-b3c39a47e76f595fd953d9ccffc58b0dfb8359db.zip
meta-impy-b3c39a47e76f595fd953d9ccffc58b0dfb8359db.tar.gz
meta-impy-b3c39a47e76f595fd953d9ccffc58b0dfb8359db.tar.bz2
meta-impy-b3c39a47e76f595fd953d9ccffc58b0dfb8359db.tar.xz
Updated Grid Manager from Meerkat's SVN (as of r215).
Diffstat (limited to 'linden/indra/newview/hippoGridManager.h')
-rw-r--r--linden/indra/newview/hippoGridManager.h344
1 files changed, 174 insertions, 170 deletions
diff --git a/linden/indra/newview/hippoGridManager.h b/linden/indra/newview/hippoGridManager.h
index f6ee497..9925495 100644
--- a/linden/indra/newview/hippoGridManager.h
+++ b/linden/indra/newview/hippoGridManager.h
@@ -1,171 +1,175 @@
1#ifndef __HIPPO_GRID_MANAGER_H__ 1#ifndef __HIPPO_GRID_MANAGER_H__
2#define __HIPPO_GRID_MANAGER_H__ 2#define __HIPPO_GRID_MANAGER_H__
3 3
4 4
5#include <map> 5#include <map>
6#include <string> 6#include <string>
7 7
8#ifndef XML_STATIC 8#ifndef XML_STATIC
9#define XML_STATIC 9#define XML_STATIC
10#endif
11#include <expat/expat.h>
12
13
14class LLSD;
15
16
17class HippoGridInfo
18{
19public:
20 enum Platform {
21 PLATFORM_OTHER = 0,
22 PLATFORM_OPENSIM,
23 PLATFORM_SECONDLIFE,
24 PLATFORM_LAST
25 };
26 enum SearchType {
27 SEARCH_ALL_EMPTY,
28 SEARCH_ALL_QUERY,
29 SEARCH_ALL_TEMPLATE
30 };
31
32 explicit HippoGridInfo(const std::string &gridNick);
33
34 Platform getPlatform() const { return mPlatform; }
35 const std::string &getGridNick() const { return mGridNick; }
36 const std::string &getGridName() const { return mGridName; }
37 const std::string &getLoginUri() const { return mLoginUri; }
38 const std::string &getLoginPage() const { return mLoginPage; }
39 const std::string &getHelperUri() const { return mHelperUri; }
40 const std::string &getWebSite() const { return mWebSite; }
41 const std::string &getSupportUrl() const { return mSupportUrl; }
42 const std::string &getRegisterUrl() const { return mRegisterUrl; }
43 const std::string &getPasswordUrl() const { return mPasswordUrl; }
44 const std::string &getSearchUrl() const { return mSearchUrl; }
45 const std::string &getFirstName() const { return mFirstName; }
46 const std::string &getLastName() const { return mLastName; }
47 const std::string &getAvatarPassword() const { return mAvatarPassword; }
48 std::string getSearchUrl(SearchType ty) const;
49 bool isRenderCompat() const { return mRenderCompat; }
50
51 const std::string &getCurrencySymbol() const { return mCurrencySymbol; }
52 const std::string &getRealCurrencySymbol() const { return mRealCurrencySymbol; }
53 std::string getUploadFee() const;
54 std::string getGroupCreationFee() const;
55 std::string getDirectoryFee() const;
56
57 bool isOpenSimulator() const { return (mPlatform == PLATFORM_OPENSIM ); }
58 bool isSecondLife() const { return (mPlatform == PLATFORM_SECONDLIFE); }
59
60 void setPlatform (const std::string &platform);
61 void setPlatform (Platform platform);
62 void setGridName (const std::string &gridName) { mGridName = gridName; }
63 void setLoginUri (const std::string &loginUri) { mLoginUri = loginUri; cleanUpUri(mLoginUri); }
64 void setLoginPage(const std::string &loginPage) { mLoginPage = loginPage; }
65 void setHelperUri(const std::string &helperUri) { mHelperUri = helperUri; cleanUpUri(mHelperUri); }
66 void setWebSite (const std::string &website) { mWebSite = website; }
67 void setSupportUrl(const std::string &url) { mSupportUrl = url; }
68 void setRegisterUrl(const std::string &url) { mRegisterUrl = url; }
69 void setPasswordUrl(const std::string &url) { mPasswordUrl = url; }
70 void setSearchUrl(const std::string &url) { mSearchUrl = url; }
71 void setRenderCompat(bool compat) { mRenderCompat = compat; }
72 void setFirstName(const std::string &firstName) { mFirstName = firstName; } //aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
73 void setLastName(const std::string &lastName) { mLastName = lastName; }
74 void setAvatarPassword(const std::string &avatarPassword) { mAvatarPassword = avatarPassword; }
75
76 void setCurrencySymbol(const std::string &sym) { mCurrencySymbol = sym.substr(0, 3); }
77 void setRealCurrencySymbol(const std::string &sym) { mRealCurrencySymbol = sym.substr(0, 3); }
78 void setDirectoryFee(int fee) { mDirectoryFee = fee; }
79
80 bool retrieveGridInfo();
81
82 static const char *getPlatformString(Platform platform);
83 static void cleanUpGridNick(std::string &gridnick);
84
85 static HippoGridInfo FALLBACK_GRIDINFO;
86 static void initFallback();
87
88private:
89 Platform mPlatform;
90 std::string mGridNick;
91 std::string mGridName;
92 std::string mLoginUri;
93 std::string mLoginPage;
94 std::string mHelperUri;
95 std::string mWebSite;
96 std::string mSupportUrl;
97 std::string mRegisterUrl;
98 std::string mPasswordUrl;
99 std::string mSearchUrl;
100 std::string mFirstName;
101 std::string mLastName;
102 std::string mAvatarPassword;
103 bool mRenderCompat;
104
105 std::string mCurrencySymbol;
106 std::string mRealCurrencySymbol;
107 int mDirectoryFee;
108
109 // for parsing grid info XML
110 enum XmlState {
111 XML_VOID, XML_GRIDNICK, XML_PLATFORM, XML_GRIDNAME,
112 XML_LOGINURI, XML_LOGINPAGE, XML_HELPERURI,
113 XML_WEBSITE, XML_SUPPORT, XML_REGISTER, XML_PASSWORD, XML_SEARCH
114 };
115 XmlState mXmlState;
116
117 static void cleanUpUri(std::string &uri);
118 void formatFee(std::string &fee, int cost, bool showFree) const;
119
120 static void onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts);
121 static void onXmlElementEnd(void *userData, const XML_Char *name);
122 static void onXmlCharacterData(void *userData, const XML_Char *s, int len);
123};
124
125
126class HippoGridManager
127{
128public:
129 HippoGridManager();
130 ~HippoGridManager();
131
132 void init();
133 void saveFile();
134 void discardAndReload();
135
136 HippoGridInfo *getGrid(const std::string &grid) const;
137 HippoGridInfo *getConnectedGrid() const { return (mConnectedGrid)? mConnectedGrid: getCurrentGrid(); }
138 HippoGridInfo *getCurrentGrid() const;
139 const std::string &getDefaultGridNick() const { return mDefaultGrid; }
140 const std::string &getCurrentGridNick() const { return mCurrentGrid; }
141
142 void setDefaultGrid(const std::string &grid);
143 void setCurrentGrid(const std::string &grid);
144 void setCurrentGridAsConnected() { mConnectedGrid = getCurrentGrid(); }
145
146 void addGrid(HippoGridInfo *grid);
147 void deleteGrid(const std::string &grid);
148
149 typedef std::map<std::string, HippoGridInfo*>::iterator GridIterator;
150 GridIterator beginGrid() { return mGridInfo.begin(); }
151 GridIterator endGrid() { return mGridInfo.end(); }
152
153private:
154 std::map<std::string, HippoGridInfo*> mGridInfo;
155 std::string mDefaultGrid;
156 std::string mCurrentGrid;
157 HippoGridInfo *mConnectedGrid;
158 int mDefaultGridsVersion;
159
160 void cleanup();
161 void loadFromFile();
162 void parseFile(const std::string &fileName, bool mergeIfNewer);
163 void parseUrl(const char *url, bool mergeIfNewer);
164 void parseData(LLSD &gridInfo, bool mergeIfNewer);
165};
166
167
168extern HippoGridManager *gHippoGridManager;
169
170
171#endif 10#endif
11
12#ifdef LL_STANDALONE
13#include <expat.h>
14#else
15#include "expat/expat.h"
16#endif
17
18class LLSD;
19
20
21class HippoGridInfo
22{
23public:
24 enum Platform {
25 PLATFORM_OTHER = 0,
26 PLATFORM_OPENSIM,
27 PLATFORM_SECONDLIFE,
28 PLATFORM_LAST
29 };
30 enum SearchType {
31 SEARCH_ALL_EMPTY,
32 SEARCH_ALL_QUERY,
33 SEARCH_ALL_TEMPLATE
34 };
35
36 explicit HippoGridInfo(const std::string &gridNick);
37
38 Platform getPlatform() const { return mPlatform; }
39 const std::string &getGridNick() const { return mGridNick; }
40 const std::string &getGridName() const { return mGridName; }
41 const std::string &getLoginUri() const { return mLoginUri; }
42 const std::string &getLoginPage() const { return mLoginPage; }
43 const std::string &getHelperUri() const { return mHelperUri; }
44 const std::string &getWebSite() const { return mWebSite; }
45 const std::string &getSupportUrl() const { return mSupportUrl; }
46 const std::string &getRegisterUrl() const { return mRegisterUrl; }
47 const std::string &getPasswordUrl() const { return mPasswordUrl; }
48 const std::string &getSearchUrl() const { return mSearchUrl; }
49 const std::string &getFirstName() const { return mFirstName; }
50 const std::string &getLastName() const { return mLastName; }
51 const std::string &getAvatarPassword() const { return mAvatarPassword; }
52 std::string getSearchUrl(SearchType ty) const;
53 bool isRenderCompat() const { return mRenderCompat; }
54
55 const std::string &getCurrencySymbol() const { return mCurrencySymbol; }
56 const std::string &getRealCurrencySymbol() const { return mRealCurrencySymbol; }
57 std::string getUploadFee() const;
58 std::string getGroupCreationFee() const;
59 std::string getDirectoryFee() const;
60
61 bool isOpenSimulator() const { return (mPlatform == PLATFORM_OPENSIM ); }
62 bool isSecondLife() const { return (mPlatform == PLATFORM_SECONDLIFE); }
63
64 void setPlatform (const std::string &platform);
65 void setPlatform (Platform platform);
66 void setGridName (const std::string &gridName) { mGridName = gridName; }
67 void setLoginUri (const std::string &loginUri) { mLoginUri = loginUri; cleanUpUri(mLoginUri); }
68 void setLoginPage(const std::string &loginPage) { mLoginPage = loginPage; }
69 void setHelperUri(const std::string &helperUri) { mHelperUri = helperUri; cleanUpUri(mHelperUri); }
70 void setWebSite (const std::string &website) { mWebSite = website; }
71 void setSupportUrl(const std::string &url) { mSupportUrl = url; }
72 void setRegisterUrl(const std::string &url) { mRegisterUrl = url; }
73 void setPasswordUrl(const std::string &url) { mPasswordUrl = url; }
74 void setSearchUrl(const std::string &url) { mSearchUrl = url; }
75 void setRenderCompat(bool compat) { mRenderCompat = compat; }
76 void setFirstName(const std::string &firstName) { mFirstName = firstName; } //aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
77 void setLastName(const std::string &lastName) { mLastName = lastName; }
78 void setAvatarPassword(const std::string &avatarPassword) { mAvatarPassword = avatarPassword; }
79
80 void setCurrencySymbol(const std::string &sym) { mCurrencySymbol = sym.substr(0, 3); }
81 void setRealCurrencySymbol(const std::string &sym) { mRealCurrencySymbol = sym.substr(0, 3); }
82 void setDirectoryFee(int fee) { mDirectoryFee = fee; }
83
84 bool retrieveGridInfo();
85
86 static const char *getPlatformString(Platform platform);
87 static void cleanUpGridNick(std::string &gridnick);
88
89 static HippoGridInfo FALLBACK_GRIDINFO;
90 static void initFallback();
91
92private:
93 Platform mPlatform;
94 std::string mGridNick;
95 std::string mGridName;
96 std::string mLoginUri;
97 std::string mLoginPage;
98 std::string mHelperUri;
99 std::string mWebSite;
100 std::string mSupportUrl;
101 std::string mRegisterUrl;
102 std::string mPasswordUrl;
103 std::string mSearchUrl;
104 std::string mFirstName;
105 std::string mLastName;
106 std::string mAvatarPassword;
107 bool mRenderCompat;
108
109 std::string mCurrencySymbol;
110 std::string mRealCurrencySymbol;
111 int mDirectoryFee;
112
113 // for parsing grid info XML
114 enum XmlState {
115 XML_VOID, XML_GRIDNICK, XML_PLATFORM, XML_GRIDNAME,
116 XML_LOGINURI, XML_LOGINPAGE, XML_HELPERURI,
117 XML_WEBSITE, XML_SUPPORT, XML_REGISTER, XML_PASSWORD, XML_SEARCH
118 };
119 XmlState mXmlState;
120
121 static void cleanUpUri(std::string &uri);
122 void formatFee(std::string &fee, int cost, bool showFree) const;
123
124 static void onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts);
125 static void onXmlElementEnd(void *userData, const XML_Char *name);
126 static void onXmlCharacterData(void *userData, const XML_Char *s, int len);
127};
128
129
130class HippoGridManager
131{
132public:
133 HippoGridManager();
134 ~HippoGridManager();
135
136 void init();
137 void saveFile();
138 void discardAndReload();
139
140 HippoGridInfo *getGrid(const std::string &grid) const;
141 HippoGridInfo *getConnectedGrid() const { return (mConnectedGrid)? mConnectedGrid: getCurrentGrid(); }
142 HippoGridInfo *getCurrentGrid() const;
143 const std::string &getDefaultGridNick() const { return mDefaultGrid; }
144 const std::string &getCurrentGridNick() const { return mCurrentGrid; }
145
146 void setDefaultGrid(const std::string &grid);
147 void setCurrentGrid(const std::string &grid);
148 void setCurrentGridAsConnected() { mConnectedGrid = getCurrentGrid(); }
149
150 void addGrid(HippoGridInfo *grid);
151 void deleteGrid(const std::string &grid);
152
153 typedef std::map<std::string, HippoGridInfo*>::iterator GridIterator;
154 GridIterator beginGrid() { return mGridInfo.begin(); }
155 GridIterator endGrid() { return mGridInfo.end(); }
156
157private:
158 std::map<std::string, HippoGridInfo*> mGridInfo;
159 std::string mDefaultGrid;
160 std::string mCurrentGrid;
161 HippoGridInfo *mConnectedGrid;
162 int mDefaultGridsVersion;
163
164 void cleanup();
165 void loadFromFile();
166 void parseFile(const std::string &fileName, bool mergeIfNewer);
167 void parseUrl(const char *url, bool mergeIfNewer);
168 void parseData(LLSD &gridInfo, bool mergeIfNewer);
169};
170
171
172extern HippoGridManager *gHippoGridManager;
173
174
175#endif