summaryrefslogtreecommitdiffabout
path: root/include/kingate/util.h
Unidiff
Diffstat (limited to 'include/kingate/util.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/kingate/util.h35
1 files changed, 29 insertions, 6 deletions
diff --git a/include/kingate/util.h b/include/kingate/util.h
index 4b0dca8..6024ccf 100644
--- a/include/kingate/util.h
+++ b/include/kingate/util.h
@@ -3,21 +3,44 @@
3 3
4#include <string> 4#include <string>
5 5
6#ifndef __deprecated
7#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
8#define __deprecated __attribute__((deprecated))
9#else
10#define __deprecated
11#endif
12#endif
13
6namespace kingate { 14namespace kingate {
7 using namespace std; 15 using namespace std;
8 16
9 /** 17 /**
10 * Escape string for passing via URL. 18 * Encode string for passing via URL.
11 * @param str string unescaped. 19 * @param str string unencoded.
12 * @return the escaped string. 20 * @return the encoded string.
13 */ 21 */
14 string url_escape(const string& str); 22 string url_encode(const string& str);
15 /** 23 /**
16 * Remove URL-encoding from the string. 24 * Remove URL-encoding from the string.
17 * @param str the URL-encoded string. 25 * @param str the URL-encoded string.
18 * @return the unescaped string. 26 * @return the decoded string.
27 */
28 string url_decode(const string& str);
29
30 /**
31 * deprecated alias to url_encode.
32 * @see url_encode
33 */
34 inline string __deprecated url_escape(const string& str) {
35 return url_encode(str);
36 }
37 /**
38 * deprecated alias to url_decode.
39 * @see url_decode
19 */ 40 */
20 string url_unescape(const string& str); 41 inline string __deprecated url_unescape(const string& str) {
42 return url_decode(str);
43 }
21} 44}
22 45
23#endif /* __KINGATE_UTIL_H */ 46#endif /* __KINGATE_UTIL_H */