diff options
Diffstat (limited to 'linden/indra/newview/llurlsimstring.h')
-rw-r--r-- | linden/indra/newview/llurlsimstring.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/linden/indra/newview/llurlsimstring.h b/linden/indra/newview/llurlsimstring.h new file mode 100644 index 0000000..701241e --- /dev/null +++ b/linden/indra/newview/llurlsimstring.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /** | ||
2 | * @file llsimurlstring.h | ||
3 | * @brief Handles "SLURL fragments" like Ahern/123/45 for | ||
4 | * startup processing, login screen, prefs, etc. | ||
5 | * | ||
6 | * $LicenseInfo:firstyear=2006&license=viewergpl$ | ||
7 | * | ||
8 | * Copyright (c) 2006-2007, Linden Research, Inc. | ||
9 | * | ||
10 | * Second Life Viewer Source Code | ||
11 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
12 | * to you under the terms of the GNU General Public License, version 2.0 | ||
13 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
14 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
15 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
16 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
17 | * | ||
18 | * There are special exceptions to the terms and conditions of the GPL as | ||
19 | * it is applied to this Source Code. View the full text of the exception | ||
20 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
21 | * online at http://secondlife.com/developers/opensource/flossexception | ||
22 | * | ||
23 | * By copying, modifying or distributing this software, you acknowledge | ||
24 | * that you have read and understood your obligations described above, | ||
25 | * and agree to abide by those obligations. | ||
26 | * | ||
27 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
29 | * COMPLETENESS OR PERFORMANCE. | ||
30 | * $/LicenseInfo$ | ||
31 | */ | ||
32 | #ifndef LLSIMURLSTRING_H | ||
33 | #define LLSIMURLSTRING_H | ||
34 | |||
35 | #include "llstring.h" | ||
36 | |||
37 | class LLURLSimString | ||
38 | { | ||
39 | public: | ||
40 | enum { NOT_SET=0, NOT_PARSED=1, PARSE_OK=2, PARSE_FAIL=-1 }; | ||
41 | |||
42 | static void setString(const LLString& url); | ||
43 | // Accepts all sorts of fragments: | ||
44 | // secondlife://RegionName/1/2/ | ||
45 | // sl://RegionName/1/2/3/ | ||
46 | // //Ahern/123/45/ | ||
47 | // Ahern | ||
48 | |||
49 | static bool parse(); | ||
50 | // Returns true if we have an URL fragment in the static instance | ||
51 | // (and it parsed correctly, which is basically always because | ||
52 | // any bare region string is a valid fragment). | ||
53 | |||
54 | static bool parse(const LLString& sim_string, std::string *region_name, S32 *x, S32 *y, S32 *z); | ||
55 | // Parse a sim string "Ahern/1/2" and return location data, | ||
56 | // doesn't affect static instance. | ||
57 | |||
58 | static std::string getURL(); | ||
59 | // Get the canonical URL secondlife://RegionName/123/45/6/ | ||
60 | |||
61 | static std::string unescapeRegionName(std::string region_name); | ||
62 | // Does URL unescaping, in particular %20 -> space | ||
63 | |||
64 | LLURLSimString() : mX(128), mY(128), mZ(0), mParseState(NOT_PARSED) {} | ||
65 | |||
66 | private: | ||
67 | static S32 parseGridIdx(const LLString& in_string, S32 idx0, S32* res, S32 max); | ||
68 | |||
69 | public: | ||
70 | static LLURLSimString sInstance; | ||
71 | static LLString sLocationStringHome; | ||
72 | static LLString sLocationStringLast; | ||
73 | |||
74 | public: | ||
75 | LLString mSimString; // "name/x/y/z" | ||
76 | LLString mSimName; | ||
77 | S32 mX,mY,mZ; | ||
78 | S32 mParseState; | ||
79 | }; | ||
80 | |||
81 | #endif | ||