diff options
author | McCabe Maxsted | 2009-10-18 17:58:27 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-10-18 17:58:27 -0700 |
commit | e4b0e7c82d670081c071d8a3da31b5ec407b8e07 (patch) | |
tree | 9410962bbb582eedbec448139e217f2714050777 /linden/indra/newview/hippoGridManager.h | |
parent | Started 1.3.0 branch (diff) | |
parent | Updated and added some Linux libs. (diff) | |
download | meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.zip meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.gz meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.bz2 meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.xz |
Merged working branch of 1.2 into LL 1.23 merge
Diffstat (limited to 'linden/indra/newview/hippoGridManager.h')
-rw-r--r-- | linden/indra/newview/hippoGridManager.h | 174 |
1 files changed, 174 insertions, 0 deletions
diff --git a/linden/indra/newview/hippoGridManager.h b/linden/indra/newview/hippoGridManager.h new file mode 100644 index 0000000..ef351d9 --- /dev/null +++ b/linden/indra/newview/hippoGridManager.h | |||
@@ -0,0 +1,174 @@ | |||
1 | #ifndef __HIPPO_GRID_MANAGER_H__ | ||
2 | #define __HIPPO_GRID_MANAGER_H__ | ||
3 | |||
4 | |||
5 | #include <map> | ||
6 | #include <string> | ||
7 | |||
8 | #ifndef XML_STATIC | ||
9 | #define XML_STATIC | ||
10 | #endif | ||
11 | |||
12 | #ifdef LL_STANDALONE | ||
13 | #include <expat.h> | ||
14 | #else | ||
15 | #include "expat/expat.h" | ||
16 | #endif | ||
17 | |||
18 | class LLSD; | ||
19 | |||
20 | |||
21 | class HippoGridInfo | ||
22 | { | ||
23 | public: | ||
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(); | ||
39 | bool isOpenSimulator() const; | ||
40 | bool isSecondLife() const; | ||
41 | const std::string& getGridNick() const; | ||
42 | const std::string& getGridName() const; | ||
43 | const std::string& getLoginUri() const; | ||
44 | const std::string& getLoginPage() const; | ||
45 | const std::string& getHelperUri() const; | ||
46 | const std::string& getWebSite() const; | ||
47 | const std::string& getSupportUrl() const; | ||
48 | const std::string& getRegisterUrl() const; | ||
49 | const std::string& getPasswordUrl() const; | ||
50 | const std::string& getSearchUrl() const; | ||
51 | const std::string& getFirstName() const; | ||
52 | const std::string& getLastName() const; | ||
53 | const std::string& getAvatarPassword() const; | ||
54 | std::string getSearchUrl(SearchType ty) const; | ||
55 | bool isRenderCompat() const; | ||
56 | |||
57 | const std::string& getCurrencySymbol() const; | ||
58 | const std::string& getRealCurrencySymbol() const; | ||
59 | std::string getUploadFee() const; | ||
60 | std::string getGroupCreationFee() const; | ||
61 | std::string getDirectoryFee() const; | ||
62 | |||
63 | void setPlatform (const std::string &platform); | ||
64 | void setPlatform (Platform platform); | ||
65 | void setGridName (const std::string &gridName); | ||
66 | void setLoginUri (const std::string &loginUri); | ||
67 | void setLoginPage(const std::string &loginPage); | ||
68 | void setHelperUri(const std::string &helperUri); | ||
69 | void setWebSite (const std::string &website); | ||
70 | void setSupportUrl(const std::string &url); | ||
71 | void setRegisterUrl(const std::string &url); | ||
72 | void setPasswordUrl(const std::string &url); | ||
73 | void setSearchUrl(const std::string &url); | ||
74 | void setRenderCompat(bool compat); | ||
75 | void setFirstName(const std::string &firstName); | ||
76 | void setLastName(const std::string &lastName); | ||
77 | void setAvatarPassword(const std::string &avatarPassword); | ||
78 | |||
79 | void setCurrencySymbol(const std::string &sym); | ||
80 | void setRealCurrencySymbol(const std::string &sym); | ||
81 | void setDirectoryFee(int fee); | ||
82 | |||
83 | bool retrieveGridInfo(); | ||
84 | |||
85 | static const char *getPlatformString(Platform platform); | ||
86 | static std::string sanitizeGridNick(std::string &gridnick); | ||
87 | |||
88 | static HippoGridInfo FALLBACK_GRIDINFO; | ||
89 | static void initFallback(); | ||
90 | |||
91 | private: | ||
92 | Platform mPlatform; | ||
93 | std::string mGridNick; | ||
94 | std::string mGridName; | ||
95 | std::string mLoginUri; | ||
96 | std::string mLoginPage; | ||
97 | std::string mHelperUri; | ||
98 | std::string mWebSite; | ||
99 | std::string mSupportUrl; | ||
100 | std::string mRegisterUrl; | ||
101 | std::string mPasswordUrl; | ||
102 | std::string mSearchUrl; | ||
103 | std::string mFirstName; | ||
104 | std::string mLastName; | ||
105 | std::string mAvatarPassword; | ||
106 | bool mRenderCompat; | ||
107 | |||
108 | std::string mCurrencySymbol; | ||
109 | std::string mRealCurrencySymbol; | ||
110 | int mDirectoryFee; | ||
111 | |||
112 | // for parsing grid info XML | ||
113 | enum XmlState { | ||
114 | XML_VOID, XML_GRIDNICK, XML_PLATFORM, XML_GRIDNAME, | ||
115 | XML_LOGINURI, XML_LOGINPAGE, XML_HELPERURI, | ||
116 | XML_WEBSITE, XML_SUPPORT, XML_REGISTER, XML_PASSWORD, XML_SEARCH | ||
117 | }; | ||
118 | XmlState mXmlState; | ||
119 | |||
120 | static std::string sanitizeUri(std::string &uri); | ||
121 | void formatFee(std::string &fee, int cost, bool showFree) const; | ||
122 | |||
123 | static void onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts); | ||
124 | static void onXmlElementEnd(void *userData, const XML_Char *name); | ||
125 | static void onXmlCharacterData(void *userData, const XML_Char *s, int len); | ||
126 | }; | ||
127 | |||
128 | |||
129 | class HippoGridManager | ||
130 | { | ||
131 | public: | ||
132 | HippoGridManager(); | ||
133 | ~HippoGridManager(); | ||
134 | |||
135 | void init(); | ||
136 | void saveFile(); | ||
137 | void discardAndReload(); | ||
138 | |||
139 | HippoGridInfo* getGrid(const std::string &grid) const; | ||
140 | HippoGridInfo* getConnectedGrid() const; | ||
141 | HippoGridInfo* getCurrentGrid() const; | ||
142 | const std::string& getDefaultGridNick() const; | ||
143 | const std::string& getCurrentGridNick() const; | ||
144 | |||
145 | void setDefaultGrid(const std::string &grid); | ||
146 | void setCurrentGrid(const std::string &grid); | ||
147 | void setCurrentGridAsConnected(); | ||
148 | |||
149 | void addGrid(HippoGridInfo *grid); | ||
150 | void deleteGrid(const std::string &grid); | ||
151 | |||
152 | typedef std::map<std::string, HippoGridInfo*>::iterator GridIterator; | ||
153 | GridIterator beginGrid() { return mGridInfo.begin(); } | ||
154 | GridIterator endGrid() { return mGridInfo.end(); } | ||
155 | |||
156 | private: | ||
157 | std::map<std::string, HippoGridInfo*> mGridInfo; | ||
158 | std::string mDefaultGrid; | ||
159 | std::string mCurrentGrid; | ||
160 | HippoGridInfo *mConnectedGrid; | ||
161 | int mDefaultGridsVersion; | ||
162 | |||
163 | void cleanup(); | ||
164 | void loadFromFile(); | ||
165 | void parseFile(const std::string &fileName, bool mergeIfNewer); | ||
166 | void parseUrl(const char *url, bool mergeIfNewer); | ||
167 | void parseData(LLSD &gridInfo, bool mergeIfNewer); | ||
168 | }; | ||
169 | |||
170 | |||
171 | extern HippoGridManager *gHippoGridManager; | ||
172 | |||
173 | |||
174 | #endif | ||