summaryrefslogtreecommitdiffabout
path: root/include/kingate/util.h
blob: 6024ccfb46eff216492e5916629d63e10651b1a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef __KINGATE_UTIL_H
#define __KINGATE_UTIL_H

#include <string>

#ifndef __deprecated
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
#define __deprecated    __attribute__((deprecated))
#else
#define __deprecated
#endif
#endif

namespace kingate {
    using namespace std;

    /**
     * Encode string for passing via URL.
     * @param str string unencoded.
     * @return the encoded string.
     */
    string url_encode(const string& str);
    /**
     * Remove URL-encoding from the string.
     * @param str the URL-encoded string.
     * @return the decoded string.
     */
    string url_decode(const string& str);

    /**
     * deprecated alias to url_encode.
     * @see url_encode
     */
    inline string __deprecated url_escape(const string& str) {
	return url_encode(str);
    }
    /**
     * deprecated alias to url_decode.
     * @see url_decode
     */
    inline string __deprecated url_unescape(const string& str) {
	return url_decode(str);
    }
}

#endif /* __KINGATE_UTIL_H */
/*
 * vim:set ft=cpp:
 */