diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llcommon/lluri.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llcommon/lluri.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/linden/indra/llcommon/lluri.h b/linden/indra/llcommon/lluri.h new file mode 100644 index 0000000..52f07bf --- /dev/null +++ b/linden/indra/llcommon/lluri.h | |||
@@ -0,0 +1,91 @@ | |||
1 | /** | ||
2 | * @file lluri.h | ||
3 | * @author Phoenix | ||
4 | * @date 2006-02-05 | ||
5 | * @brief Declaration of the URI class. | ||
6 | * | ||
7 | * Copyright (c) 2006-2007, Linden Research, Inc. | ||
8 | * | ||
9 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
10 | * to you under the terms of the GNU General Public License, version 2.0 | ||
11 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
12 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
13 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
14 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
15 | * | ||
16 | * There are special exceptions to the terms and conditions of the GPL as | ||
17 | * it is applied to this Source Code. View the full text of the exception | ||
18 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
19 | * online at http://secondlife.com/developers/opensource/flossexception | ||
20 | * | ||
21 | * By copying, modifying or distributing this software, you acknowledge | ||
22 | * that you have read and understood your obligations described above, | ||
23 | * and agree to abide by those obligations. | ||
24 | * | ||
25 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
26 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
27 | * COMPLETENESS OR PERFORMANCE. | ||
28 | */ | ||
29 | |||
30 | #ifndef LL_LLURI_H | ||
31 | #define LL_LLURI_H | ||
32 | |||
33 | #include <string> | ||
34 | |||
35 | class LLSD; | ||
36 | |||
37 | /** | ||
38 | * | ||
39 | * LLURI instances are immutable | ||
40 | * See: http://www.ietf.org/rfc/rfc3986.txt | ||
41 | * | ||
42 | */ | ||
43 | class LLURI | ||
44 | { | ||
45 | public: | ||
46 | LLURI(); | ||
47 | LLURI(const std::string& escaped_str); | ||
48 | // construct from escaped string, as would be transmitted on the net | ||
49 | |||
50 | ~LLURI(); | ||
51 | |||
52 | static LLURI buildHTTP(const std::string& host_port, | ||
53 | const LLSD& path); | ||
54 | static LLURI buildHTTP(const std::string& host_port, | ||
55 | const LLSD& path, | ||
56 | const LLSD& query); | ||
57 | |||
58 | std::string asString() const; | ||
59 | // the whole URI, escaped as needed | ||
60 | |||
61 | // Parts of a URI | ||
62 | // These functions return parts of the decoded URI. The returned | ||
63 | // strings are un-escaped as needed | ||
64 | |||
65 | // for all schemes | ||
66 | std::string scheme() const; // ex.: "http", note lack of colon | ||
67 | std::string opaque() const; // everything after the colon | ||
68 | |||
69 | // for schemes that follow path like syntax (http, https, ftp) | ||
70 | std::string authority() const; // ex.: "bob@host.com:80" | ||
71 | std::string hostName() const; // ex.: "host.com" | ||
72 | U16 hostPort() const; // ex.: 80, will include implicit port | ||
73 | std::string path() const; // ex.: "/abc/def", includes leading slash | ||
74 | // LLSD pathArray() const; // above decoded into an array of strings | ||
75 | std::string query() const; // ex.: "x=34", section after "?" | ||
76 | LLSD queryMap() const; // above decoded into a map | ||
77 | static LLSD queryMap(std::string escaped_query_string); | ||
78 | |||
79 | // Escaping Utilities | ||
80 | static std::string escape(const std::string& str); | ||
81 | static std::string unescape(const std::string& str); | ||
82 | |||
83 | private: | ||
84 | std::string mScheme; | ||
85 | std::string mEscapedOpaque; | ||
86 | std::string mEscapedAuthority; | ||
87 | std::string mEscapedPath; | ||
88 | std::string mEscapedQuery; | ||
89 | }; | ||
90 | |||
91 | #endif // LL_LLURI_H | ||